logo

Iterative Version for Reversing a Singly Linked List

   

Added on  2022-10-10

5 Pages504 Words399 Views
Running head: IN2002 DATA STRUCTURES AND ALGORITHMS
IN2002 Data Structures and Algorithms
Name of the Student
Name of the University
Authors note
Iterative Version for Reversing a Singly Linked List_1
IN2002 DATA STRUCTURES AND ALGORITHMS
1
Iterative version for reversing a singly linked list
Begin:
If (headnode != NULL)
then
pre ← headnode
headnode ← headnode.next
cur ← headnode
prev.next ← NULL
While (headnode != NULL) do
headnode← headnode.next
cur.next ← prev
prev ← cur
cur ← headnode
End while
headnode ← prev
End if
End
Iterative Version for Reversing a Singly Linked List_2

End of preview

Want to access all the pages? Upload your documents or become a member.

Related Documents
Justification of other data structures and design issues.
|2
|453
|568

Programming: Sorted Linked List, Binary Tree Traversal, and Efficient Sorting Algorithms
|6
|627
|111