Reversing a Linked List, but as a Children’s Story

  1. You can only walk along the magic rope in the direction that it is pointing
  2. The magic bridge will continue on forever until one of the magic ropes points to an “end” sign.

So how does it look in code?

Reversing a linked list depends heavily on its order of operations. Using the characters and props above, let’s represent this story with some pseudocode.

  1. Replace the “end signs” with null values
  2. Replace the .nextStoneOver and .magicRope properties with .next values



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store