c++ week 1
🗓️ C++ Learning Routine (4 Weeks)
✅ Week 1: Core C++ Syntax + Basics
📘 Focus: Get comfortable with the language.
🧠 Topics (1 per day):
-
Input/output (
cin,cout), variables, data types. -
Conditionals (
if,else,switch). -
Loops (
for,while,do-while). -
Functions, function arguments, return values.
-
Arrays & Strings (basic operations).
-
Pointers & references (just basics for now).
-
Practice day (write mini programs).
✍️ Mini-Exercises:
-
Check if a number is even/odd.
-
Sum of first
nnatural numbers. -
Count digits of a number.
-
Reverse an array.
-
Check if a string is a palindrome.
✅ Week 2: Intermediate Concepts + STL Intro
📘 Focus: Learn efficient tools you'll use daily on Codeforces.
🧠 Topics:
-
Functions with arrays.
-
String operations (
length,substr,sort, etc.). -
Vectors (
push_back,sort,size, etc.). -
Pairs & tuples.
-
Maps (
map,unordered_map), frequency counting. -
Sets (
set,unordered_set) for uniqueness. -
Practice day (solve problems using
vector,map, etc.)
✍️ Mini-Exercises:
-
Frequency of characters in a string.
-
Find max/min in a vector.
-
Check for duplicates using a set.
-
Sort strings by length.
-
Count unique elements in an array.
✅ Week 3: Problem Solving Patterns
📘 Focus: Learn common techniques used in CP.
🧠 Topics:
-
Brute force & nested loops.
-
Prefix sum & counting.
-
Binary Search (
lower_bound,upper_bound). -
Two pointers technique.
-
Bit manipulation basics (
&, |, ^, <<, >>). -
STL algorithms (
sort,count,accumulate,reverse). -
Practice day (combine topics).
✍️ Practice:
-
Count subarrays with a sum less than X.
-
Find first occurrence of X using binary search.
-
Check if a string has all unique characters.
-
Toggle bits of a number.
✅ Week 4: Templates for CP + Efficiency
📘 Focus: Write fast code & understand constraints.
🧠 Topics:
-
Fast I/O in C++ (
ios::sync_with_stdio(false); cin.tie(0);). -
Writing clean functions, macros, typedefs.
-
Time and space complexity analysis.
-
Competitive programming template.
-
Debugging tips (
cerr,assert, dry runs). -
Reading editorials and using hints.
-
Simulated contest day.
🧪 Daily Routine (2 Hours Suggested)
| Time | Activity |
|---|---|
| 15 min | Review yesterday’s topic. |
| 45 min | Learn today’s topic + write small code samples. |
| 60 min | Solve 2–3 Codeforces problems using the topic learned. |
Comments
Post a Comment