Friday, October 2, 2020

Which language is best for competitive programming?

  • C++:

 C++ is the most preferred language for competitive programming mainly because of its STL. Short for Standard Template Library, the STL is a collection of C++ templates to help programmers quickly tackle basic data structures and functions such as lists, stacks, arrays, etc. It is a library of container classes, algorithms, and iterators.

STL is what ensure speed while coding in C++. Providing the basic data structures and functions as templates, STL cuts down a lot of your coding time. The power of C++ is undebatable because not only is it built on top of C (the mother of all programming languages) but also because it provides support for OOPS along with other features helpful during coding contests. Other than that, the verbosity of C++ codes is comparatively lesser than Java which makes it easier to code in.

 




  • Java:

Java is another classic programming language that’s extensively used for competitive programming. The fans of Java swear by the BigInteger class which is used for performing mathematical computations on large integers quickly. It comes in extremely handy during The exception handling is again something that Java is universally applauded for. It’s challenging to find segmentation faults in C++, but it’s easy to notice the ArrayIndexOutOfBound exception.

Although Java lacks STL, it has containers which perform pretty much the same function. Although the containers in Java are not as extensive as STL in C++, there are a few situations where STL doesn’t have a direct solution. For example, in case of priority_queue in STL, it doesn’t support decrease-key operation which is required for implementations of essential algorithms like Prim’s and Dijkstra’s. Java also has extensive support for geometrical problems. Its jawa.awt.geom package includes stuff like line-line/segment-segment intersection and polygon segment intersection. It comes in extremely helpful during some of the complicated problems of competitive programming that require you to deal with geometrical shapes and figures.



 

  • Python:

Over the years, Python has seen tremendous growth in the number of the people who use it. This can mainly be attributed to the fact that it takes very little time to come to grips with the (barely existent) syntax of Python – which is not the case with the other two languages we mentioned. One more reason that programmers are switching to Python is the REPL support. REPL, or Read-Eval-Print-Loop, lets you test your ideas under time constraints. Something that can come in quite handy during programming contests. Just like Java, Python too has a BigInteger class helpful for working with large integers.

However, if we talk about compilation speed, Python stands third in the list. Many times you might get a TLE (time limit exceeded) error for an algorithm in Python, but the same might get cleared if you code it in C++.   
To conclude, let’s reiterate that there’s no absolute best programming language. Each has a set of pros and cons and to be expert at competitive programming; you’ll need to have an extremely logical approach irrespective of the language you choose.

Thursday, September 24, 2020

Competitve Programming Roadmap

 Firstly you should start with DSA(Data Structures And Algorithm) Basics,and then do these points according to sequence:-



  1. Solve problems on hackerrank ,hackerEarth.
  2. Learn about Time Complexity.
  3. Start solving problems on codechef and codeforces.
  4. If u got stuck at any problem,after trying soo mant times,just go and have a look on tutorial for that problem.
  5. Even if u solve the problem correctly then also check for tutorial or some other persons answer ,it will help you to understand other type of approaches to solve.
  6. Dont break the practice in between.
  7. Try to solve atleast 5-10 easy problems in a day or 2-5 medium level problems.
  8. Participate in Codechef long challenges in the beginning.

Monday, September 21, 2020

How to begin with Competitive Programming?

 At the very beginning to competitive programming, barely anyone knows the coding style to be followed.






How to Begin Practice?

Start with small steps ,First start solving basics problems like Linear Search,Sorting Problems,Learn basic Data Structures,Once your are done with all of this ,then directly jump in to ocean of Competitive problems,You can start solving problems on some of my favourite coding platforms.

  1. GeeksForGeeks
  2. CodeZen
  3. LeetCode

It is recommended solve problems on Practice for cracking any coding interview.

Now you know how to write your first program in Competitive Programming Environment, you can start with School Practice Problems for Competitive Programming or Basic Practice Problems for Competitive Programming.

How to Compete?

Once your are done with your above given things ,you are good to go for competing on the online platforms like CodeChef,Codeforces,SPOJ,TopCoder etc.

Contests Happening all over the Year?

  1. ACM-ICPC.
  2. FaceBook Hacker-Cup.
  3. Codevita(By TCS).
  4. CodeChef Challenges
  5. CodeForces(Div Rounds).
And Many More.


Best Books to Practice Data Structures and Algorithm.

  1. Data Structures and Algorithms Made Easy by Narasimha Karumanchi
  2. Data Structures and Algorithms in Java, 2nd Edition by Robert Lafore.
  3. Introduction to Algorithms, 3rd Edition by Thomas H. Cormen , Charles E. Leiserson, Ronald L. Rivest, Clifford Stein.
  4. Algorithms, 4th Edition by Robert Sedgewick, Kevin Wayne
  5. Elements of Programming Interviews in Java: The Insiders’ Guide, by Adnan Aziz, Tsung-Hsien Lee, Amit Prakash.

Some Of The Free Platforms To Learn Data Structures.

  1. CodeChef (CCDSAP).
  2. Youtube.
  3. CodeForces.
  4. HackerRank.
  5. HackerEarth.




Tips for C++ programmers

 Competitive Programming is a sport like all other sports so you know that in every sport there is a time limit that is there and CP also ha...