Theoretical models of vehicular traffic ascribe the fundamental cause of velocity oscillations and stop-and-go waves to suboptimal or unpredictable human driving behavior. In this paper we ask: if vehicles were controlled or assisted by algorithms, and hence driven optimally, would these phenomena simply go away? If not, how should a regulator manage algorithm-assisted vehicular traffic for a smooth flow? We study these questions in the context of a mandatory lane-changing scenario with mixed traffic, i.e., an algorithm-assisted driver on a curtailed lane that has to merge to an adjacent free lane with a relatively dense platoon of human drivers. In a stylized model of algorithm-assisted driving, we liken the blocked-lane driver to a rational self-interested agent, whose objective is to minimize her expected travel time through the blockage, deciding (a) at what velocity to move, and (b) whether to merge to the free lane, if given the opportunity (adequate gap). Moving at higher velocities reduces travel time, but also reduces the probability of finding a large enough gap to merge. We analyze the problem via dynamic programming, and we show that the optimal policy has a surprising structure: in the presence of uncertainty on adequate-sized gaps in the target lane, it may be optimal for the blocked-lane driver, in certain parameter regimes, to oscillate between high and low velocities while attempting to merge. Hence, traffic oscillations can arise not just due to suboptimal or unpredictable human driving behavior, but also endogenously, as the outcome of a driver’s rational, optimizing behavior. We draw out structural similarities to bang-bang control. As velocity oscillations are known to be detrimental to a smooth traffic flow, we provide sufficient conditions on the velocity limits so that traffic oscillations while merging, due to such optimizing behavior, do not arise at optimality. Finally, we investigate the fundamental flow-density and travel time-density diagrams through traffic micro-simulations. We establish that the proposed approach exhibits consistently near-optimal performance, in a broad variety of traffic conditions.