Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > Complexity of data structure

Reply
Thread Tools

Complexity of data structure

 
 
C learner
Guest
Posts: n/a
 
      04-24-2011
Why calculation of complexity of various algorithms(Linear search,
bubble sort) confined to number of comparisons, whereas the arithmetic
operations and other operations are not considered, though these also
may eat significant processing power.
 
Reply With Quote
 
 
 
 
Ian Collins
Guest
Posts: n/a
 
      04-24-2011
On 04/24/11 07:13 PM, C learner wrote:
> Why calculation of complexity of various algorithms(Linear search,
> bubble sort) confined to number of comparisons, whereas the arithmetic
> operations and other operations are not considered, though these also
> may eat significant processing power.


Because the arithmetic operations are common to all algorithms.

--
Ian Collins
 
Reply With Quote
 
 
 
 
Eric Sosman
Guest
Posts: n/a
 
      04-24-2011
On 4/24/2011 3:13 AM, C learner wrote:
> Why calculation of complexity of various algorithms(Linear search,
> bubble sort) confined to number of comparisons, whereas the arithmetic
> operations and other operations are not considered, though these also
> may eat significant processing power.


Your question isn't about the C programming language, nor about
any particular programming language, and probably belongs in a forum
like comp.programming.

... but for what it's worth, try the analysis yourself. Take
some simple algorithm, implement it, study the machine instructions
that it generates, and try to predict how much time it will take.
Don't forget to take account of pipeline parallelism, cache hits
and misses, translation look-aside buffer hits and misses, ... It
will be a difficult job, but perhaps you can get an answer after a
great deal of labor. And then you'll have an answer -- which will
go straight out the window as soon as you install a new compiler
version or change the compilation flags, or even add RAM. In other
words, all that enormous effort will produce, at best, an answer
that you can use only once and cannot transfer to the next machine.

--
Eric Sosman
d
 
Reply With Quote
 
luser- -droog
Guest
Posts: n/a
 
      04-25-2011
On Apr 24, 2:13*am, C learner <manglika...@gmail.com> wrote:
> Why calculation of complexity of various algorithms(Linear search,
> bubble sort) confined to number of comparisons, whereas the arithmetic
> operations and other operations are not considered, though these also
> may eat significant processing power.


vol. 1 of The Art of Programming by Don Knuth would be a good resource
for learning how to do this analysis on an idealized machine
architecture. Used copies (2nd Edition) are super cheap.
 
Reply With Quote
 
Gene
Guest
Posts: n/a
 
      04-25-2011
On Apr 24, 3:13*am, C learner <manglika...@gmail.com> wrote:
> Why calculation of complexity of various algorithms(Linear search,
> bubble sort) confined to number of comparisons, whereas the arithmetic
> operations and other operations are not considered, though these also
> may eat significant processing power.


You probably aren't reading the right sources. Analyzing comparisons
only is a convenience for the analyst. It lets him/her avoid defining
a model of computation. The embedded assumption is that the rest of
the computation will have run time proportional to that number, but
this may not be true as some have already pointed out.

A good algorithms text will begin by defining a model of computation
and then go on to define run time as the number of execution steps in
that model. Usually it's a Real RAM model. IIRC this is defined
early in Aho, Hopcroft and Ulman, for example.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Simple structure and copying data to pointer of the same structure A C++ 27 04-16-2011 11:07 PM
How much complexity to put in POJOs? Scott Balmos Java 6 07-13-2005 04:14 AM
2.0 Controlling password complexity in Membership =?Utf-8?B?TW9yZ2FuIFJvZGVyaWNr?= ASP .Net 3 04-22-2005 12:23 AM
NYJavaSIG - EJB 3.0 and J2EE 5 - Bringing Simplicity to the Complexity Frank D. Greco Java 0 02-15-2005 05:31 AM
reducing complexity foldface@yahoo.co.uk ASP .Net 0 10-12-2004 01:05 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57