Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| courses:cs211:winter2012:journals:jeanpaul:chapter_fivesection_iii [2012/03/12 21:30] – mugabej | courses:cs211:winter2012:journals:jeanpaul:chapter_fivesection_iii [2012/03/12 22:25] (current) – [Designing and Analyzing the Algorithm] mugabej | ||
|---|---|---|---|
| Line 20: | Line 20: | ||
| >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> | >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> | ||
| >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> | >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> | ||
| - | >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> | + | >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> |
| + | >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> | ||
| + | >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> | ||
| + | \\ | ||
| + | The total running time of this algorithm is O(n) time.For solving the problem,we simultaneously sort and count as follows: | ||
| + | \\ | ||
| + | >>>>>>>>>>>>>>>>>> | ||
| + | >>>>>>>>>>>>>>>>>>>>>>>> | ||
| + | >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> | ||
| + | >>>>>>>>>>>>>>>>>>>>>>>> | ||
| + | >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> | ||
| + | >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> | ||
| + | >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> | ||
| + | >>>>>>>>>>>>>>>>>>>>>>>>> | ||
| + | \\ | ||
| + | For a list with n elements, the overall running time is O(nlogn). \\ | ||
| + | I give this section 8/10 | ||
