AMD Interview Question

Reverse a list

Interview Answers

Anonymous

Nov 19, 2014

Pretty simple

Anonymous

Nov 20, 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