Data Structures and Algorithms Flashcards
7 cards from real IKM practice questions. Tap to flip, then mark Knew It or Still Learning — missed cards come back until you master them.
Read the first 7 Data Structures and Algorithms flashcards as text
Under which condition can Dijkstra's algorithm return incorrect shortest paths?
Answer: The graph has negative edge weights
Dijkstra assumes a finalized vertex can never be reached more cheaply later, and negative edges break that assumption.
What does breadth-first search guarantee when run from a source vertex in an unweighted graph?
Answer: It finds shortest paths measured in number of edges
BFS explores vertices layer by layer, so each vertex is first reached by a path with the fewest edges.
A topological sort can be produced only for which type of graph?
Answer: Directed acyclic graph
A linear order that respects every directed edge exists only if the graph has no directed cycles.
With a good hash function and a bounded load factor, what is the average-case lookup time of a hash table?
Answer: O(1)
Keys spread evenly across buckets, so a lookup checks a constant expected number of entries.
Which problem is characteristic of linear probing in open-addressing hash tables?
Answer: Primary clustering
Linear probing builds long runs of occupied slots that keep growing, which is called primary clustering.
What is the time complexity of the Bellman-Ford algorithm on a graph with V vertices and E edges?
Answer: O(VE)
Bellman-Ford relaxes every edge V-1 times, giving O(VE).
Which data structure does Kruskal's algorithm use to check efficiently whether adding an edge would create a cycle?
Answer: A disjoint-set (union-find)
Union-find checks whether two endpoints are already in the same component in nearly constant amortized time.
Written and edited by Nathan Beja, founder of Practice Test Geeks, with AI assistance. Exam facts are checked against the official sources linked below. Editorial policy
Sources & references
Exam facts on this page (fees, format, dates, passing scores) are checked against these official sources; the date is our last check. Editorial policy
- ikmnet.com — Test delivery, passing score · verified Oct 2026
- online.ikmnet.com — Eligibility, exam format, retake policy, score release, time limit · verified Oct 2026