i am fine with implementation part but can’t really figure out what ds is to be used in the other problems involving algorithms
Surely you can find huge lists online for “Data Structures used in Competitive Programming” but just a few are used very often. The best way for you to learn new DS’s is to just give enough time to the problems and their editorials. Look at all the problems that are there in the contest. You can do that after the contest ends too.
You can start by learning segment trees and adjacency lists. You can also look at some in built data structures in STL ( just what they do and how efficiently they do that. No need for implementation details ). Generally you’ll be told to start with Stacks and Queues or Linked Lists but don’t go too deep into them if you just want to learn DS for competitive programming.
hey thanks but what do u suggest should i keep solving problems and learn or learn from standard resources gfg,clrs,etc
No worries brother!! It’s bcuz you are new (& even i am :)) and are not expose to the
type/variety of problems. I’ll suggest u somepoints which i guess helped me personally
- Upsolve the contest problems and don’t hesitate for the ones which u find difficult.
- Start reading some basic algo/ds. Make a schedule that u have complete this much
portion along with bit of implementation in fixed time.
- Even if u can’t implement thier codes just keep the general idea of the working of
particular algo/ds. (This helps alot in identifying problem type).
I was also able to solve at most 2 problems(still a noob) in any contest but when i
started reading/practicing more i can feel the change
That’s upto your personal preference. I personally don’t like to learn stuff I don’t need for some specific problem.
You can’t just read the whole CLRS and then be able to solve every problem in any contest, even if all the relevant concepts are there in the book.
In my case, when I try to develop an algorithm to solve a problem, often times it boils down to doing some operation efficiently. For example: adding up all elements in a range in an array, with updates to the array. You can just google “adding up all elements in a range” and you’ll get the relevant DS. In this case, a segment tree.
You’ll get an idea for what type of solution and data structures are there in the problem and what things to Google once you do enough problems.
can u tell the resources u used for reading ds algo please
Hi, this is also my problem…I have faced it and that’s because you are now a beginner and you need to be exposed to a variety of problems. Even i have been unable to solve more than 2 problems in shorter formats. Now as all the other guys said, Ds/Algo is not some textbook exercise that you read it up whole and then solve exercise questions. So, I suggest simply to solve previous contest problems…Long Challenge, Cook-Offs etc. Practise and you will start realising solutions.