1. Home
  2. Explore
  3. Computer Science
  4. Data Structures Course

Study methods

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

Data Structures Course

  • 64Unfamiliar
  • 0Learning
  • 0Familiar
  • 0Mastered
Topic: Overview
Data structures are a way to store, organize, and
data.

64 questions

  1. 1
    Data structures are a way to store, organize, and
    _____
    data.
    Hint

    Think about what you can do with data besides storing and organizing it.

    Answer

    manipulate

  2. 2
    The two main categories of data structures are linear and
    _____
    .
    Hint

    Consider the opposite of linear in terms of structure.

    Answer

    non-linear

  3. 3
    Arrays, linked lists, stacks, and queues are examples of
    _____
    data structures.
    Hint

    Think about the order in which elements are arranged.

    Answer

    linear

  4. 4
    Data structures are not the same as
    _____
    ; for example, integer and boolean are the latter.
    Hint

    Consider the difference between a primitive piece of data and a structure that holds multiple pieces.

    Answer

    data types

  5. 5
    An array is an
    _____
    collection of elements.
    Hint

    Think about how elements are accessed by index.

    Answer

    ordered

  6. 6
    A fixed-size array's size is defined at initialization and
    _____
    be changed.
    Hint

    The opposite of dynamic.

    Answer

    cannot

  7. 7
    Initializing a fixed-size array with n elements takes
    _____
    time.
    Hint

    Think about how many memory slots need to be allocated.

    Answer

    O(n)

  8. 8
    Accessing an element in an array by index takes
    _____
    time due to memory addressing.
    Hint

    The time is constant regardless of array size.

    Answer

    O(1)

  9. 9
    Inserting an element in a fixed-size array at any position except the end typically takes
    _____
    time.
    Hint

    Consider the number of elements that need to be shifted.

    Answer

    O(n)

  10. 10
    In a fixed-size array, inserting an element at the last position takes
    _____
    time.
    Hint

    No shifting is needed.

    Answer

    O(1)

  11. 11
    Deleting an element from a fixed-size array at the beginning takes
    _____
    time.
    Hint

    Think about how many elements must be moved to fill the gap.

    Answer

    O(n)

  12. 12
    In a dynamic array, when resizing, the new size is often
    _____
    the original size.
    Hint

    This is a common strategy to amortize the cost.

    Answer

    double

  13. 13
    The push (or enqueue) operation in an array-based queue implemented with the front at index 0 takes
    _____
    time.
    Hint

    Adding to the end is efficient.

    Answer

    O(1)

  14. 14
    In a singly linked list, each node contains a value and a
    _____
    pointer.
    Hint

    This pointer connects to the following node.

    Answer

    next

  15. 15
    Accessing an element in a singly linked list requires
    _____
    traversal from the head.
    Hint

    You must follow the next pointers one by one.

    Answer

    sequential

  16. 16
    The first node of a linked list is called the
    _____
    .
    Hint

    It is the entry point to the list.

    Answer

    head

  17. 17
    In a circular singly linked list, the last node's next pointer points to the
    _____
    .
    Hint

    This creates a loop.

    Answer

    head

  18. 18
    In a circular singly linked list, storing the tail node allows insertion at the front in
    _____
    time.
    Hint

    No traversal is needed.

    Answer

    O(1)

  19. 19
    In a singly linked list, inserting a node in the middle without a reference to the previous node takes
    _____
    time.
    Hint

    You need to traverse to find the insertion point.

    Answer

    O(n)

  20. 20
    In a doubly linked list, each node has a
    _____
    pointer in addition to the next pointer.
    Hint

    It points to the node before.

    Answer

    previous

  21. 21
    In a doubly linked list, if you have a reference to a node, you can insert a new node before it in
    _____
    time.
    Hint

    You have access to the previous node via the prev pointer.

    Answer

    O(1)

  22. 22
    The main disadvantage of a doubly linked list compared to a singly linked list is increased
    _____
    usage.
    Hint

    Think about the additional data stored per node.

    Answer

    space

  23. 23
    Queues operate on the
    _____
    principle: first in, first out.
    Hint

    The acronym for the property.

    Answer

    FIFO

  24. 24
    The operation that adds an element to the back of a queue is often called
    _____
    .
    Hint

    One of the two main queue operations.

    Answer

    enqueue

  25. 25
    The operation that removes an element from the front of a queue is called
    _____
    .
    Hint

    It retrieves and removes the front element.

    Answer

    dequeue

  26. 26
    Using an array to implement a queue where elements are enqueued at the end and dequeued from the front results in a
    _____
    time complexity for dequeue.
    Hint

    Shifting is required.

    Answer

    O(n)

  27. 27
    A more efficient implementation of a queue uses a
    _____
    with a tail pointer.
    Hint

    This data structure allows constant-time operations at both ends.

    Answer

    singly linked list

  28. 28
    Stacks operate on the
    _____
    principle: last in, first out.
    Hint

    The opposite of a queue.

    Answer

    LIFO

  29. 29
    The two main operations of a stack are push and
    _____
    .
    Hint

    The operation that removes the top element.

    Answer

    pop

  30. 30
    Stacks can be efficiently implemented using an
    _____
    because all operations occur at the same end.
    Hint

    Think of adding and removing from the end of the array.

    Answer

    array

  31. 31
    One common use of a stack is implementing the
    _____
    button in a web browser.
    Hint

    Navigating to previous pages.

    Answer

    back

  32. 32
    Using two stacks to implement a queue requires that one of the operations (push or pop) takes
    _____
    time.
    Hint

    Not all operations are constant; one is linear.

    Answer

    O(n)

  33. 33
    In the two-stack queue implementation, elements are first pushed onto the
    _____
    stack.
    Hint

    The stack where new items are initially placed.

    Answer

    input

  34. 34
    In a binary tree, a node with no children is called a
    _____
    node.
    Hint

    It is at the bottom of the tree.

    Answer

    leaf

  35. 35
    The maximum number of nodes in a binary tree of height h is
    _____
    .
    Hint

    The formula involves powers of 2.

    Answer

    2^(h+1)-1

  36. 36
    Breadth-first search (BFS) of a binary tree uses a
    _____
    data structure.
    Hint

    Processes nodes level by level.

    Answer

    queue

  37. 37
    Depth-first search (DFS) of a binary tree uses a
    _____
    data structure.
    Hint

    Explores as deep as possible along each branch.

    Answer

    stack

  38. 38
    In an inorder traversal of a binary tree, the order is: left subtree, current node,
    _____
    .
    Hint

    It follows a specific pattern.

    Answer

    right subtree

  39. 39
    In a preorder traversal of a binary tree, the current node is visited
    _____
    the subtrees.
    Hint

    The prefix 'pre' indicates the order.

    Answer

    before

  40. 40
    In a postorder traversal of a binary tree, the current node is visited
    _____
    the subtrees.
    Hint

    The prefix 'post' indicates the order.

    Answer

    after

  41. 41
    A binary tree where every node has 0 or 2 children is called a
    _____
    binary tree.
    Hint

    No node has exactly one child.

    Answer

    full

  42. 42
    A binary tree where all levels are completely filled except possibly the last, and nodes in the last level are as far left as possible, is called a
    _____
    binary tree.
    Hint

    It is almost full.

    Answer

    complete

  43. 43
    A balanced binary tree must satisfy that for every node, the heights of its left and right subtrees differ by no more than
    _____
    .
    Hint

    A small constant.

    Answer

    1

  44. 44
    A binary tree where every level is completely filled is called a
    _____
    binary tree.
    Hint

    All nodes have two children except leaves.

    Answer

    perfect

  45. 45
    In a binary search tree, all values in the left subtree of a node are
    _____
    the node's value.
    Hint

    Comparison with the node value.

    Answer

    less than

  46. 46
    In a binary search tree, searching for an element takes O(
    _____
    ) time, where h is the height.
    Hint

    Depends on the tree height.

    Answer

    h

  47. 47
    When deleting a node in a BST that has two children, you replace it with the minimum value from the
    _____
    subtree.
    Hint

    The smallest value greater than the node.

    Answer

    right

  48. 48
    In a balanced BST, the height is approximately
    _____
    of the number of nodes.
    Hint

    The logarithm base 2.

    Answer

    log2 n

  49. 49
    In a max heap, the value of each parent node is
    _____
    than or equal to its children.
    Hint

    The root is the maximum.

    Answer

    greater

  50. 50
    Heaps are typically implemented using an
    _____
    because they form a complete binary tree.
    Hint

    A contiguous memory structure.

    Answer

    array

  51. 51
    In an array-based heap, the left child of the node at index i is at index
    _____
    .
    Hint

    Relates to parent index i.

    Answer

    2i+1

  52. 52
    In an array-based heap, the right child of the node at index i is at index
    _____
    .
    Hint

    One more than the left child.

    Answer

    2i+2

  53. 53
    The process of inserting an element into a heap involves adding it at the end and then
    _____
    up.
    Hint

    Moving upward to restore the heap property.

    Answer

    sifting

  54. 54
    The time complexity of inserting an element into a heap is O(
    _____
    ).
    Hint

    Base 2 logarithm.

    Answer

    log n

  55. 55
    A graph consists of two sets: vertices and
    _____
    .
    Hint

    Connections between vertices.

    Answer

    edges

  56. 56
    In an undirected graph, edges are
    _____
    .
    Hint

    They can be traversed in both directions.

    Answer

    bidirectional

  57. 57
    A graph that has weights associated with edges is called a
    _____
    graph.
    Hint

    Each edge has a cost or distance.

    Answer

    weighted

  58. 58
    A graph that contains at least one cycle is called a
    _____
    graph.
    Hint

    The opposite of acyclic.

    Answer

    cyclic

  59. 59
    An adjacency matrix for a graph with V vertices has dimensions
    _____
    .
    Hint

    Square matrix.

    Answer

    V x V

  60. 60
    An adjacency list representation uses
    _____
    to store edges for each vertex.
    Hint

    A node-based structure.

    Answer

    linked lists

  61. 61
    The adjacency list representation is more space-efficient for
    _____
    graphs.
    Hint

    Graphs with few edges relative to vertices.

    Answer

    sparse

  62. 62
    The output of a hash function is often called a
    _____
    or hash.
    Hint

    A concise representation.

    Answer

    digest

  63. 63
    A situation where two different inputs produce the same hash output is called a
    _____
    .
    Hint

    It's a problem to resolve.

    Answer

    hash collision

  64. 64
    In a perfect hash table, lookup operations run in
    _____
    time.
    Hint

    Constant time.

    Answer

    O(1)

1 of 64
Question 1 of 64

Ask anything

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

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent