interview-questions

Data Structures and Algorithms

1. Can you name a few data structures? What are they used form?

List, LinkedList, Map, Set, Bag, Tree, Graph

2. What is the difference between Set, Map and List?

Set

Map

List

Overall, while Sets ensure uniqueness and Maps associate keys with values, Lists maintain a sequence of elements, potentially including duplicates.

3. When should we use a DFS and BFS?

In summary, choose DFS for exploring all paths or when memory is a concern, and BFS for shortest path problems or when exploring nodes level by level.