Interview Question

Senior Software Engineer Interview Nashua, NH

Find the logical error in the Linkedlist reversal program

  (the program was given). Need to use the gdb tool to debug and correct the program.
Tags:
c/c++ programming.
Answer

Interview Answer

1 Answer

0

The linked list should be reversed in one pass. This uses stack datastructure.
As you traverse the linked list from head node to tail node, take the node and put it in the front of the new linked list (i.e. reversed output linked list).

They basically check if you can use debugger tools to find/correct the error in the program.

Interview Candidate on Oct 1, 2010

Add Answers or Comments

To comment on this Question, Sign In with Facebook or Sign Up