Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Dijkstra's algorithm is completely trivial. It's a greedy algorithm; there's nothing more complex involved than repeating the same simple step over and over. You pick a starting node then repeatedly add the lowest-cost edge to a node you haven't already reached. It's harder to explain what a "node" and "edge" are than to explain how Dijkstra's algorithm works.

Many textbooks make it sound harder than that because they want to examine complex data structures that make various parts of that as fast as possible. But the complexity is the implementation of the data structures, not Dijkstra's algorithm.



indeed. and I can confirm I learned this algorithm back in the day in 8th grade, as we were given home assignments and myself had to read through a book 'introduction to Graphs' which was designated for 2nd university year students.

I was able to read halfway through the book before it started getting too complex for my teen mind.

so, can it be taught? - yes is it trivial - I would not dare say, but is elegant in simplicity do people understand and remember it easily - no, they don't

should you decide to prove me right, well - try to teach it to someone, but also require that he not only understands but implements it. well those who could do this in 8th grade were those going to Olympiads in Informatics.

perhaps things have changed since the 90s and children are smarter today. so my bet is you can teach it to 5th graders, not sure to what effect though.




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

Search: