Question: 10. Define basic operations for your algorithms in Exercises 17, and study the performance of these algorithms. If a given algorithm has an every-case time

 10. Define basic operations for your algorithms in Exercises 17, and

10. Define basic operations for your algorithms in Exercises 17, and study the performance of these algorithms. If a given algorithm has an every-case time complexity, determine it. Otherwise, determine the worst-case time complexity.

1. Write an algorithm that finds the largest number in a list (an array of n numbers. 2. Write an algorithm that finds the m smallest numbers in a list of n numbers. 3. Write an algorithm that prints out all the subsets of three ele- ments of a set of n elements. The elements of this set are stored in a list that is the input to the algorithm. 4. Write an Insertion Sort algorithm Insertion Sort is discussed in Section 7.2) that uses Binary Search to find the position where the next insertion should take place. 5. Write an algorithm that finds the greatest common divisor of two integers. 6. Write an algorithm that finds both the smallest and largest numbers in a list of n numbers. Try to find a method that does at most 1.5n comparisons of array items 7. Write an algorithm that determines whether or not an almost complete binary tree is a heap

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!