Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

python programing question i need help 1.Explain the role that the number of data exchanges plays in the analysis of selection sort and bubble sort.

python programing question i need help
1.Explain the role that the number of data exchanges plays in the analysis of selection sort and bubble sort. What role, if any, does the size of the data objects play?
------------------------
2.Which configuration of data in a list causes the smallest number of exchanges in a selection sort? Which configuration of data causes the largest number of exchanges?
------------------------
3.The method that's usually used to look up an entry in a phone book is not exactly the same as a binary search because, when using a phone book, you don't always go to the midpoint of the sublist being searched. Instead, you estimate the position of the target based on the alphabetical position of the first letter of the person's last name. For example, when you are looking up a number for "Smith," you look toward the middle of the second half of the phone book first, instead of in the middle of the entire book. Suggest a modification of the binary search algorithm that emulates this strategy for a list of names. Is its computational complexity any better than that of the standard binary search?
------------------------
4.At what point does an n4 algorithm begin to perform better than a 2n algorithm?
------------------------
5.For problem size n, algorithms A and B perform n2 and n2 + n instructions, respectively. Which algorithm does more work? Are there particular problem sizes for which one algorithm performs significantly better than the other? Are there particular problem sizes for which both algorithms perform approximately the same amount of work?
------------------------
6.Explain why the modified bubble sort still exhibits O(n2) behavior on the average.
------------------------
7.Explain why insertion sort works well on partially sorted lists.
------------------------
8.Describe the strategy of quicksort and explain why it can reduce the time complexity of sorting from O(n2) to O(n log n).
------------------------
9.Why is quicksort not O(n log n) in all cases? Describe the worst-case situation for quicksort and give a list of 10 integers, 110, that would produce this behavior.
------------------------
10.The partition operation in quicksort chooses the item at the midpoint as the pivot. Describe two other strategies for selecting a pivot value.
------------------------
11.Sandra has a bright idea: when the length of a sublist in quicksort is less than a certain numbersay, 30 elementsrun an insertion sort to process that sublist. Explain why this is a bright idea.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions