WHY USE PYTHON FOR COMPETITIVE CODING
In these kind of competitions speed is necessary,I am not talking about the speed of the language but rather about the speed of the programmer.Python syntax is extremely clutter free and elegant which allows us to not get tangled up in complicated details of a programming language.
Python also has a very vast variety of tools in its standard library and these tools can be very well utilised in competitive programming.
Here's a list of a whole lot of other reasons why you would want to use python:
- Common inbuilt functions:
Python has common functions like count,min,max,sorted etc.These functions allow you to easily go ahead and skip writing code for these trivial procedures which often prove to be very helpful,rest assured:
Python functions use the best algorithms for their functions.The function sorted() uses an algorithm known as Timsort,this algorithms provides stable sorting at the worst case performance of O(n log n).This is the best any sorting algorithm can provide,even better ,it has the best case run time of O(1) or constant run time.
Just click this link if you want to know more about Timsort - List Comprehensions
Aren't list comprehensions the best!?They basically allow you to write code that would basically take 10-20 lines in 1 line!On top of that you can also have nested loops and conditions in a list comprehension. - Standard library(HEAVEN)
The Standard Library of python is no less than amazing.It has several data structures which eliminates the need to implement them and also itertools which is again a very very important part of the library.I'd say any programmer would die for these tools!
For example you can write a program that finds all the possible combinations of numbers can be formed by giving digits as input,using list comprehension and permutations function from itertools. - Vast variety of data structures
Python has so many more inbuilt data structures than most of the other languages.It has dictionary,sets,tuples,list and much much more if you use its standard library.Tuples allow you to return more than one value from a function and a list is basically a super enhanced linked lists,it has the best features of arrays and linked lists combined! - The last and the most coveted reason I will present is python's ease of use.
It basically reads like pseudocode!
This comment has been removed by a blog administrator.
ReplyDeleteThis comment has been removed by a blog administrator.
ReplyDeleteThis comment has been removed by a blog administrator.
ReplyDeleteThis comment has been removed by a blog administrator.
ReplyDeleteThis comment has been removed by a blog administrator.
ReplyDeleteThis comment has been removed by a blog administrator.
ReplyDeleteThis comment has been removed by a blog administrator.
ReplyDeleteThis comment has been removed by a blog administrator.
ReplyDeleteThis comment has been removed by a blog administrator.
ReplyDeleteThis comment has been removed by a blog administrator.
ReplyDeleteI think you should use python or java if you only want to do competitive programming for cracking interviews. But if you enjoy doing competitive programming in general then you should use C++ only because it is the most used language in competitive programming. Which means it's much easier to find solutions to problems
ReplyDelete