[Haskell] Quicksearch vs. lazyness

2007-03-19 Thread Steffen Mazanek
Hello, say, we want to find the k'th element in a sorted list. In imperative languages it is much more efficient to not use quicksort first and get the k'th element later, but to use a quicksearch algorithm that sorts only the relevant parts of the array. In Haskell one could implement this

Re: [Haskell] Quicksearch vs. lazyness

2007-03-19 Thread Dan Weston
I left my copy of Chris Okasaki's Functional Data Structures at home, but I seem to recall (vaguely) that his heap sort algorithm was best for sorting/searching the first k elements of an orderable sequence. If you don't have a copy of this book, you should definitely get one. It is his