garyusenet@myway.com schrieb:
Quote:
Thankyou both very much i've learnt a great deal there.
>
This is new ground for me. Would someone please mind answering the
following questions that your answers have made me wonder.
>
3. What does this mean?
I would like to understand it, but need it explained in as much detail
as possible please.
>
" for instance, in a linked list an enumerator
would simply walk the chain as you "next", but "for" usage using the
indexer
(myList[i] etc) could be catastrophic, as it would telescope the effort
>
(O(n^2) instead of O(n) for enumerator access). "
O(n) and O(n^2) refer to the execution time needed by an algorithm.
O(n) means, that execution time is lenear depenend on the number of
items to be prcessed. In a list example, this would be a simple foreach
loop (get each item in the list).
O(n^2) means, that execution time increased quadratically with the
number of items. For example, you loop the list items and for each item
you loop the list again:
foreach (item in list) {
foreach (innerItem in list) {
// do something
}
}
Generally the O-notation gives programmers an idea of how expensive an
algorithm is and allows comparsion of two algorithms that do the same
thing, just in different ways. A classical example might be sorting or
searching lists. Eg. Bubblesort with O(n^2) vs Mergesort with O(n*log(n)).
Search the web or wikipedia for more information on this topic, you
should find plenty :)
Quote:
5. What's the difference between a 'control statement' and a statement.
Actually, I am not sure about the exact term. I'd use the above as
synonyms (in this context).
1., 2. and 4. where answered by Marc already.
Tobi