Chapter 9: Problem 18
Which sort, bubble sort or selection sort, would require fewer passes to sort a set of data that is already in the desired order?
Chapter 9: Problem 18
Which sort, bubble sort or selection sort, would require fewer passes to sort a set of data that is already in the desired order?
All the tools & learning materials you need for study success - in one app.
Get started for freeTeam up with two to three other students and jointly decide how you would organize, order, and locate the data used in the following application. Be prepared to present your group's design to the rest of the class. The program to be developed is a menu-driven program that will keep track of parking tickets issued by the village that is hiring you. When a ticket is issued the program must be able to accept and store the following information: ticket number, officer number, vehicle license plate state and number, location, violation code (this indicates which parking law was violated), and date and time written. The program must store information on the amount of the fine associated with each violation code. When a ticket is paid the program must be able to accept and store the information that it has been paid, the amount of the payment, and the date the payment was received. The program must be able to accept inquiries such as displaying the entire ticket record when a ticket number is entered. The program must also be able to produce the following reports: A list of all tickets issued on a specific date, ordered by ticket number A list of all tickets for which payment was received on a specific date and the total amount of money collected that day A report of all tickets issued in a one-month period, ordered by officer number, with a count of how many tickets each officer wrote A report of all tickets that have not yet been paid, or for which payment received was less than payment due, ordered by vehicle license number
The maximum number of comparisons that a binary search function will make when searching for a value in a 2,000 -clement array is ___________.
A binary search will find the value it is looking for with just one comparison if that value is stored in the ____________ array element.
Complete the following table by calculating the average and maximum number of comparisons the linear search will perform, and the maximum number of comparisons the binary search will perform. $$\begin{array}{l|lllll} & 50 & 500 & 10,000 & 100,000 & 10,000,000 \\ \text { Array Size } \rightarrow & \text { Elements } & \text { Elements } & \text { Elements } & \text { Elements } & \text { Elements } \\ \hline \begin{array}{l} \text { Linear Search } \\ \text { (Average Comparisons) } \end{array} & & & & & \\ \hline \begin{array}{l} \text { Linear Search } \\ ( \text { Maximum Comparisons) } \end{array} & & & & & \\ \hline \begin{array}{l} \text { Binary Search } \\ ( \text { Maximum Comparisons) } \end{array} & & & & & \\ \hline \end{array}$$
If an array is sorted in ______________ order, the values are stored from highest to lowest.
What do you think about this solution?
We value your feedback to improve our textbook solutions.