channels.im is one of the many independent Mastodon servers you can use to participate in the fediverse.

Administered by:

Server stats:

44
active users

@usluck is this referring to how function calls are stored on the stack or smth i don't get it
Sort of, also with sorting algorithms and sich.

It's called Tower of Hanoi.
Imagine you have 3 poles (A, B, C) and N disks. The discs can only be in ascending order of size so a larger disk can never go on top of a smaller disk.

The goal is to move the stack from the left-most column to the right-most column. You can only move one disk at a time and only in a LIFO fashion. Now the trick is writing a program which can solve for it, to be honest I get the joke but... it doesn't seem that hard.

I'm supposing it might be a leetcode question or a common problem given in CS classes hence the PTSD. It's actually the perfect kind of problem to be broken down into sub-problems -- aka ideal for recursive functions.
@Kirino @usluck @nyanide it was one of the first things featured in the Concrete Mathematics textbook where it was used to teach about recurrence relations. although if this was the source then it would have been the much harder Josephus problem
@usluck It's almost done, there's just the last piece to put in the middle.

If you want to experience maximum hanoi, just M-x hanoi-unix-64 in the Church of Emacs.