Section 7: Linked Lists — Operations and Complexity (73–84)

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/11

encourage image

There's no tags or description

Looks like no tags are added yet.

12 Terms

1
New cards

Time complexity of linked-list size() when size is stored as a field

O(1)O(1)

2
New cards

Time complexity of linked-list add() at the end when a tail reference is maintained

O(1)O(1)

3
New cards

Time complexity of linked-list nodeAtIndex(i)

O(n)O(n)

4
New cards

Time complexity of linked-list get(i)

O(n)O(n)

5
New cards

Time complexity of linked-list contains(element)

O(n)O(n)

6
New cards

Time complexity of linked-list indexOf(element)

O(n)O(n)

7
New cards

Function of set(i, element) in a linked list

Finds the node at index ii and replaces its stored data.

8
New cards

Time complexity of linked-list set(i, element)

O(n)O(n), because finding the node at index ii requires linear traversal.

9
New cards

Function of spliceIn in a linked list

Inserts a new element at a specified node position by instantiating a node and updating adjacent references.

10
New cards

Time complexity of spliceIn once the insertion position is known

O(1)O(1)

11
New cards

Function of spliceOut in a linked list

Removes a node by updating references so that surrounding nodes are linked directly together.

12
New cards

Time complexity of spliceOut once the node position is known

O(1)O(1)