Linked Lists

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/14

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

15 Terms

1
New cards

Linked List - Insert at Head

O(1)

2
New cards

Linked List - Remove from head

O(1)

3
New cards

Linked List - Insert at tail

O(1) (with tail pointer)

O(n) (without tail pointer)

4
New cards

Linked List - Remove from tail

O(n)

5
New cards

Linked List - Search/Contains

O(n)

6
New cards

Doubly Linked List - Insert at head

O(1)

7
New cards

Doubly Linked List - Remove from head

O(1)

8
New cards

Doubly Linked List - Insert at tail

O(1)

9
New cards

Doubly Linked List - Remove from tail

O(1)

10
New cards

Doubly Linked List - Search/Contains

O(n)

11
New cards

Linked List - Pros

  • Lower memory overhead compared to doubly linked lists and arrays

  • Can grow dynamically in size

12
New cards

Linked List - Cons

  • Removal of tail is inefficient O(n)

  • Can only traverse in the forward direction

  • No direct access to previous nodes

  • O(n) for searching

13
New cards

Doubly Linked List - Pros

  • Can perform operations at both ends efficiently O(1)

  • Can traverse in both directions

14
New cards

Doubly Linked List - Cons

  • High memory overhead

  • More complex insertion and deletion operations

15
New cards

General Linked List Operations

  • peekHead()

  • peekTail()

  • insertAtHead()

  • insertAtTail()

  • deleteFromHead()

  • deleteFromTail()

  • contains()