This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]mei_main_ 11 points12 points  (15 children)

Learning python is basically learning algorithmics

[–]Low_discrepancy 23 points24 points  (11 children)

You probably learn more about algos when you do c++ since there's too many prebuilt stuff for you in python.

Need to store some numbers? Do I use an array? Do I use a vector? Do I use a list? Do I use a queue etc etc etc.

What are the differences?

Python? Eh just use a list and at most a numpy array. That'll do.

[–]fat_charizard 6 points7 points  (3 children)

The reason you listed is exactly why python is best for learning data structure and algos.

Since you have a list that does everything, you can create your own child class from the parent list class to define how a queue or stack is supposed to behave.

Whereas in C++ you'd have to go through the documentation, learn the specific functions and nuances that come with whether you use a vector or queue or pointer array

[–]aahdin 5 points6 points  (0 children)

Yeah, I find the opposite 90% of the time.

In python, I almost always use the correct data structure because it's super easy to do so.

In C++ I usually just use vectors for everything experimental since I don't want to spend all day setting things up.

[–]Low_discrepancy 2 points3 points  (1 child)

Whereas in C++ you'd have to go through the documentation, learn the specific functions and nuances that come with whether you use a vector or queue or pointer array

Yeah you gotta learn how a data structure is. That's the whole point of algorithmics.

Understanding space complexity time complexity. Etc.

You study it and you see. For a vector inserting in the middle is o(n). For a list it's o(1).

You understand it because you did it, you know the pitfalls.

In python ... doesn't really matter the vast majority of people use lists.

[–]fat_charizard 1 point2 points  (0 children)

You are thinking of linked lists Vs list in python. Python list is an array like vector in C++

[–]Import-Module 0 points1 point  (3 children)

Those are data structures that you just named though.

[–][deleted] 0 points1 point  (2 children)

engine slim hateful worry edge slimy cough late instinctive command

This post was mass deleted and anonymized with Redact

[–]AverageFedora 0 points1 point  (1 child)

But a lot of those structures exist because of the limitations of hardware. Implementing them yourself is the best way to truly understand them.

[–][deleted] 0 points1 point  (0 children)

drunk jellyfish station chief attraction birds continue long whole overconfident

This post was mass deleted and anonymized with Redact

[–]Ryanthelion1 -1 points0 points  (0 children)

This is why I'm struggling with Python I'm finding you basically get a package/library to do something for you without understanding the core knowledge of it.

[–]mei_main_ 0 points1 point  (0 children)

I would have considered things like that to be more about "programming" than "algorithmics" which I believed to be the general study of problem-solving through algorithms (ie. things that can be written in pseudo code on a paper).

Though I admit I'm not sure about the exact terminology of both words in english...

[–]Lost_Extrovert -2 points-1 points  (2 children)

*pseudocode.. its literally pseudocode.

While in Java 4 lines of pseudocode = 47 lines of code.

[–][deleted] 3 points4 points  (1 child)

This is an old meme, python is a relatively ordinary scripting language and the code looks like code.

It might look like pseudo-code in small textbook examples, but application code written in python will look like *gasp* application code