AMD interview question

Reverse a list

Interview Answers

Anonymous

19 Nov 2014

Pretty simple

Anonymous

20 Nov 2016

1) Initialize PREVIOUS to null, CURRENT to head, NEXT to null 2) Start with head, go down the list working one element at a time. a) set NEXT to pointer to next element b) set pointer to next element in CURRENT to PREVIOUS c) set PREVIOUS to CURRENT for next iteration d) set CURRENT to NEXT for next iteration 3) set head to PREVIOUS

1