Vectors & STL Basics
Work with dynamic arrays that grow and shrink. Learn vectors, the most used container in C++, and start exploring the Standard Template Library.
Lessons
1. Intro
Why vectors matter
2. What is a Vector?
Understanding vector basics
3. Including the Vector Header
Getting started
4. Creating Vectors
Declaration syntax
5. Quiz: Vector Basics
Vector creation
6. Vector Initialization
Starting with values
7. Accessing Elements
Reading vector values
8. Quiz: Dynamic arrays
Dynamic arrays
9. Vector Size and Capacity
How vectors manage space
10. Adding Elements
Growing your vector
11. Removing Elements
Shrinking your vector
12. Quiz: Dynamic arrays
Dynamic arrays
13. Inserting and Erasing
Precise modifications
14. Clearing Vectors
Starting fresh
15. Iterating Over Vectors
Processing each element
16. Quiz: Dynamic arrays
Dynamic arrays
17. Range-Based For Loops
Cleaner iteration
18. Vectors and Functions
Function parameters
19. Passing by Reference
Avoiding copies
20. Quiz: Dynamic arrays
Dynamic arrays
21. 2D Vectors
Creating grids
22. Common Vector Operations
Handy shortcuts
23. Quiz: Dynamic arrays
Dynamic arrays
24. Sorting Vectors
Using the sort function
25. Problem: Finding Maximum
Practice with vectors
26. Problem: Removing Duplicates
Practice with vectors
27. Problem: Counting Occurrences
Practice with vectors
28. Quiz: Vector Problems
Test your understanding
29. Problem: Reversing a Vector
Practice with vectors
30. Problem: Sum of Elements
Practice with vectors
31. Problem: Building Dynamically
Practice with vectors
32. Vector vs Array
Comparing containers
33. Common Mistakes
Typical errors
34. Quiz: Dynamic arrays
Dynamic arrays
35. Performance Tips
Optimization basics
36. Problem - Xenia and Ringroad
Planning a route
37. Xenia - The Pattern
Circular arithmetic
38. Xenia - Algorithm
Breaking it down
39. Quiz: Dynamic arrays
Dynamic arrays
40. Xenia - Implementation
Complete solution
41. Lessons from Xenia
summary
42. Problem - Dragons
Choosing opponents
43. Dragons - The Pattern
Weakest first
44. Dragons - Algorithm
Breaking it down
45. Quiz: Dynamic arrays
Dynamic arrays
46. Dragons - Implementation
Complete solution
47. Lessons from Dragons
summary
48. Section Recap
What we learned