c++ week 1

 

🗓️ C++ Learning Routine (4 Weeks)

Week 1: Core C++ Syntax + Basics

📘 Focus: Get comfortable with the language.

🧠 Topics (1 per day):

  1. Input/output (cin, cout), variables, data types.

  2. Conditionals (if, else, switch).

  3. Loops (for, while, do-while).

  4. Functions, function arguments, return values.

  5. Arrays & Strings (basic operations).

  6. Pointers & references (just basics for now).

  7. Practice day (write mini programs).

✍️ Mini-Exercises:

  • Check if a number is even/odd.

  • Sum of first n natural 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:

  1. Functions with arrays.

  2. String operations (length, substr, sort, etc.).

  3. Vectors (push_back, sort, size, etc.).

  4. Pairs & tuples.

  5. Maps (map, unordered_map), frequency counting.

  6. Sets (set, unordered_set) for uniqueness.

  7. 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:

  1. Brute force & nested loops.

  2. Prefix sum & counting.

  3. Binary Search (lower_bound, upper_bound).

  4. Two pointers technique.

  5. Bit manipulation basics (&, |, ^, <<, >>).

  6. STL algorithms (sort, count, accumulate, reverse).

  7. 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:

  1. Fast I/O in C++ (ios::sync_with_stdio(false); cin.tie(0);).

  2. Writing clean functions, macros, typedefs.

  3. Time and space complexity analysis.

  4. Competitive programming template.

  5. Debugging tips (cerr, assert, dry runs).

  6. Reading editorials and using hints.

  7. Simulated contest day.


🧪 Daily Routine (2 Hours Suggested)

TimeActivity
15 minReview yesterday’s topic.
45 minLearn today’s topic + write small code samples.
60 minSolve 2–3 Codeforces problems using the topic learned.

Comments

Popular posts from this blog

Phy 129 - WM, CT-03

Online 3 CSE 102; Array Resources.