We discuss some basic algorithmic issues in flexible optical networks, highlighting the algorithmic challenges and differences to fixed-grid WDM networks and outline algorithms for planning and operating flexible optical networks. In the planning problem we assume that we are given the traffic matrix and the transponders' feasible configurations that account for the physical layer, and the objective is to serve the traffic and find a solution that minimizes the maximum spectrum used and the cost (number and type) of transponders. The offline RSA algorithm that we outline serves demands for their requested rates by choosing the route, breaking the transmissions in more than one connection and placing regenerators, if needed, and allocating spectrum to them. We then turn our attention to operating a flexible optical network. We assume that the spectrum allocated to a connection can be adapted so as to follow the time-varying required transmission rate. We outline a framework to orchestrate spectrum sharing and a RSA algorithm to serve the demands so as to minimize the blocking caused by the traffic fluctuations.