Given a singly-linked-list, a program to reverse the list and return the new head-node
I was given this question in an interview recently and I did something that nobody likes to do in an interview - quit thinking !!! The problem looks fairly simple superficially, but is a little trickier than one would think. It might've been fairly easier if I had previously encountered this question and had given a try. But in any case, after messing up and providing a horrendously inefficient and possibly incorrect implementation I got back home, relaxed and thought :) [That's right, only if I did this earlier] about it and came up with a few implementation which I decided to post:
No comments:
Post a Comment