# Data Structures and Algorithms (JavaScript)

## Data Structures

- Arrays
- Strings
- Hash Tables/Maps
- Stacks
- Queues
- Singly Linked Lists
- Doubly Linked Lists
- Trees
  - Binary Trees
  - Binary Search Trees
  - AVL/Balanced Trees
- Graphs
  - Directed
  - Undirected
- Trie (Prefix-Tree)
- Heaps

## Sorting Algorithms

- Bubble sort
- Selection sort
- Insertion sort
- Merge sort
- Quick sort
- Raidx sort

## Big O Notation

- know the run time for the most important data structures and algorithms

## Other Important Topics

- Recursion
- Dynamic Programming

---

## Resources:

1. https://www.educative.io/courses/data-structures-coding-interviews-javascript
2. https://www.educative.io/courses/grokking-the-coding-interview
3. https://www.educative.io/courses/grokking-dynamic-programming-patterns-for-coding-interviews

## 2. Introduction to Arrays

- Arrays
- var vs. let vs. const
- Challenge 1: Remove Even Integers From an Array
- Solution Review: Remove Even Integers From an Array
- Challenge 2: Merge Two Sorted Arrays
- Solution Review: Merge Two Sorted Arrays
- Challenge 3: Find Two Numbers that Add up to "value"
- Solution Review: Find Two Numbers that Add up to "value"
- Challenge 4: Array of Products of All Elements
- Solution Review: Array of Products of All Elements
- Challenge 5: Find Minimum Value in Array
- Solution Review: Find Minimum Value in Array
- Challenge 6: Find First Unique Integer in an Array
- Solution Review: First First Unique Integer in an Array
- Challenge 7: Find Second Maximum Value in an Array
- Solution Review: Find Second Maximum Value in an Array
- Challenge 8: Right Rotate an Array by n
- Solution Review: Right Rotate an Array by n
- Challenge 9: Rearrange Positive & Negative Values
- Solution Review: Rearrange Positive & Negative Values
- Challenge 10: Rearrange Sorted Array in Max/Min Form
- Solution Review: Rearrange Sorted Array in Max/Min Form
- Challenge 11: Maximum Sum Subarray
- Solution Review: Maximum Sum Subarray
- Arrays Quiz: Test Your Understanding of Arrays

## 3. Introduction to Linked Lists- Singly Linked Lists (SLL)

- Basic Linked List Operations
- Singly Linked List Insertion
- Challenge 1: Insertion at Tail
- Solution Review: Insertion at Tail
- Challenge 2: Search in a Singly Linked List
- Solution Review: Search in a Singly Linked List
- Singly Linked List Deletion
- Challenge 3: Deletion by Value
- Solution Review: Deletion by Value
- Deletion at the Tail
- Linked Lists vs. Arrays
- Challenge 4: Find the Length of a Linked List
- Solution Review: Find the Length of a Linked List
- Challenge 5: Reverse a Linked List
- Solution Review: Reverse a Linked List
- Challenge 6: Detect Loop in a Linked List
- Solution Review: Detect a Loop in a Linked List
- Challenge 7: Find Middle Node of Linked List
- Solution Review: Find Middle Node of a Linked List
- Challenge 8: Remove Duplicates from Linked List
- Solution Review: Remove Duplicates from a Linked List
- Challenge 9: Union & Intersection of Linked Lists
- Solution Review: Union and Intersection of Linked Lists
- Challenge 10: Return the Nth Node from the End
- Solution Review: Return the Nth Node from the End
- Doubly Linked Lists (DLL)
- Singly Linked Lists vs. Doubly Linked Lists
- Linked Lists Quiz: Test Your Understanding of Linked Lists

## 4. Introduction to Stack/Queues- What is a Stack?

- Stack (Implementation)
- What is a Queue?
- Queue (Implementation)
- Challenge 1:​ Generate Binary Numbers From 1 to n Using Queue
- Solution Review: Generate Binary Numbers From 1 to n Using Queue
- Challenge 2: Implement Two Stacks using One Array
- Solution Review: Implementing Two Stacks Using One Array
- Challenge 3: Reversing First k Elements of Queue
- Solution Review: Reversing First k Elements of Queue
- Challenge 4: Implement a Queue Using Stacks
- Solution Review: Implement a Queue Using Stacks
- Challenge 5: Sort Values in a Stack
- Solution Review: Sort Values in Stack
- Challenge 6: Evaluate Postfix Expression Using a Stack
- Solution Review: Evaluate Postfix Expression Using a Stack
- Challenge 7: Next Greater Element Using a Stack
- Solution Review: Next Greater Element Using a Stack
- Challenge 8: Check Balanced Parentheses Using Stack
- Solution Review: Check Balanced Parentheses Using Stack
- Challenge 9: min() Function Using a Stack
- Solution Review: min() Function Using a Stack
- Stack/Queue Quiz: Test Your Understanding of Stack/Queue

## 5. Introduction to Graphs- What is a Graph?

- Types of Graphs
- Representation of Graphs
- Graph Implementation
- Complexities of Graph Operations
- What is a Bipartite Graph?
- Graph Traversal Algorithms
- Challenge 1: Implement Breadth First Search
- Solution Review: Implement Breadth First Search
- Challenge 2: Implement Depth First Search
- Solution Review: Implement Depth First Search
- Challenge 3: Detect Cycle in Graph
- Solution Review: Detect Cycle in Graph
- Challenge 4: Find a "Mother Vertex" in a Graph
- Solution Review: Find a "Mother Vertex" in a Graph
- Challenge 5: Count the Number of Edges in an Undirected Graph
- Solution Review: Count the Number of Edges in an Undirected Graph
- Challenge 6: Check if a Path Exists Between Two Vertices
- Solution Review: Check if a Path Exists Between Two Vertices
- Challenge 7: Check if an Undirected Graph is Tree or not
- Solution Review: Check if an Undirected Graph is Tree or not
- Challenge 8: Find the Shortest Path Between Two Vertices
- Solution Review: Find the Shortest Path Between Two Vertices
- Challenge 9: Remove Edge
- Solution Review: Remove Edge
- Graph Quiz: Test Your Understanding of Graphs

## 7. Trie- What is a Trie?

- Structure of a Trie
- Insertion in a Trie
- Search in a Trie
- Deletion in a Trie
- Challenge 1: Total Number of Words in a Trie
- Solution Review: Total Number of Words in a Trie
- Challenge 2: Find All Words Stored in Trie
- Solution Review: Find All Words Stored in Trie
- Challenge 3: Array Sort Using Tries
- Solution Review: Array Sort Using Tries
- Challenge 4: Word Formation from a Dictionary Using Trie
- Solution Review: Word Formation from a Dictionary Using a Trie
- Trie Quiz: Test Your Understanding of Tries

## 8. Introduction to Heap- What is a Heap?

- Max Heap: Introduction
- Max Heap (Implementation)
- Min Heap: Introduction
- Min Heap (Implementation)
- Challenge 1: Convert Max-Heap to Min-Heap
- Solution Review: Convert Max-Heap to Min-Heap
- Challenge 2: Find k Smallest Elements in an Array
- Solution Review: Find k Smallest Elements in an Array
- Challenge 3: Find k Largest Elements in an Array
- Solution Review: Find k Largest Elements in an Array
- Heap Quiz: Test Your Understanding of Heaps

## 9. Introduction to Hashing- What is a Hash Table?

- The Hash Function
- Collisions in Hash Tables
- Building a Hash Table from Scratch
- Add/Remove & Search in Hash Table (Implementation)
- A Quick Overview of Hash Tables
- Trees vs Hash Tables
- Challenge 1: An Array as a Subset of Another Array
- Solution Review: An Array as a Subset of Another Array
- Challenge 2 : Check if Arrays are Disjointed
- Solution Review: Check if Arrays are Disjointed
- Challenge 3: Find Symmetric Pairs in an Array
- Solution Review: Find Symmetric Pairs in an Array
- Challenge 4: Trace the Complete Path of a Journey
- Solution Review: Trace the Complete Path of a Journey
- Challenge 5: Find Two Pairs in an Array Such That a+b = c+d
- Solution Review: Find Two Pairs Such That a+b = c+d
- Challenge 6: A Subarray with a Sum of 0
- Solution Review: A Subarray with a Sum of 0
- Challenge 7: Find Two Numbers that Add up to "value"
- Solution Review: Find Two Numbers that Add up to "value"
- Challenge 8: Find First Unique Integer in an Array
- Solution Review: Find First Unique Integer in an Array
- Challenge 9: Remove Duplicates from a Linked List
- Solution Review: Remove Duplicates from a Linked List
- Challenge 10: Union of Linked Lists
- Solution Review: Union & Intersection of Linked Lists
- Hashing Quiz: Test Your Understanding of Hashing

## 10. Summary of Data Structures

- Overview of Linear & Non-Linear Data Structures
- Conclusion
