by anuragramdasan · 13y ago · 0 comments
I thought it was important to understand how the computer perceives these algorithms and data structures, thus making C a much better language to learn these topics. I've found learning that way much more enlightening.
As for algorithms wouldn't Python, Ruby or Scheme be better?
I found that frustrating in my CS algorithms classes. I spent more time fighting with templates, pointers and segfaults than actually learning the algorithms. And no it didn't teach me to be a better C++ and Java programmers, as they didn't bother teaching design principles in those courses. All that was learnt in a separate course or an in labs.
I'm biased, but I think my university took a good approach. In one class sophomore year we had to implement Quicksort and some other algorithms in MIPS assembly language. The rest of our classes used Java or whatever else was installed on the Linux machines in the computer lab. It let us see what was going on under the hood without the tedium of having to do it for everything.
Further doing these things in Scheme has had long lasting benefits when I need to work in a functional programming space. In my experience, going from functional to imperative was easy, my colleagues that had to go the other way seem to struggle more.
That said, some data structures & some algos need to be written at a very low level to understand why standard Big O algo analysis can occasionally lead you astray. But I don't think they all need to be.
For example, being able to swap by doing "a, b = b, a" in python allows one to focus on the rest of the algorithm rather than getting bogged down in: "temp = a; a = b; b = temp". Generally speaking, the more lines of code the harder it is to see what the code is doing.