User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the C section within the Software Development category of DaniWeb, a massive community of 383,414 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,741 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our C advertiser:
Views: 826 | Replies: 2
Reply
Join Date: Mar 2005
Posts: 73
Reputation: nabil1983 is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 0
nabil1983 nabil1983 is offline Offline
Junior Poster in Training

Question A couple of ?s on algorithms. Help Plz

  #1  
Dec 17th, 2005
Trying to understand how to do this Q. Can some explain using O-notation, how would i analyse the efficiency of the two algorithms below. ?

Assuming that the critical operation is compute and size is the size of the array.

1) compute(a[1]) + compute(a[2]) + compute(a[3]) + compute(a[size])

2) for k = 1 to size for j = 1 to size compute(a[j])

I just need someone to xplain this briefly so that i can understand how i would analyze algorithms of such in the future.

Also what is meant by the terms 'Programming Time' and 'Execution Time' in relation to algorithms.?



Apreciate ne help
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Aug 2005
Location: near St Louis, Missouri, USA
Posts: 10,346
Reputation: Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of 
Rep Power: 34
Solved Threads: 839
Moderator
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Most Valuable Poster

Re: A couple of ?s on algorithms. Help Plz

  #2  
Dec 18th, 2005
Originally Posted by nabil1983
Also what is meant by the terms 'Programming Time' and 'Execution Time' in relation to algorithms.?

how long time it takes for the algorithm to execute. For example, if testing a sort algorithm, how long does it take the alogithm to sort the data. That is normally measured by getting current system time before starting the algorithm, again after and subtacting the two.
clock_t t1 = clock(); // get start time
// do algorithm
clock_t t2 = clock();// get end time

clock_t delta_time = t2 - t1; // difference
Reply With Quote  
Join Date: Mar 2005
Posts: 73
Reputation: nabil1983 is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 0
nabil1983 nabil1983 is offline Offline
Junior Poster in Training

Re: A couple of ?s on algorithms. Help Plz

  #3  
Dec 18th, 2005
thanx bro.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb C Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the C Forum

All times are GMT -4. The time now is 7:52 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC