This post has been de-listed (Author was flagged for spam)
It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.
From Sedgewick's Computer Science: An Interdisciplinary Approach, exercise 2.3.25:
There are 2n discs of increasing size stored on three poles. Initially, all of the discs with odd size (1, 3, ..., 2n - 1) are piled on the left pole from top to bottom in increasing order of size; all of the discs with even size (2, 4, ..., 2n) are piled on the right pole. Write a program to provide instructions for moving the odd discs to the right pole and the even discs to the left pole, obeying the same rules as for towers of Hanoi.
Any ideas on how to approach this problem? I'm struggling to come up with a recursive solution.
Subreddit
Post Details
- Posted
- 8 months ago
- Reddit URL
- View post on reddit.com
- External URL
- reddit.com/r/algorithms/...