Question

Question 4: (20 marks) Given the following numbers found in an array: 8, 7, 1, 4,...

Question 4:

Given the following numbers found in an array: 8, 7, 1, 4, 3, 9

  1. Use insertion sort to sort the original list of numbers.
  2. Use bubble sort to sort the original list of numbers.   

Homework Answers

Answer #1

The answer of the question given below,

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
1.) Generate an array of 10 random numbers between 1 - 100 2.) Copy the array...
1.) Generate an array of 10 random numbers between 1 - 100 2.) Copy the array to a temp array 3.) Call each of the methods to sort (bubble, selection, insertion, quick, merge), passing it the array 4.) In-between the calls, you are going to refresh the array to the original numbers. 5.) Inside of each sorting method, you are going to obtain the nanoseconds time, before and after the method Subtract the before time from the after time to...
Given the following unordered array: [0] [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]...
Given the following unordered array: [0] [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] W X D T P N R Q K M E If the array was being sorted using the SHELL sort and the halving method, and sorting into ASCENDING order as demonstrated in the course content, list the letters in the resulting array, in order AFTER the FIRST pass. [0] [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]
Giving an array of integers A[1:8] ={5, 1, 3, 2, 7, 6, 8, 4}. Build a...
Giving an array of integers A[1:8] ={5, 1, 3, 2, 7, 6, 8, 4}. Build a MAX-HEAP on A. Show the steps using binary tree representation or array view. Use heap sort: show the array after the first, the second, and the third of heap sort
Perform Bubble Sort on the following list of numbers. show visually all the steps clearly in...
Perform Bubble Sort on the following list of numbers. show visually all the steps clearly in a tabular format. 9, 15, 3, 4, 3, 15, 7
Write a PHP code that: 1- Creates an array that holds 10 random integer numbers between...
Write a PHP code that: 1- Creates an array that holds 10 random integer numbers between 1 and 100. 2- Moves all multiple of 3-numbers in the array that created in part-a into a new array. 3- Moves all multiple of 5-numbers in the array that created in part-a into a new array. 4- Find the maximum and the minimum multiple of 3-numbers, if exist. 5- Find the maximum and the minimum multiple of 5-numbers, if exist. 6- Prints the...
Write a code in c++ using linear insertion following the steps below. Comment your work. 1....
Write a code in c++ using linear insertion following the steps below. Comment your work. 1.    Ask the user for the name of a file containing data. If it does not exist, the program should display an error, then ask for a new file name. Entering an asterisk (*) as the first and only character on a line should terminate the program. 2.     You can use a statically-allocated one-dimensional array of doubles for this with length 100. You...
How do you take an array for example A = [4 6 7 1 2 5]...
How do you take an array for example A = [4 6 7 1 2 5] and sort it from ascending order. So it would output A = [1 2 4 5 6 7]. In MATlab without using the sort function as well.
C++ program for : 1. Given an array of real numbers and the dimension n (n...
C++ program for : 1. Given an array of real numbers and the dimension n (n is entered from the keyboard). B form an array, each element bi - arithmetic mean of the array elements and excluding ai. 2. Given an array of integers dimension n. Change the array so that all the elements of the module which is not equal to the maximum element of the array, replaced by zero, and equal - unit. 3. Given an array of...
This program is in C++, And please consider " sort pass #" for the output: Write...
This program is in C++, And please consider " sort pass #" for the output: Write a program that uses two identical arrays of eight integers. It should display the contents of the first array, then call a function to sort it using an ascending order bubble sort, modified to print out the array contents after each pass of the sort. Next the program should display the contents of the second array, then call a function to sort it using...
What is the median of the following set of numbers 9, 8, 7, 8, 5, 9,...
What is the median of the following set of numbers 9, 8, 7, 8, 5, 9, 6, 7, 8, 9, 6, 5, 6, 7, 5, 4.