← 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 would you use to find the k-th largest element in a stream of numbers efficiently?

    Answer: Min-heap of size k

    A min-heap of size k keeps the k largest seen elements; its root is always the k-th largest.

  2. What is the time complexity of deleting a node from the middle of a singly linked list, given a pointer directly to that node?

    Answer: O(1)

    With a direct pointer, you can copy the next node's data into the current node and delete the next node in O(1) time.

  3. In a hash map using chaining, what is the worst-case time complexity for a lookup?

    Answer: O(n)

    If all n keys hash to the same bucket, the chain becomes a linked list of length n, requiring O(n) search.

  4. Which property distinguishes a complete binary tree from a full binary tree?

    Answer: A complete binary tree fills all levels left-to-right with the last level possibly incomplete; a full binary tree has every node with exactly 0 or 2 children

    Complete binary trees fill each level left to right (last level may be partial), while full binary trees require every node to have 0 or 2 children.

  5. What is a trie (prefix tree) primarily optimized for?

    Answer: Fast prefix-based string lookups and autocomplete

    A trie stores strings character by character, making prefix searches and autocomplete O(m) where m is the prefix length.

  6. An undirected graph has 5 vertices and is fully connected (complete graph). How many edges does it have?

    Answer: 10

    A complete graph on n vertices has n(n-1)/2 edges; for n=5 that is 5×4/2 = 10.

  7. What problem does a circular buffer (ring buffer) solve compared to a standard fixed-size queue?

    Answer: It reuses memory by wrapping indices instead of shifting elements

    A circular buffer uses modular arithmetic to wrap the head and tail pointers, reusing freed slots without shifting data.