Generate an explanatory visualization of the following algorithm. Strive to create an interactive visualization that illustrates and demonstrates how the algorithm functions. Use animations, transitions and strive for an engaging as well as demonstrative demo: