From 2010547a40b3b122d16b528cbfafab159d556dc5 Mon Sep 17 00:00:00 2001 From: Harshit Tomar Date: Tue, 23 Jul 2024 21:26:34 +0530 Subject: [PATCH] =?UTF-8?q?Competitive=20Programming=20Roadmap=F0=9F=98=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _posts/2024-06-07-cp-roadmap.md | 48 - _posts/2024-07-21-cp-roadmap.html | 9920 +++++++++++++++++++++++++++++ _posts/roadmaps/.DS_Store | Bin 6148 -> 0 bytes 3 files changed, 9920 insertions(+), 48 deletions(-) delete mode 100644 _posts/2024-06-07-cp-roadmap.md create mode 100644 _posts/2024-07-21-cp-roadmap.html delete mode 100644 _posts/roadmaps/.DS_Store diff --git a/_posts/2024-06-07-cp-roadmap.md b/_posts/2024-06-07-cp-roadmap.md deleted file mode 100644 index 6e0e761..0000000 --- a/_posts/2024-06-07-cp-roadmap.md +++ /dev/null @@ -1,48 +0,0 @@ ---- -layout: post -title: "Competitive Programming Roadmap" -date: 2024-06-7 02:00:00 +0530 -author: Pclub -website: https://github.com/life-iitk -category: Roadmap -tags: - - roadmap - - competitive - - cp -categories: - - roadmap -hidden: true -image: - url: /images/ml-roadmap/cp-roadmap.jpg ---- - -# Competitive Programming Roadmap - -## Introduction - -Competitive programming is a sport where participants solve complex coding problems within a certain time frame. This roadmap will guide you through the essential topics and skills required. - -## Beginner - -- Learn a programming language (C++, Python, Java) -- Basic Data Structures (Arrays, Strings, Linked Lists) -- Basic Algorithms (Sorting, Searching) - -## Intermediate - -- Advanced Data Structures (Stacks, Queues, Hash Maps) -- Graph Algorithms (DFS, BFS, Shortest Path) -- Dynamic Programming - -## Advanced - -- Segment Trees, Fenwick Trees -- Advanced Graph Algorithms (Network Flow, Bipartite Matching) -- Geometry and Number Theory - -## Resources - -- Online Judges (Codeforces, LeetCode, HackerRank) -- Books (Introduction to Algorithms by Cormen, The Art of Computer Programming by Knuth) - -# In Progress.... diff --git a/_posts/2024-07-21-cp-roadmap.html b/_posts/2024-07-21-cp-roadmap.html new file mode 100644 index 0000000..13ec14c --- /dev/null +++ b/_posts/2024-07-21-cp-roadmap.html @@ -0,0 +1,9920 @@ +--- +title: "Competitive Programming Roadmap" +date: 2024-07-21 +author: Pclub +website: https://github.com/life-iitk +category: Roadmap +tags: + - roadmap + - competitive + - cp +categories: + - roadmap +hidden: true +image: + url: /images/ml-roadmap/cp-roadmap.jpg +--- + + + + + + + + + + + + + {% if page.title %}{{ page.title }}{% else %}{{ site.title }}{% endif %} + + + + + + + + + + + + + + + + + + + + + + + {% include header.html %} + +
+
+
+ {% if page.image %} +
+
+ {{page.title}} +
+
+ {% endif %} + +
+
+ + + +

{{page.title}}

+ +
+ + + +
+ + {% if page.tags.size >= 1 %} + in + + {% endif %} +
+
+ +
+
+
+
+
+ +
+

Contents :

+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Section 0 : IntroductionSection 1 : Basic TheorySection 2 : IntermediateSection 3 : Advanced
IntroductionNumber TheoryAdvanced MathsString Hashing
Getting StartedTwo Pointers / Sliding WindowsRange Update QueriesDirected Graphs
basic prob solvingRange QueriesGraph Theory BasicsRange Update
Time ComplexityDivide and ConquerDSU + MSTSparse Table
Intro To STLIntro to Greedy AlgorithmsShortest pathTree Algorithm
SortingDynamic Programming
Binary SearchInteractive Problems
Bit Operations
Number Theory
Recursion
Complete Search
+

Section 0: Introduction + :

+
SECTION 0 part 2
SECTION 0 part 1
+

What is CP and Why do + it?

+ +

➡️Getting Started +

+

Learn C++ :

+ +

Setting Up Environment + :

+

We prefer VS CODE because of obvious reasons :eyes: , still + feel free to use any other usable Code Editor like : sublime text , codeblocks , etc.

+ +

➡️Basic Problem + Solving

+ + + +

Basic Math + Problems

+
+ +

+

Some suggestions from the + Makers :

+
+
    +
  • We believe that a lot of practice is what shapes you in CP ; apart from the questions found + here , it is suggested to practice more problems whenever you feel.
  • +
+
+
+
    +
  • It is sometimes okay to look up the solution / editorial (for codeforces). Don't fret if + you're not able to solve a problem, you'll get it with practice.
  • +
+
+
+
    +
  • The ":star: + Expected time" is the amount of time you will need to give to prepare the theory in a heading + before practicing.
  • +
+
+
+
    +
  • Take your time to understand things and implement them. The expected time is suggestive and + varies from person to person, but do not spend too much time on a single topic.
  • +
+
+
+
    +
  • Consistency is very important in CP. It is highly recommended that you keep practicing it at + your own pace daily, rather than doing it all at once. It is a skill that develops over + time.
  • +
+

+

➡️Time Complexity +

+
+

:star: + Expected time : 40 - 50 minutes

+
+ +

Solve these in O(n) :

+
+ +
+

➡️Intro to STL +

+
+

:star: + Expected time : 40 - 60 minutes

+
+ +

Basic Array / Vectors + Problems

+
+ +
+

Basic String + Problems

+ +

➡️Sorting

+
+

:star: + Expected time : 2 - 2.5 hours

+
+ + +

More on STL

+
+

:star: + Expected time : 40 - 60 minutes

+
+ +

Each Data Structure in STL has its own strengths and weaknesses. Try to think what to use according to + the problems.

+ +
+

:star: + Expected time : 40 - 60 minutes

+
+ +

➡️Bit Operations +

+
+

:star: + Expected time : 1 - 1.5 hours

+
+ + +

➡️Primary Number + Theory

+
+

:star: + Expected time : 1 - 1.5 hours

+
+ +

Binary + Exponentiation

+
+

:star: + Expected time : 20 - 30 minutes

+
+ +

Factorisation [till + O(rootN)]

+
+

:star: + Expected time : 20 - 30 minutes

+
+ +

Gcd

+
+

:star: + Expected time : 20 - 30 minutes

+
+ +

➡️Recursion

+
+

:star: + Expected time : 1.5 - 2 hours

+
+ + + +
+

:star: + Expected time : 1.5 - 2 hours

+
+ + +
+

By now, you may have realized that debugging your code efficiently is very important. For a few + tips on debugging, you can go through this article / this + video.

+
+

➡️Section 0 Additional + Practice:

+
+ +
+

Section 1: Basic + Theory

+
SECTION 1
+ +

➡️Number Theory +

+

Number Sieve

+
+

:star: + Expected time : 1 - 1.5 hours

+
+ + +

Modular Multiplicative + Inverse

+
+

:star: + Expected time : 20 - 30 minutes

+
+ +
+ +
+

Additional Practice + :

+
+ +
+
+ Hint +

In essence, you need to apply the permutation U = (1, 3, 5 … N - 1, 2 , 4 …. N) to your + initial array K times which is the same as composing f with You can use binary + exponentiation). :::

+
+
+
+

➡️Two Pointers / Sliding + Windows

+
+

:star: + Expected time : 30 - 40 minutes

+
+ +

➡️Range Queries +

+

Prefix Sums are Intensively Used in other problems to reduce Time Complexity of Solution.

+
+

:star: + Expected time : 40 - 50 minutes

+
+ + + +

Additional + Practice

+
+ +
+

➡️Divide and + Conquer

+
+

:star: + Expected time : 20 - 30 minutes

+
+

Read this to know what divide and conquer is. Watch this video to get more insight into this topic

+
+ +
+

➡️Intro to Greedy + Algorithms

+
+

:star: + Expected time : 1.5 - 2 hours

+
+

Moving in the direction which gives the most optimal solution at every step is a major characteristic of these algorithms. +

+ +

Here are some questions :

+
+ +
+
+ +
+

SELF + ASSESSMENT :

+
+ +
+

➡️Dynamic + Programming

+

Basic Concepts + :

+

Dynamic Programming , more famously known as DP is a technique in which we calculate and store subproblems in a particular problem. +

+

There are two methods to apply dp in your code : recursion and iteration .

+
+

:star: + Expected time : 1.5 - 2 hours

+
+ + +

DP on Grids + :

+

This tutorial + has some generic problems which will develop your understanding about grids . +

+
+ +
+

DP Bitmask + :

+
+

:star: + Expected time : 1.5 - 2 hours

+
+ +

DP is a topic which can be mastered only through practice.

+ +

SELF-ASSESSMENT ( + Topic : DP )

+
+ +
+ Extra +

There exist both dp and math based solutions , the math solution can be found if you know about + recursive relations and how to find their solutions using quadratic equations , this solution + has a time complexity of O(log(n)) and uses binary + exponentiation

+
+ +
+ Extra +

There are two dp solutions one having O(n) time complexity and the other being O(n^2) .. which + one were you able to spot

+
+
+ +

➡️Interactive + Problems

+
+

:star: + Expected time : 15 - 20 minutes

+
+

Here + is a tutorial on how to solve interactive problems .

+

Here are some questions + :

+
+ +
+
+

Some more tools to help you in your journey :

+
    +
  • Diffchecker - some problems have large output + files. Use this tool to compare your generated output and problem's expected output.
  • +
+

CodeForces Chrome Extensions :

+
    +
  • CF Analytics - improves the + Codeforces profile webpage to include statistics of problems solved by the user.
  • +
  • CodeForces Enhancer - multiple + ratings graph, adds "Hide/Show solved problems" link to Problemset page
  • +
  • Carrot - predicts actual + performance in the contest, how many rating points you will gain after the contest, etc. +
  • +
  • Conding Dude - Contest + Reminder
  • +
+
+

➡️Section 1 Additional + Practice:

+
+ +
+

Section 2: + Intermediate

+
SECTION 2
+

➡️Advanced Maths +

+

:maple_leaf: + Combinatorics

+
+

:star: + Expected time : 15 - 20 minutes

+
+ +

:maple_leaf: + Matrices

+
+

:star: + Expected time : 1 - 1.5 hours

+
+ +

:maple_leaf: + Probability

+
+

:star: + Expected time : 1 - 1.5 hours

+
+ +

:maple_leaf: + Extra Number Theory

+
+

:star: + Expected time : 1 - 1.5 hours

+
+ +

➡️Range Update + Queries

+
+

:star: + Expected time : 1.5 - 2 hours

+
+ + +

➡️Graph Theory + Basics

+
+

:star:Expected + time : 40 - 60 minutes

+
+ + + +

:maple_leaf: BFS + and DFS

+
+

:star: + Expected time : 30 - 40 minutes

+
+ +

:maple_leaf: + Cycles Detection

+
+

:star: + Expected time : 20 - 30 minutes

+
+ +

:maple_leaf: + Bridges in Graphs

+
+

:star: + Expected time : 30 - 40 minutes

+
+ +

:maple_leaf: + Flood Fill

+
+

:star: + Expected time : 15 - 20 minutes

+
+ +

:maple_leaf: + Topological Sort

+

Sorting nodes of a directed graph in an order in which they can appear in a path.

+

Note : we can only find topological sorting for an acyclic directed graph.

+
+

:star: + Expected time : 40 - 60 minutes

+
+ +
+

Number of topological sortings for a directed tree is discussed in Section 3 Tree Algorithms : + :maple_leaf: + DP on Trees

+
+

:maple_leaf: + Subtree/DFS Problems

+ +

➡️DSU + MST

+

Disjoint Set Union +

+
+

:star: + Expected time : 1.5 - 2 hours

+
+ +

Minimum Spanning + Trees

+
+

:star: + Expected time : 1 - 1.5 hours

+
+
    +
  1. PAPS Section + 12.4
  2. +
  3. How Do You + Calculate a Minimum Spanning Tree?
  4. +
  5. CPH + OR
  6. +
  7. Read these articles : Kruskal , Kruskal DSU , Prim's + Algo OR
  8. +
  9. Go through these videos : Kruskal using DSU , Prim's + Algo
  10. +
+ +

➡️Shortest Path + Algorithms - Dijkstra, Floyd Warshall, Bellman Ford

+
+

:star: + Expected time : 1 - 1.5 hours

+
+ +

➡️Section 2 Additional + Practice:

+
+ +
+

Optional :

+ +

Section 3: + Advanced

+
SECTION 3
+

➡️String Hashing +

+
+

:star: + Expected time : 2 - 2.5 hours

+
+ +

➡️Directed Graphs +

+
+

:star: + Expected time : 1.5 - 2 hours

+
+ +
+ +
+

:maple_leaf: + Cycles in Directed graphs

+

Functional Graphs +

+ +

:maple_leaf: + Strongly Connected Components :

+

A part of graph (component) is said to be strongly connected if there is a path from any node to all + other + nodes in the component. +

+

In Function Graphs : Every cycle alone is a SCC;

+

Generally : if two cycles share a vertex they both come under the same SCC.

+ +
+

If you make disjoint sets of vertices within a SCC and join edges connecting SCCs; you get a + Condensation Graph. This graph does not contain cycles as in + that case they would form another SCC. Thus it's a Directed Acyclic Graph.

+
+ +

:maple_leaf: + 2-SAT

+ +

:maple_leaf: DP + on DAGs

+

DAGs stands for Directed Acyclic Graphs, Trees are a particular kind of DAG.

+
    +
  1. Try this simple problem to start with :
  2. +
+ +
    +
  1. Then read CPH 16.2 and DP on Trees and Graphs | CSE 421
  2. +
  3. If you prefer to watch some videos : + +
  4. +
  5. Problems : +
    + +
    +
  6. +
  7. DP on Trees
  8. +
+

➡️Range Update Queries + (continued)

+
+

:star: + Expected time : 1.5 - 2 hours

+
+

This topic is continued from the previous section.

+ +

:maple_leaf: + Additional (optional) :

+ +

➡️ Sparse Table +

+
+

:star: + Expected time : 1 - 1.5 hours

+
+ +

➡️Tree Algorithm + Problems

+
+

:star: + Expected time : 2 - 2.5 hours

+
+ +

:maple_leaf: Tree + Diameter

+ +

:maple_leaf: DP + on Trees

+

(this section builds on from DP on DAGs)

+ +

:maple_leaf: Tree + Queries

+ +

➡️Section 3 Additional + Practice:

+
+ +
+

Additional Topics +

+

Convex Hull Trick, Square Root Decomposition, DP Optimizations (Knuth, Aliens, Divide and Conquer, + CHT), LiChao Tree, Mo’s Algorithm, Digit DP, Broken Profile DP, Connected Components DP, DP on Trees, + Sparse Segment Trees, Persistent Data Structures, Slope Trick, FFT, Suffix Array, Tries, Heavy Light + Decomposition, Centroid Decomposition

+

NOTE : For the topics we covered above there still exist a lot of variations which might be missed out + by us or were not possible in the scope of this Roadmap.

+

Continue your jouney in CP with self exploration !

+

➡️ Some More Resources -

+

Books -

+ +

Problem Sets and Resources -

+ +

Blogs -

+ +

YouTube Channels and Playlists -

+ +
+

This roadmap could never be possible without the inspiration and background support of the + Makers of the Previous Roadmap :

+ +

Contributors -
+ Tattwa Shiwani | tattwash23@iitk.ac.in
+ Khushi Ranawat | rkhushi23@iitk.ac.in
+ Arnav Gupta | arnavgupta23@iitk.ac.in
+ Yatharth Dangi | yatharth23@iitk.ac.in
+ Rohit Somani | rohitvs23@iitk.ac.in +

+
+ {% include footer.html %} + {% include javascripts.html %} + + + + + + + \ No newline at end of file diff --git a/_posts/roadmaps/.DS_Store b/_posts/roadmaps/.DS_Store deleted file mode 100644 index ad62721de3f54a895abe76d2d70829a130419093..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHK%}T>S5Z>*NO(;SR3OxqA7Oiam6z;MIs8RBB>^2GguGtvQrJ&iX<=iLawG zyBn!gZz57=VD_8L&Lr7y!%l`V#@%VS%b3L&Ge8k5CJf&Q&Z90#MSH4%T;9V!NyKfC zh+rv}9RHI6+`Bp(v518%W{dlWpTr^P_PZ4M`U{ako;~WFehnUzIGc1jZ@f~i)z=zE z!)O}U-o41Zi9eZUu0OuSt1}^zptSwqJdX0AwQ(fUi65uYSSG|_1R+-!aT