Question

Question 2 (30.0 marks) Given the array of integers 34, 66, 57, 45, 20, 98, 92, 41, a. Show the steps that a mergesort takes

0 0
Add a comment Improve this question Transcribed image text
Answer #1

41 (H 34 66 57.45 pase;- find mid= Ott: Mergesort Given Array is 26 98 92 2 4 6 = 3 3 o 5 17 2 Divide the array as [o to, 3],

Decrement end until Passio- 34166 1451577 20198 192 193 POSSIPs 134166.145157 20198 1911927 Passes 34 145, 5766) 20178 14119

swap start, end 57 45 66 98 92 41 20 34 Start pass(2), now end - based on Divide the array 40 as pivot. 240 57 lus) 661 9819

Divide the array 157166 192.1987 so Finally Sorted array is 2013414145 57 16619298 ©) Heapsortz 34 66 57 45 20 98 92 41 corSt

। Insert 2015 6a 45 (34 (20 Insert-987 स १80 (390 (201 १8 390 (57 64 (300 50 (20 Insert 92- 8 12 G 45 92 20) (57) 12 S (GO (2

insert - 98 98 45 (921 (49 17220 (20) 157 68 60 (57) 64 141 (34 Array is 98,45,92,45,20,57,66,34 Deletion; (only rootnode) De

Delete 921 340 345 G YOOL (US) COM US (20 (51) 4020 (34) (40) 3 31545 6५ ५। 26 5-1 92 98 1 (a 45 ST पा (20 (300 updated array

Delete 415 O (9 , २१) 20 34) ५। 34 20/455-766||2|१४ Delete ul- n (344 (20 (200 344 20 45 5766928 Delete 342 (20 २) 20 20 34 4

Add a comment
Know the answer?
Add Answer to:
Question 2 (30.0 marks) Given the array of integers 34, 66, 57, 45, 20, 98, 92,...
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. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Sorting Sort the following array using the quick sort algorithm: (4 Marks) a. 12 26 8...

    Sorting Sort the following array using the quick sort algorithm: (4 Marks) a. 12 26 8 9 7 0 4 Pivot selection is defined to be the first element of each sub-list. Show the array before and after each quicksort round (when the array is partitioned after placing the pivot at its correct position). Also, clearly highlight the pivot in each partition b. Consider an unsorted array of integers of size n. Write a Java program to arrange the array...

  • C++ Sorting and Searching 1. Mark the following statements as true or false. a. A sequential...

    C++ Sorting and Searching 1. Mark the following statements as true or false. a. A sequential search of a list assumes that the list elements are sorted in ascending order. b. A binary search of a list assumes that the list is sorted. 2. Consider the following list: 63 45 32 98 46 57 28 100 Using a sequential search, how many comparisons are required to determine whether the following items are in the list or not? (Recall that comparisons...

  • Use C++ (2D Array) Write a program which: 1. Assigns data given below into the 2D...

    Use C++ (2D Array) Write a program which: 1. Assigns data given below into the 2D array of integers which is 10x10. 2. Prints out the contents of the 2D array after assigning the data to make sure correct data was assigned. 3. Figures out and prints out the square root of the sum of ALL the elements in the 2D array. 4. Figures out and prints out the average of ALL THE ELEMENTS in the 2D array. 5. Figures...

  • Complete function long_list_printer.print_list(). When it's finished, it should be able to print this list, a =...

    Complete function long_list_printer.print_list(). When it's finished, it should be able to print this list, a = [ [93, 80, 99, 72, 86, 84, 85, 41, 69, 31], [15, 37, 58, 59, 98, 40, 63, 84, 87, 15], [48, 50, 43, 68, 69, 43, 46, 83, 11, 50], [52, 49, 87, 77, 39, 21, 84, 13, 27, 82], [64, 49, 12, 42, 24, 54, 43, 69, 62, 44], [54, 90, 67, 43, 72, 17, 22, 83, 28, 68], [18, 12, 10,...

  • Using Merge Sort: (In Java) (Please screenshot or copy your output file in the answer) In...

    Using Merge Sort: (In Java) (Please screenshot or copy your output file in the answer) In this project, we combine the concepts of Recursion and Merge Sorting. Please note that the focus of this project is on Merging and don't forget the following constraint: Programming Steps: 1) Create a class called Art that implements Comparable interface. 2) Read part of the file and use Merge Sort to sort the array of Art and then write them to a file. 3)...

  • I need to develop the 7 functions below into the main program that's given on top...

    I need to develop the 7 functions below into the main program that's given on top Write a C program to create array, with random numbers and perform operations show below. Il Project 3 (53-20). 1 Projects CS5,00 This file contains the function Programcution Dagine and one include <timo // Defining some constants definer_SIZE 20 define LOVE LIMIT 1 eine UPR UNIT define TALSE eine Tut 1 wold randomizery (int[], int, Int, int) wold pinay in. St, Int); En find...

  • Copy the following java codes and compile //// HighArray.java //// HighArrayApp.java Study carefully the design and...

    Copy the following java codes and compile //// HighArray.java //// HighArrayApp.java Study carefully the design and implementation HighArray class and note the attributes and its methods.    Create findAll method which uses linear search algorithm to return all number of occurrences of specified element. /** * find an element from array and returns all number of occurrences of the specified element, returns 0 if the element does not exit. * * @param foundElement   Element to be found */ int findAll(int...

  • 1) Come up with a single (one) question or problem 2) Think of an example with 30 data points a. ...

    1) Come up with a single (one) question or problem 2) Think of an example with 30 data points a. This data needs to be of a quantitative variable (numbers). 3) Then proceed to follow the below steps. example of 30 quantitative data points Purpose State how, when, and where data was collected List of raw data pairs Frequency distribution (table) Histogram Relative percentage polygon Sample mean Sample median Sample mode(s) Sample range Sample variance Sample standard deviation Coefficient of...

  • Designing functions Reminder: When designing functions, follow the given steps to reinforce good software development p...

    Designing functions Reminder: When designing functions, follow the given steps to reinforce good software development practices and problem solving strategies: a) Start by writing the documentation for the function. Use docstrings shown in lecture and lab. b) Write test calls to the function in your main function for the different cases of input the function will encounter. This will help you understand the behavior of the function and later behave as tests for your function. c) Define the function d)...

  • BIOL 1620o, Spring 2019 NAME (Last, Preferred First): Date: 45. What is the most important means by which capillay exchange occurs? 53. Which of the following organs does NOT contain lymphatic...

    BIOL 1620o, Spring 2019 NAME (Last, Preferred First): Date: 45. What is the most important means by which capillay exchange occurs? 53. Which of the following organs does NOT contain lymphatic tissue? A. liver B. spleen C. lingual tonsils A. exocytosis B. diffusiorn C. ATP powered pumps D. facilitated diffusion E. pharyngeal tonsils. 46.According to Poiseuille's law A. blood flow is not related to resistance. B. ph of the blood influences flow C. viscosity of the blood is not related...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT