💻 Coding Interview Questions
1️⃣ What is a binary search tree (BST)?
Answer: A tree where left child < parent < right child.
2️⃣ What is tree traversal?
Answer: Visiting all nodes in a tree (inorder, preorder, postorder).
3️⃣ What is a graph?
Answer: A set of nodes (vertices) connected by edges.
4️⃣ Directed vs Undirected graph?
Answer: Directed has edges with direction; undirected has edges without direction.
5️⃣ What is a cycle in a graph?
Answer: A path that starts and ends at the same vertex.
6️⃣ What is BFS (Breadth-First Search)?
Answer: Traverses graph level by level using a queue.
7️⃣ What is DFS (Depth-First Search)?
Answer: Traverses graph by exploring as far as possible along each branch (stack/recursion).
8️⃣ What is a weighted graph?
Answer: A graph where edges have weights (costs).
9️⃣ What is Dijkstra’s algorithm?
Answer: Finds the shortest path from a source to all nodes in a weighted graph.
🔟 What is a topological sort?
Answer: Linear ordering of vertices such that for every directed edge u→v, u comes before v.
Post #1259
834
- 🔥 3
- ❤ 2
- 👍 1