James G. Sack (jim) wrote:
Christopher Smith wrote:
Tracy R Reed wrote:
..
I don't understand the confusion over pointers. I took the data
structures class, made linked lists. doubly linked lists, queues,
stacks, hash tables, etc. etc. It wasn't really a big deal.
Yeah, and you can learn how to make all of those things in LISP & Scheme
from cons cells, or in Smalltalk & Java from arrays and objects. Really,
aside from some funky hacks like using xor to make compact doubly linked
lists (and even then), it's hard to imagine a self-respecting language
that you can't teach data structures and algorithms with, regardless of
whether they have pointer arithmetic.
Nicely put TR & CS.
I assume most people would say that any self respecting curriculum would
more-or-less thoroughly cover data structures and algorithms.
I wonder what variations would show up in the answer to:
==> What language is best for teaching data structures and algorithms?
the thing that you got to remember about data structures and about
algorithms, is that the most important factor is their efficiency (i.e.
time and space complexity, and for small data sets - also the constant
factor). if not - a linked list and a balanced tree could be
interchangeable, so long as you put the same interface on top of both of
them.
i once started writing a book to teach data structures and algorithms in
python. after a while i found that i had to struggle in order to check
the efficiency of the algorithms - because the underlying structure of
tuples and lists in python is opaque - unless you look at the underlying
code (which happens to be written in C).
the nice thing about C (as well as pascal), is that the underlying
operations are transparent - you can see that accessing an array element
is realy an O(1) operation - because grasping the underlying
implementation is very easy. more then this - when and where i was in
school - we learned assembly language before we learned about data
structures (at least if you took the courses in the recommended order) -
so it was easy enough to calculate the actual time (and space)
complexity of operations.
this is not true for higher level languages - their basic constructs are
quite complex, and you need to know C in order to understand how exactly
they work. in this regards, it doesn't matter if the language is Java,
C#, Python or anything similar - what you conceive as an atomic
operation - may be quite complex. what you grasp as taking O(1) memory -
might take much more due to its underlying implementation (although this
is far less common - usually just the constant is higher than a young
student imagines).
--guy
--
[email protected]
http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-lpsg