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
What is the worst-case time complexity for searching an element in a balanced Binary Search Tree (BST)?
Answer: O(log n)
A balanced BST has height O(log n), so search eliminates half the remaining nodes at each step.
In a min-heap, which statement is always true?
Answer: Every node is smaller than or equal to its children
The min-heap property requires every parent node to be less than or equal to its children.
Which data structure uses FIFO (First-In, First-Out) ordering?
Answer: Queue
A queue strictly processes elements in the order they were added, making the first element added the first removed.
What is the time complexity of inserting a key-value pair into a hash map with a good hash function (average case)?
Answer: O(1)
With a good hash function and low load factor, insertion computes the bucket index in constant time.
A doubly linked list differs from a singly linked list because each node in a doubly linked list:
Answer: Has a pointer to both next and previous nodes
Doubly linked list nodes carry both a `next` and a `prev` pointer, enabling bidirectional traversal.
Which operation on a stack is used to view the top element WITHOUT removing it?
Answer: peek()
peek() (also called top()) returns the top element while leaving the stack unchanged.
What happens when a hash map experiences a collision?
Answer: Two keys map to the same bucket and must be resolved by chaining or open addressing
Collisions occur when two keys hash to the same index and are resolved via chaining (linked list) or open addressing (probing).