1. Home
  2. Explore
  3. Computer Science
  4. Linked Lists Introduction

Study methods

Flashcards
Quiz
Fill in the blanks
Written test
Lesson
Notes
Podcast
Content

Linked Lists Introduction

  • 28Unfamiliar
  • 0Learning
  • 0Familiar
  • 0Mastered
Topic: Linked List Basics
A linked list is a type of
made up of many nodes.

28 questions

  1. 1
    A linked list is a type of
    _____
    made up of many nodes.
    Hint

    Consider the category of structures used to organize data in programming.

    Answer

    data structure

  2. 2
    A
    _____
    is a container for some data and a reference to the next node in a linked list.
    Hint

    Think of the individual elements that make up a linked list.

    Answer

    node

  3. 3
    In a linked list, the first node is called the
    _____
    .
    Hint

    Think of the starting point of the list.

    Answer

    head

  4. 4
    The last node in a linked list is called the
    _____
    .
    Hint

    Think of the opposite end from the head.

    Answer

    tail

  5. 5
    A linked list is an inherently
    _____
    data structure, meaning nodes have a sequential order.
    Hint

    Contrast with unordered structures like sets.

    Answer

    ordered

  6. 6
    An array stores its elements
    _____
    in memory, meaning they are placed right next to each other.
    Hint

    Think about how array elements are laid out physically in RAM.

    Answer

    contiguously

  7. 7
    Inserting an element in the middle of an array has a time complexity of
    _____
    in the worst case.
    Hint

    Consider the need to shift elements after the insertion point.

    Answer

    O(n)

  8. 8
    Inserting a node into a linked list by adjusting pointers takes
    _____
    time.
    Hint

    Think about how many pointer changes are needed regardless of list length.

    Answer

    O(1)

  9. 9
    In an iterative linked list traversal, we use a variable called
    _____
    that starts at the head and is updated to current.next.
    Hint

    It holds a reference to the node currently being processed.

    Answer

    current

  10. 10
    A common mistake in traversal is checking
    _____
    instead of the current node itself, which can skip the last node.
    Hint

    Think about prematurely checking the next node before processing it.

    Answer

    current.next

  11. 11
    In a recursive traversal, the base case occurs when the head (or current node) is
    _____
    .
    Hint

    This represents an empty list or the end of the list.

    Answer

    null

  12. 12
    In the linked list values problem, we return an
    _____
    containing all node values in order.
    Hint

    Think of a collection type that holds multiple values in a sequence.

    Answer

    array

  13. 13
    In the iterative solution for linked list values, we push each node's value into the array and then set current =
    _____
    .
    Hint

    This progresses the traversal to the next node.

    Answer

    current.next

  14. 14
    In the recursive solution for linked list values, we use a helper function that takes the head and a reference to the values
    _____
    to avoid creating multiple arrays.
    Hint

    By passing the same array reference, all recursive calls add to the same collection.

    Answer

    array

  15. 15
    In the sum list problem, the iterative solution initializes a sum variable to
    _____
    .
    Hint

    What is the identity element for addition?

    Answer

    0

  16. 16
    In the recursive sum list solution, the base case when head is null returns
    _____
    .
    Hint

    An empty linked list has a total sum of what?

    Answer

    0

  17. 17
    In the linked list find problem, the iterative solution returns
    _____
    early when a match is found.
    Hint

    What boolean indicates the target is present?

    Answer

    true

  18. 18
    In the recursive find solution, one base case returns true when
    _____
    equals the target.
    Hint

    Check the current node's data against the target.

    Answer

    head.val

  19. 19
    In the get node value problem, the iterative solution counts
    _____
    to track the index of the current node.
    Hint

    Count starts at 0 and increases with each node.

    Answer

    upward

  20. 20
    In the recursive get node value solution, we pass
    _____
    as the index to the recursive call to approach the target.
    Hint

    We reduce the index each recursion to eventually reach zero.

    Answer

    index - 1

  21. 21
    If the target index is out of range in get node value, the iterative solution returns
    _____
    after the loop.
    Hint

    What value represents 'not found' for a node?

    Answer

    null

  22. 22
    In the reverse list problem, we need to reverse the
    _____
    pointers of the linked list in place.
    Hint

    Which pointer determines the order of nodes?

    Answer

    next

  23. 23
    In the iterative reverse solution, we use a variable called
    _____
    that is initially null to track the previous node.
    Hint

    It holds the node that was before the current node before reversal.

    Answer

    previous

  24. 24
    In the recursive reverse solution, the base case returns
    _____
    when head is null.
    Hint

    After reaching the end, which variable holds the new head?

    Answer

    previous

  25. 25
    In the zipper list problem, we always start with the first node of
    _____
    .
    Hint

    Which input list provides the first node of the merged list?

    Answer

    list one

  26. 26
    In the iterative zipper solution, we use a
    _____
    pointer to build the output list by appending nodes.
    Hint

    This pointer always points to the last node of the merged list so far.

    Answer

    tail

  27. 27
    In the iterative zipper, we use a counter to decide which list to take from; when the counter is even, we take from
    _____
    .
    Hint

    Because we started with list one, the first 'next' should come from the other list.

    Answer

    list two

  28. 28
    When one list runs out during zipper, we append the remaining nodes of the other list by setting
    _____
    to the remaining current pointer.
    Hint

    We attach the whole leftover chain to the end of the merged list.

    Answer

    tail.next

1 of 28
Question 1 of 28

Ask anything

We've read this whole study set, so questions about it get the best answers.

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent