Free Online Flashcard Deck

4 Linked Lists Free Online FlashCards

Study 4 Linked Lists with 12 free online flashcards. Review key terms, definitions, and concepts with this interactive flashcard deck.

12 cards
01
Front

What is a linked list?

Back

A linked list is a linear structure of nodes connected by links, with a reference to its first node, the head.

02
Front

What does a linked-list node contain?

Back

A node stores a payload, or value, and one or more links that reference neighboring nodes.

03
Front

What is the head?

Back

The head is the reference to the first node in a linked list.

04
Front

How does a singly linked list mark its end?

Back

The final node's next link is null, which marks the end of a singly linked list.

05
Front

How do you traverse a singly linked list?

Back

Traversal starts at head and repeatedly follows next until the current node is null.

06
Front

What is linked-list traversal complexity?

Back

Traversal takes O(n)O(n) time because each of the list's nn nodes may need to be visited.

07
Front

How do you insert at the front?

Back

Front insertion takes O(1)O(1) time: set new_node.next to head, then update head to new_node.

08
Front

When is insertion after a node O(1)O(1)?

Back

If the predecessor is known, insertion after it takes O(1)O(1) time by assigning new_node.next = current.next and current.next = new_node.

09
Front

How do you delete the first node?

Back

Deleting the first node takes O(1)O(1) time: save head if needed, then set head = head.next.

10
Front

Why cannot a singly linked list move backward directly?

Back

A singly linked list cannot move backward directly because each node links only to the next node, not the previous one.

11
Front

What distinguishes a doubly linked list?

Back

A doubly linked node has both next and prev links, allowing movement toward the next and previous nodes.

12
Front

Why can known-node deletion be O(1)O(1) in a doubly linked list?

Back

Deleting a known node in a doubly linked list takes O(1)O(1) time by connecting its neighbors with A.next = C and C.prev = A.