walkccc / CLRS

📚 Solutions to Introduction to Algorithms Third Edition
https://walkccc.me/CLRS
MIT License
4.63k stars 1.26k forks source link

10.2-1 #423

Closed 13thThief closed 2 years ago

13thThief commented 2 years ago
LIST-INSERT(L, x)
    x.next = L.head
    L.head = x

Shouldn't it be:

LIST-INSERT(L, x)
    x.next = L.head.next 
    L.head = x
13thThief commented 2 years ago

Oops, L.head points to the next node (or Null) in a Singly Linked List.