Hacker News new | ask | show | jobs
by mailey 1130 days ago
speaking of, are there any benefits/disadvantages of learning data structures in java/python compared to C/C++ ?
3 comments

The data structures and algorithms themselves should be the same regardless of what language you are using.

The bigger difference here would be C versus C++, as the language features present in the latter allow significantly more abstraction than the former. Implementing fundamental data structures in C can be very instructive but you will also spend more time on low-level details.

With Java and Python you can ignore memory management to some extent, as these languages are garbage-collected. That could also be a plus or a minus depending on your point of view. When learning the subject, it might be better to be forced to do manual memory management, to learn about the pertinent issues. And then once in "production", you can appreciate the convenience of a garbage-collected language.

When I studied EECS at Berkeley in the late 20th century, we used the following languages:

1. CS61A "Structure and Interpretation of Computer Programs" - Scheme/Lisp. Very highly abstracted from the machine details.

2. CS61B Algorithms and data structures - C++/Java. Allows "just enough" machine details.

3. CS61C Machine structures - MIPS assembly language and some C. All the machine details.

4. EECS 152 Computer Architecture - Implement a RISC/MIPS CPU and SDRAM controller using VHDL.

Unsure why this is downvoted? This question seems reasonable.

Personally I think Python specifically allows an easier understanding of the data structure in principal, but C/C++ would create a better understanding of data structures as they operate with constraints like memory/resource availability. Kinda depends what you’re after I think.

This spring, I completed a data structures course at a large state school. We used Java at our university because Princeton did, and I imagine Princeton did because of the ease of segmenting concepts into classes because Java bytecode is the same between the students' devices and the machines which were used to grade their assignments (our grades were determined as a fraction of the number of test-cases our code would pass).