home *** CD-ROM | disk | FTP | other *** search
/ C by Discovery (4th Edition) / C_By_Discovery_4th_Edition.tar / C_By_Discovery_4th_Edition / CH_04 / 252.jpg < prev    next >
Joint Photographic Experts Group Image  |  2013-12-11  |  741KB  |  2550x3300
Labels: book | crt screen | monitor | reckoner
OCR: 252 Chapter Arrays and Pointers Locati onOfLargest() has one iteration Jor every element in the array for a total of n iterations The while loop in Selecti onSort iterated once for each value of last from n-1 down to one for a total of n- times Therefore, state- ments the 10J loop in Loca t ono fLa. rgest are executed P2 times Thereforc. the number of steps necessary to complete the selection sort algorithm plus terms of orp.r and constant terms Since this number proportional plus terms that do not grow as fast as n2 we say that the performance of the selection sort is O(n2 (big Oh of n squared) To verify this analysis, it should be noted that statements in swap( are exe- cuted times the decrement of last is executed n times and some initializations are executed either or constant number o ...