Hacker News new | past | comments | ask | show | jobs | submit login

> I can tell you the last time I had to write a singly-linked list implementation though. October 17th, Nineteen Ninety Never.

The point of writing (and working with) linked list implementations in a CS2 course is not because linked lists are something you'll have to implement yourself later (although there are certain areas of systems programming where return values of various system calls are, effectively, linked lists).

The point of working with LLs in CS2 is because they are an extremely simple data structure that you can inspect the entire implementation of; and their use of references/pointers gives practice with that concept before upgrading to the concepts of trees and (linked) graphs; and their fundamental structure and properties are so different from array-type list implementations that they provide a good first example of two different implementation strategies that can produce exactly the same output/result but with different space and time usage properties; and the parallel implementations are also a motivation for abstracting interface away from implementation and keeping data private and interface public.

So, that's why I teach linked lists in CS2. I try to be very up-front with my students about that; sorry to hear that your professors maybe weren't. I pretty solidly agree that a LinkedList per se is not particularly useful to a working software engineer; but that's not why we teach them.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: