← All CodeSignal Technical Assessment Flashcard Decks

Core Data Structures Flashcards

7 cards from real CodeSignal Technical Assessment practice questions. Tap to flip, then mark Knew It or Still Learning — missed cards come back until you master them.

Read the first 7 Core Data Structures flashcards as text
  1. Which data structure best supports O(log n) insertion, deletion, AND lookup of ordered data?

    Answer: Balanced BST (e.g., AVL or Red-Black tree)

    Balanced BSTs maintain a height of O(log n) through rotations, guaranteeing logarithmic time for all three operations.

  2. In a max-heap, after calling extractMax(), what happens to maintain the heap property?

    Answer: The last element replaces the root, then is sifted down

    The last element is moved to the root and repeatedly swapped with its larger child (sift-down) until the heap property is restored.

  3. What is the space complexity of storing a graph with V vertices and E edges using an adjacency matrix?

    Answer: O(V²)

    An adjacency matrix allocates a V×V boolean or weight matrix regardless of the number of actual edges.

  4. Which scenario represents a use case where a stack is the natural choice?

    Answer: Evaluating a mathematical expression with nested parentheses

    Parenthesis matching and expression evaluation use a stack to track open brackets and pending operations in LIFO order.

  5. What is the time complexity of BFS (Breadth-First Search) on a graph with V vertices and E edges?

    Answer: O(V + E)

    BFS visits every vertex once and traverses each edge once, giving O(V + E) overall time complexity.

  6. A linked list is generally preferred over an array when:

    Answer: Frequent insertions and deletions at arbitrary positions are required

    Linked lists allow O(1) insertion/deletion at a known node without shifting elements, unlike arrays which require O(n) shifting.

  7. Which statement about hash map load factor is correct?

    Answer: A load factor above a threshold (e.g., 0.75) typically triggers resizing to limit collision probability

    When the load factor exceeds a set threshold, the hash map resizes (rehashes) to keep the average chain length low and maintain O(1) average operations.