Why Strings as Classes?

Nick Sabalausky a at a.a
Thu Aug 28 02:16:40 PDT 2008


"lurker" <lurker at lurk.com> wrote in message 
news:g95e2c$1rbf$1 at digitalmars.com...
>
> Come to your senses. Open any algorithms book. Finding the nth element in 
> a list is linear search. It does not matter whether you are looking for a 
> value or an index. Search is search is search. Claiming a linear search 
> it's not a linear search is just empty retoric and semantic masturbation.
>

Not that I normally go to such lengths for online debates, but I just 
happened to have my algorithms book a few feet away, and, well, I really was 
curious what it would say...

Apperently, not much. The Second Edition of "Introduction to Algorithms" 
from MIT Press doesn't appear to back either of us on this point. On page 
198, it lists "Operations on dynamic sets". "Search" is defined as 
retreiving a pointer to an element, given the element's "key" (ie, not index 
or value, and the book defines "key" on the prior page and the defenition 
doesn't match what we would consider an index or value).  But none of the 
other operations are anything that would correspond to an "Indexing" 
operation.  The section on linked lists (pages 204-209) doesn't provide any 
more clarification. It still treats search as retrieving a pointer to an 
element given an associated key and doesn't mention anything about getting 
the "Nth" element (perhaps not surprising, since the *implementation* of 
such an operation would obviously be very similar to search).





More information about the Digitalmars-d mailing list