Ask your own question, for FREE!
Computer Science 10 Online
OpenStudy (anonymous):

How do I calculate/show proof of the worst run time for an algorithm?

OpenStudy (anonymous):

:-D There's an entire field of CS dedicated to figuring out the time complexity of an algorithm! http://en.wikipedia.org/wiki/Analysis_of_algorithms A bunch of different methods are in there, but you can try this one http://en.wikipedia.org/wiki/Analysis_of_algorithms#Evaluating_run-time_complexity

OpenStudy (farmdawgnation):

So, there are some basic counting methods involved in this, so you could do a basic count analysis of a routine. def does_something(string name) pint 'hi ' + name; end The above would be an O(1) operation, because no matter the input provided it will always take the same amount of time to execute. On the other hand... the following: def print_array_items(Array[string] arrayOfStrings) foreach arrayOfStrings as individual item print individualItem; endforeach end That would be O(n), meaning that the time increasing linearly based on the size of the arrayOfStrings. You can count this by figuring out what determines how many times the loop will run.

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Latest Questions
Arriyanalol: i need help
3 days ago 7 Replies 1 Medal
Arriyanalol: CONGRATS to me
3 days ago 8 Replies 2 Medals
Legomaster346: What colleges are good that are near Arab Alabama?
1 week ago 5 Replies 0 Medals
Arriyanalol: i need help
1 week ago 6 Replies 2 Medals
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!