Блог пользователя evil_yodeler

Автор evil_yodeler, история, 2 года назад, По-английски

Hello Codeforces, The one with c++ please tell how c++ is better than python excluding compile time and the one with python tell how python is better than c++ especially for cp

  • Проголосовать: нравится
  • -18
  • Проголосовать: не нравится

»
2 года назад, # |
  Проголосовать: нравится +24 Проголосовать: не нравится

python is a snake and c++ is coding language

»
2 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Compile time aside,

C++ has good library support like std::set and pbds that python doesn't have. Also, since C++ is more popular. This means that there are a lot of library codes (Atcoder library) and tutorials are mostly in C++. On sites where you can view the codes of others, you have a lot more sample working C++ code than Python code.

Python is very succinct and so you can code stuff up very fast. And you don't have to worry about integer overflow. However you can't go deep in recursion (shallow recursion limit). It's also more widely used in the real world so more applicable for a career.

»
2 года назад, # |
  Проголосовать: нравится +3 Проголосовать: не нравится

IMO c++ has a better STL library with data structures that support better operations. For instance, take the ordered set in c++. You can easily check element at any index in O(logn) time complexity and it remains sorted. For a python set, it is not that simple to find some element without knowing it already exists in there. Moreover, the set doesn't remain sorted and its not subscriptable.(There are workarounds regarding this problem though, but its simpler and easier in c++)

Another example is the default dictionary in python. It stores the keys in arbitrary order. We have to import separate modules for sorted dictionary and ordered dictionary.

Other than that, python is far more simpler and easier to understand. Even though there will be more references for questions in c++ as compared to python, but one can easily understand and convert code from c++ to python with a little understanding.

»
2 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

both have their pros and cons use whatever suits u..good luck

»
2 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Actually I have seen people using both during contests. Mostly they prefer C++ though. And one more important point to note, python is opted usually for string problems and C++ for deep recursion problems. Otherwise, at the end of the day it's your skills that matter. So as long as you don't always try to brute force every problem you encounter but instead try to come up with an optimized approach, you are good to go with either of the languages :)

»
2 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Python includes : 'P','y','t','h','o','n' But C++ Includes : 'C','+','+'

It means C++ is better. : )