![]() |
|
|
|
Thread Tools | Display Modes |
|
|
|
|
#1 |
|
Newbie
Join Date: Sep 2004
Posts: 9
Rep Power: 0
![]() |
========(not related to question)=======
Hi, im new to this forum! my course (carnegie technology education) requires i learn asymoptic analysis. Which means i have to learn big-oh notation. I think i have the idea, but, im just not exactly sure. If i dont please tell me! and if you would like to aid my current understanding PLZ! feel free! ============================== ========(my understanding)========= Big-Oh notation ( O(something) ), is used to summarise the "dominant reason for increases in running time, in an algorithm" To use Big-Oh notation, u identify the most dominanantly expanding part of a function, and use that within the O notation. Big-Oh analysis (mainly in terms of sorting and searching algorithms) is mainly concerned with the variable N (the size of the input being sorted or searched). U use big-Oh notation to describe the effect the particular size of N will have on the expansion of the algorithms running time. so, for example, (im scared of being wrong here!) void function(vector<int>& g) { for (int a = 0; a < g.size(); a++) { for (int z = 0; z <g.size(); z++) { //constant body } } } N == the size of the input (as all the text books say!!) according to my understanding, the most dominant reason for an expansion in this functions running time is the second for loop. this is because its amount of iterations is governed by the input (g.size()) and it is controled by its parent loop, which is also governed by the input. so, using big-oh notation, this function would be considered O(n^2), or a quadratic algorithm, because: for each parent loop of 1N (1 piece of the input (g.size()), the child loop will have to iterate N times as well, so the amount of overall iterations, mainly caused by the child for loop (identified as the most dominant), will be n^2. as apposed to, for example, a linear algorithm of O(n). ==========(question)========= Am i on the right track? is this all i need to know? is Big-Oh ONLY used for WORST-CASE complexity, and the other ways of calculating, (listed below), for NON-WORST CASE complexity? what is all this hear about Big-Omega/little-O,Big-theta, do i have to learn them to understand everything? please give me some tips and points! thankyou very much for reading this! TheDon1! |
|
|
|
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|