Skip to content
krishanthan4 edited this page Dec 16, 2025 · 1 revision

Wiki Index

Complete guide to all algorithms and data structures in this repository.

📚 Table of Contents

Data Structures

Basic Data Structures

Tree-Based Structures

Advanced Structures

  • Graph - Vertex and edge relationships
  • HashMap - Hash table with collision handling
  • LRU Cache - Least Recently Used cache

Algorithms

Searching Algorithms

Sorting Algorithms

Tree Traversals

Graph Algorithms

Dynamic Programming

🎯 Learning Paths

Path 1: Complete Beginner

  1. Start with ArrayList and LinkedList
  2. Then Stack and Queue
  3. Move to Linear Search and Binary Search
  4. Practice simple sorting: Bubble Sort, Insertion Sort

Path 2: Intermediate Developer

  1. Binary Search Tree and Heaps
  2. DFS and BFS
  3. Merge Sort and Quick Sort
  4. Graph implementation

Path 3: Advanced Learner

  1. Trie and advanced trees
  2. LRU Cache and HashMap
  3. Dijkstra's Algorithm
  4. Dynamic Programming problems

📊 Complexity Quick Reference

Data Structures

Structure Access Search Insert Delete Space
ArrayList O(1) O(n) O(n) O(n) O(n)
LinkedList O(n) O(n) O(1) O(1) O(n)
Stack O(1) O(n) O(1) O(1) O(n)
Queue O(1) O(n) O(1) O(1) O(n)
BST (avg) O(log n) O(log n) O(log n) O(log n) O(n)
Heap O(n) O(n) O(log n) O(log n) O(n)
Hash Table O(1) O(1) O(1) O(1) O(n)

Algorithms

Searching

Algorithm Best Average Worst Space
Linear O(1) O(n) O(n) O(1)
Binary O(1) O(log n) O(log n) O(1)
DFS O(V+E) O(V+E) O(V+E) O(V)
BFS O(V+E) O(V+E) O(V+E) O(V)

Sorting

Algorithm Best Average Worst Space Stable
Bubble O(n) O(n²) O(n²) O(1) Yes
Selection O(n²) O(n²) O(n²) O(1) No
Insertion O(n) O(n²) O(n²) O(1) Yes
Merge O(n log n) O(n log n) O(n log n) O(n) Yes
Quick O(n log n) O(n log n) O(n²) O(log n) No

🔑 Key Concepts

When to Use What

ArrayList vs LinkedList:

  • Use ArrayList for random access
  • Use LinkedList for frequent insertions/deletions at beginning

Stack vs Queue:

  • Use Stack for LIFO (undo, backtracking)
  • Use Queue for FIFO (scheduling, BFS)

Binary Search:

  • Only works on sorted arrays
  • Much faster than linear search for large datasets

Sorting Algorithms:

  • Bubble/Selection/Insertion: Simple, good for small or nearly sorted data
  • Merge Sort: Guaranteed O(n log n), stable, uses extra space
  • Quick Sort: Usually fastest in practice, in-place but not stable

Graph Traversal:

  • DFS: Path finding, cycle detection, topological sort
  • BFS: Shortest path (unweighted), level-order traversal

💡 Study Tips

  1. Understand before implementing - Read the guide thoroughly
  2. Draw it out - Visualize on paper
  3. Think about edge cases - Empty, single element, duplicates
  4. Analyze complexity - Time and space
  5. Test incrementally - One method at a time

🎓 Interview Preparation

Most Common Topics

Data Structures (Must Know):

  1. Arrays and Strings
  2. Linked Lists
  3. Stacks and Queues
  4. Hash Tables
  5. Trees (especially BST)
  6. Heaps
  7. Graphs

Algorithms (Must Know):

  1. Binary Search
  2. DFS and BFS
  3. Sorting algorithms
  4. Basic Dynamic Programming
  5. Two Pointers
  6. Sliding Window

Practice Strategy

  1. Master one topic at a time
  2. Do 5-10 problems per topic
  3. Review and redo difficult problems
  4. Time yourself after comfortable with concepts
  5. Practice explaining solutions out loud

📖 Additional Reading

Each wiki guide includes:

  • Problem description
  • Complexity analysis
  • How it works
  • Implementation hints
  • Common pitfalls
  • Practice problems
  • Related topics

Remember: Don't look at solutions immediately! Struggle is part of learning.


Happy Learning! 🚀

Clone this wiki locally