15.4Programming Activity:Tracking How Many Statements are Executed by a Method1135
Figure 15.1
Animation of the Pro-
gramming Activity
3.Estimate the running time ofSelection Sort as a function ofn,the
number ofelements in the array being sorted.
The framework for this Programming Activity will animate your algorithm
so that you can perform a simulation on the number of statement execu-
tions inside the selectionSort method compared to the number of elements
in the array that is sorted. For example, Figure 15.1 shows the current num-
ber ofstatement executions for an array of 15 elements.
At this point,the application has executed 50 statements. ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month, and much more.