Heap / Priority Queue

Problems using heap data structure

32 lessons
82 min

Lessons

1. What is Heap / Priority Queue

Pattern overview

2m

2. Prerequisites

What you need first

1m

3. When to Use

Pattern triggers

2m

4. When NOT to Use

Avoid forcing this pattern

2m

5. LeetCode 703 Kth Largest Element in a Stream - Problem Statement

The problem

2m1 problems

6. LeetCode 703 Kth Largest Element in a Stream - Solution

The core idea

3m

7. LeetCode 703 Kth Largest Element in a Stream - Example and Complexity Analysis

Walkthrough and analysis

3m

8. LeetCode 703 Kth Largest Element in a Stream - Implementation

The approach

4m1 problems

9. LeetCode 215 Kth Largest Element in an Array - Problem Statement

The problem

2m1 problems

10. Quiz: Heap for Kth Largest

Test your understanding

2m1 problems

11. LeetCode 215 Kth Largest Element in an Array - Why Naive Fails

The trap

2m

12. LeetCode 215 Kth Largest Element in an Array - Solution

The core idea

3m

13. LeetCode 215 Kth Largest Element in an Array - Example and Complexity Analysis

Walkthrough and analysis

3m

14. LeetCode 215 Kth Largest Element in an Array - Implementation

The approach

4m1 problems

15. LeetCode 973 K Closest Points to Origin - Problem Statement

The problem

2m1 problems

16. LeetCode 973 K Closest Points to Origin - Why Naive Fails

The trap

2m

17. LeetCode 973 K Closest Points to Origin - Solution

The core idea

3m

18. LeetCode 973 K Closest Points to Origin - Example and Complexity Analysis

Walkthrough and analysis

3m

19. LeetCode 973 K Closest Points to Origin - Implementation

The approach

4m1 problems

20. LeetCode 621 Task Scheduler - Problem Statement

The problem

2m1 problems

21. LeetCode 621 Task Scheduler - Why Naive Fails

The trap

2m

22. LeetCode 621 Task Scheduler - Solution

The core idea

3m

23. LeetCode 621 Task Scheduler - Example and Complexity Analysis

Walkthrough and analysis

3m

24. LeetCode 621 Task Scheduler - Implementation

The approach

4m1 problems

25. LeetCode 295 Find Median from Data Stream - Problem Statement

The problem

2m1 problems

26. Quiz: Streaming Median

Test your understanding

2m1 problems

27. LeetCode 295 Find Median from Data Stream - Why Naive Fails

The trap

2m

28. LeetCode 295 Find Median from Data Stream - Solution

The core idea

3m

29. LeetCode 295 Find Median from Data Stream - Example and Complexity Analysis

Walkthrough and analysis

3m

30. LeetCode 295 Find Median from Data Stream - Implementation

The approach

4m1 problems

31. Common Mistakes

Common errors to avoid

2m

32. Section Recap

Summary

1m

Practice Problems

2.

Ready to start learning?

Access all 32 lessons with interactive content and progress tracking.