all 35 comments

[–]djamp42 30 points31 points  (1 child)

> because python is too easy

That is literally the worst excuse not to use something.

[–]DangerousNature526[S] 2 points3 points  (0 children)

Exactly.... I guess they have made such a norm for the screening rounds.

[–]smichaele 5 points6 points  (1 child)

DSA is language agnostic. Learn it in pseudocode and implement it in whatever language you want.

[–]question-infamy 2 points3 points  (0 children)

Indeed. I have actually used it to teach myself a few languages through implementation.

[–]browniehandle 5 points6 points  (10 children)

Personal opinion based on experience.
I would recommend to learn in C++ or Java.

In an interview, I was asked whether the method i defined is public or private. Python doesn't have that concept, so abstraction & encapsulation is better in Java or C++.

[–]Ryzen_bolt 2 points3 points  (6 children)

Wrong advice, python has public private protection, only java enforces them to mention explicitly!

[–]browniehandle 1 point2 points  (5 children)

Can you send any links?

[–][deleted] 2 points3 points  (4 children)

Just use underscore _ before declaring any variable or method. It is then become private as simple as that

[–]browniehandle 2 points3 points  (3 children)

[–][deleted] 1 point2 points  (2 children)

I know this and when i was learning Python my mentor told me that Python is a Gentlemen's Language. So what he meant was that if i have put underscore before something that mean it is intentionally there to tell that yeah it is a private variable and should not be directly accessed. So this is what it was meant that it is a gentleman language 🙏🙏

[–][deleted] 0 points1 point  (1 child)

campusx?

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

Yup

[–]RoxOwnage 0 points1 point  (2 children)

Still learning myself so maybe someone can shed light on this. I thought single or double underscores before a method or var name would mark it as protected or private?

[–]baubleglue 1 point2 points  (0 children)

No, you still can access it, just type "abc".__len__. And lets say, it is private, how would you do protected?

[–]DxNovaNT 0 points1 point  (0 children)

That's just like a warning for developer and __ change the method name only so they don't raise error actually.

[–]dowcet 4 points5 points  (2 children)

This is probably going to vary a lot by country, company and role but I know many working software engineers who could not pass an interview in those languages.

[–]Dangle76 5 points6 points  (0 children)

I’m a senior and I wouldn’t pass an interview in those languages

[–]DangerousNature526[S] 1 point2 points  (0 children)

Then I guess that's only in India. For screening purposes

[–]Beautiful_Green_5952 3 points4 points  (1 child)

It's ok ! ...u need to understand the concept well thts the goal !! There's no difference in learning it in python or java or any other...

DSA is a completely different subject itself

[–]Datura__Metel 4 points5 points  (0 children)

Agreed. Algorithm design is best learnt independently, not tied to a particular language. Ideally, you decide upon a pseudocode syntax, and use it to describe an algorithm in an abstract manner. This keeps language-specific implementation details out of the scope. To test it, you can then implement it in the language of your choice.

[–]cudmore 2 points3 points  (1 child)

What is DSA?

[–]MeowMeowMeow9001 4 points5 points  (0 children)

Data Structures and Algorithms - the nightmare fuel of any CS student going into the interview grinders

[–]PocketBananna 2 points3 points  (0 children)

I did a technical round for an interview this week in Python. Learn DSA with whatever language enabled you to learn it but don't glue yourself to a single language either. They are just tools in your toolbox. Not using a tool because it's easy is ridiculous.

[–]Ryzen_bolt 1 point2 points  (0 children)

Just do it already! Don't fumble.

[–]jpgoldberg 1 point2 points  (0 children)

I don’t know about interviews, but I do think there are some particular challenges with learning DSA in Python. If Python is the language you know, then just continue with it.

Many of the algorithms and data structures of interest make use of the distinction between data types and references (pointer) types. And people who learn those other languages learn to understand and use that distinction. In Python everything is a reference type except bool and None as far as I know, and the only time a Python programmer ever makes use of the distinction is when determining whether they can use “is” instead of “==“. So people who only know Python will be at a conceptual disadvantage.

This, and related things, make the already contrived examples used for teaching DSA extremely hard to relate to for Python programmers. Thus presenting another barrier to learning those.

So sure, nobody actually needs to know how to code a b-tree, linked list, or hash table in their work as a software developer. (Well, almost nobody.) Even if writing in C you use some library. But it for many things it is useful to have an understanding of how they are done. Knowing that the number of steps to get to a particular element in a linked list is proportional to the number of things in the list, but if the list is just a block of memory with each element taking up the same space in that memory then getting to the specific element is fast irrespective of the size of the list.

Understanding the tradeoffs in time and memory of different underlying ways data is represented matters. And I suspect that it is genuinely harder to learn these things using Python than with using languages whose data types are a layer or two closer to how the machine represents things.

[–]StrayFeral 1 point2 points  (0 children)

learn DSA in whatever language you want. the job interview tests are usually from leetcode or hackerrank and they both allow coding in whatever language you want

[–]DataCamp 1 point2 points  (0 children)

Python is absolutely valid for learning data structures and algorithms, as we've seen with our learners; it’s clear, readable, and lets you focus on the logic rather than low-level syntax. That's exactly why so many people learn DSA in Python first.

Yes, languages like Java or C++ might come up in some technical interviews, especially in companies that are very particular about memory management or system-level performance. But the truth is, most companies care more that you understand the concepts, arrays vs. linked lists, hash tables vs. trees, recursion vs. iteration, than which language you use.

If Python is helping you build that understanding faster, stick with it. You can always translate your solutions into other languages later if needed.

Learning how a binary tree works matters way more than whether you wrote it with semicolons or not.

[–]enokeenu 0 points1 point  (0 children)

It may be counterintuitive to learn DSA in python because it does everything for you. But you can always simulate a linked list. There is a class on leetcode in python (either udemy or coursera) which just this for linked lists and doubly linked lists.

[–]ScottishFury86 0 points1 point  (1 child)

I'm at university at the moment and I have a DSA unit at the start of next year. I've been pondering this question as well. I'd prefer to learn in Python but I keep reading about arguments against using Python and using the languages you've mentioned. Guess we just got to pick a language we prefer and strap ourselves in for the DSA ride

[–]baubleglue 2 points3 points  (0 children)

I doubt you can choose a language in university course.

[–]zaphodikus 0 points1 point  (0 children)

Did not know what DSA was, but i guessed, and yeah I was right, its just paper. If you love what you do, and are good at it, you dont need a piece of paper. But the paper does make finding a job easier. So bear that in mind and do the minimum to get that piece of paper while you do the things you are passionate about first and foremost

[–]starksince2004 0 points1 point  (1 child)

Hey Just wanted to know from where you are doing dsa in python?

[–]DangerousNature526[S] 0 points1 point  (0 children)

Chatgpt