← 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. What is the amortized time complexity of appending to a dynamic array (e.g., Python list or Java ArrayList)?

    Answer: O(1)

    Although occasional resizing is O(n), doubling the capacity each time makes the amortized cost of each append O(1).

  2. In a graph represented as an adjacency list, what is the space complexity for a graph with V vertices and E edges?

    Answer: O(V + E)

    An adjacency list stores one entry per vertex and one entry per directed edge, totaling O(V + E) space.

  3. Which traversal of a Binary Search Tree visits nodes in ascending sorted order?

    Answer: In-order

    In-order traversal (left → root → right) visits BST nodes from smallest to largest.

  4. What is the main advantage of using a deque (double-ended queue) over a standard queue?

    Answer: Efficient insertion and deletion at both ends

    A deque supports O(1) push and pop at both the front and back, unlike a queue which only allows one end per operation.

  5. Which data structure is most suitable for implementing a browser's back/forward navigation history?

    Answer: Two stacks

    Two stacks (one for back history, one for forward history) naturally model pushing/popping pages visited.

  6. What is a key difference between a tree and a graph?

    Answer: A tree is a connected acyclic graph; a graph may have cycles and disconnected components

    A tree is a special case of a graph that is connected, undirected (structurally), and contains no cycles.

  7. Given a stack, what is the result of performing: push(1), push(2), push(3), pop(), peek()?

    Answer: 2

    After pushing 1, 2, 3 the top is 3; pop() removes 3, leaving 2 on top; peek() returns 2 without removing it.