-
> It's a circular singly linked list.
But there is still an external pointer which points to ONE of the nodes of the ring, and if you delete that node of the list without updating the external pointer you still lose.
But for any other node, you just chase round the list until you find the previous node, then it's easy to delete a node.
-
I didn't read all of the thread (just the first few responses), but wanted to add this: I really don't understand the need for something like this in an interview. Sure, I guess it's nice to know that the person you're about to hire knows the ins and outs of a language... but why does it have to be so detailed? I never had some of the CS classes where they define processes of how to program and I was never told that there were "steps" to the process and certainly never had them named for me.
I just do it... and I know how to debug and I bet I could program better than a lot of people that apply for these jobs. Just because they can tell you a few small differences between pre and post increment doesn't mean that they can figure out the best algorithm or the fastest way to do something.
It just ........es me off and I know I'm going to face it again when I look for a new job.