TGViewer
Coding Projects Coding Projects @programming_experts · 68K subscribers
Post #2411 6.97K
✅ Top DSA Interview Questions with Answers: Part-2 🧠

11. What is the difference between BFS and DFS?
- BFS (Breadth-First Search): Explores neighbors first (level by level). Uses a queue. ➡️
- DFS (Depth-First Search): Explores depth (child nodes) first. Uses a stack or recursion. ⬇️
Used in graph/tree traversals, pathfinding, cycle detection. 🌳🔎

12. What is a Heap?
A binary tree with heap properties:
- Max-Heap: Parent ≥ children 🔼
- Min-Heap: Parent ≤ children 🔽
Used in priority queues, heap sort, scheduling algorithms. ⏰

13. What is a Trie?
A tree-like data structure used to store strings. 🌲
Each node represents a character.
Used in: autocomplete, spell-checkers, prefix search. 🔡

14. What is a Graph?
A graph is a collection of nodes (vertices) and edges. 🔗
- Can be directed/undirected, weighted/unweighted.
Used in: networks, maps, recommendation systems. 🗺️

15. Difference between Directed and Undirected Graph?
- Directed: Edges have direction (A → B ≠ B → A) ➡️
- Undirected: Edges are bidirectional (A — B) ↔️
Used differently based on relationships (e.g., social networks vs. web links).

16. What is the time complexity of common operations in arrays and linked lists?
- Array: 🔢
- Access: O(1)
- Insert/Delete: O(n)
- Linked List: 🔗
- Access: O(n)
- Insert/Delete: O(1) at head

17. What is recursion?
When a function calls itself to solve a smaller subproblem. 🔄
Requires a base case to stop infinite calls.
Used in: tree traversals, backtracking, divide & conquer. 🌳🧩

18. What are base case and recursive case?
- Base Case: Condition that ends recursion 🛑
- Recursive Case: Part where the function calls itself ➡️
Example:
def fact(n):
if n == 0: return 1 # base case
return n * fact(n-1) # recursive case


19. What is dynamic programming?
An optimization technique that solves problems by breaking them into overlapping subproblems and storing their results (memoization). 💾
Used in: Fibonacci, knapsack, LCS. 📈

20. Difference between Memoization and Tabulation?
- Memoization (Top-down): Uses recursion + caching 🧠
- Tabulation (Bottom-up): Uses iteration + table 📊
Both store solutions to avoid redundant calculations.

💬 Double Tap ♥️ For Part-3
  • ❤ 14
  • 👏 1
More from @programming_experts
  1. Oct 9, 2026🇮🇳 𝗚𝗢𝗩𝗘𝗥𝗡𝗠𝗘𝗡𝗧 𝗢𝗙 𝗜𝗡𝗗𝗜𝗔 — 𝗔𝗜𝗖𝗧𝗘 𝗜𝗡𝗧𝗘𝗥𝗡𝗦𝗛𝗜𝗣𝗦 𝟮𝟬𝟮𝟲 🚀…
  2. Oct 8, 2026🎓 𝗠𝗶𝗰𝗿𝗼𝘀𝗼𝗳𝘁 𝗙𝗥𝗘𝗘 𝗖𝗼𝘂𝗿𝘀𝗲𝘀 𝘄𝗶𝘁𝗵 𝗖𝗲𝗿𝘁𝗶𝗳𝗶𝗰𝗮𝘁𝗲𝘀! 🚀🔥 Upgr…
  3. Oct 7, 2026🧩Now, Let's Understand Functions in Programming 👨‍💻🔥 After variables, operators, condi…
  4. Oct 7, 2026🚀𝗣𝗮𝘆 𝗔𝗳𝘁𝗲𝗿 𝗣𝗹𝗮𝗰𝗲𝗺𝗲𝗻𝘁 𝗧𝗿𝗮𝗶𝗻𝗶𝗻𝗴 | 𝗕𝗲𝗰𝗼𝗺𝗲 𝗮 𝗙𝘂𝗹𝗹𝘀𝘁𝗮𝗰…
  5. Oct 7, 2026𝗠𝗮𝘀𝘁𝗲𝗿 𝗣𝗼𝘄𝗲𝗿 𝗕𝗜 𝗳𝗼𝗿 𝗙𝗥𝗘𝗘! 🔥 Learn Power BI through these FREE learnin…
  6. Sep 29, 2026Post #2901
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook →Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 →