โ† All AMCAT Flashcard Decks

Data Structures and Algorithms Flashcards

6 cards from real AMCAT practice questions. Tap to flip, then mark Knew It or Still Learning โ€” missed cards come back until you master them.

Read the first 6 Data Structures and Algorithms flashcards as text
  1. What is the space complexity of a recursive Fibonacci function (without memoization)?

    Answer: O(n)

    The call stack depth is proportional to n, giving O(n) space complexity.

  2. Which graph traversal algorithm uses a queue?

    Answer: Breadth-First Search

    Breadth-First Search uses a queue to explore neighbors level by level.

  3. What is the time complexity of inserting an element at the beginning of a singly linked list?

    Answer: O(1)

    Inserting at the head of a linked list only requires updating two pointers, which is O(1).

  4. Which algorithm is used to find the shortest path in a weighted graph with non-negative weights?

    Answer: Dijkstra's

    Dijkstra's algorithm finds the shortest path in graphs with non-negative edge weights using a priority queue.

  5. A hash table with chaining resolves collisions by:

    Answer: Maintaining a linked list at each bucket

    In chaining, each bucket holds a linked list of all keys that hash to the same index.

  6. What property must a graph satisfy to have a valid topological sort?

    Answer: It must be a directed acyclic graph (DAG)

    Topological sort is only defined for Directed Acyclic Graphs (DAGs) with no cycles.