AlgoScope

Singly Linked List

Each node points at the next. To reach the tenth you walk the first nine.

Data structures, data structure, beginner
prev is 5. curr is 1.5142headprevcurr
prev is 5. curr is 1.5142headprevcurr

Singly Linked List: Reverse the list

Step, step 3 of 11

Slide the pointers along: prev = 5, curr = 1.

Cost

Access
O(n)
Search
O(n)
Insert at head
O(1)
Insert after node
O(1)
Delete after node
O(1)
Insert at tail
O(n)
Space
O(n)

Insert at tail is O(1) with a tail pointer.

Before this

Leads to

Topics that need this one first.

Taught by the same lesson

Singly Linked List covers these too, in the same run.