Data Structures and Algorithms Flashcards
6 cards from real Online Coding Lessons 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 and Algorithms flashcards as text
What is a hash table?
Answer: A data structure that maps keys to values using a hash function
A hash table is a data structure that uses a hash function to map keys to their associated values, allowing for fast lookup operations.
What is the worst-case time complexity of Bubble Sort?
Answer: O(n²)
Bubble Sort has a worst-case time complexity of O(n²) because it may need to compare every element with every other element.
In a binary search tree (BST), where is a new node with a smaller value inserted?
Answer: To the left of the parent node
In a BST, a node with a value smaller than the parent is always inserted to the left of the parent node.
What is the purpose of a graph data structure?
Answer: Representing relationships between objects using nodes and edges
A graph is a data structure that represents relationships between objects using nodes (vertices) connected by edges, modeling networks and connections.
What is 'divide and conquer' as a programming strategy?
Answer: Breaking a problem into smaller subproblems, solving them, and combining results
Divide and conquer is an algorithm design strategy that breaks a problem into smaller subproblems, solves each one recursively, and combines the results.
What is a 'deque' (double-ended queue)?
Answer: A data structure where elements can be added or removed from both ends
A deque (double-ended queue) is a data structure that allows insertion and deletion of elements from both the front and the back.