Data Structures Flashcards
6 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 6 Data Structures flashcards as text
What is the time complexity of accessing an element in an array by index?
Answer: O(1)
Array access by index is constant time because elements are stored in contiguous memory locations.
What data structure uses FIFO (First In, First Out) ordering?
Answer: Queue
A queue processes elements in the order they arrive, like a line of people waiting.
What is the time complexity of searching in a balanced binary search tree?
Answer: O(log n)
A balanced BST halves the search space at each comparison, giving logarithmic time complexity.
What is a hash table collision?
Answer: When two different keys hash to the same index
Collisions occur when the hash function maps different keys to the same bucket, requiring resolution strategies like chaining or open addressing.
What is the difference between a stack and a queue?
Answer: Stack uses LIFO (last in, first out); queue uses FIFO (first in, first out)
Stacks process the most recently added element first, while queues process the oldest element first.
What is a linked list advantage over an array?
Answer: Efficient insertion and deletion without shifting elements
Linked lists can insert and delete elements in O(1) time once the position is found, without moving other elements.