single and double linked lists

177 views

I read it like 5 times and I don’t understand

In: 1

4 Answers

Anonymous 0 Comments

A singly-linked list lets you go forward only (item 0, item 1, item 2 … item n), whereas a doubly linked list lets you go forward or backward.

Mechanically speaking, a singly linked list is a bunch nodes where each node (at a minimum) has some kind of value, and a pointer to the next node, whereas the nodes in a doubly-linked list have that plus a pointer to their previous node.

So this
`{
Val: X,
Next: some_node
}`

versus
`{
Val: X,
Next: some_node,
Prev: other_node
}`

You are viewing 1 out of 4 answers, click here to view all answers.