Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please code exactly as the algorithm gave.Please do the same. Otherwise I will get Marks Zero Kindly Solve C or C++ Assignment 01 CSE 242
Please code exactly as the algorithm gave.Please do the same. Otherwise I will get Marks Zero
Kindly Solve C or C++
Assignment 01 CSE 242 Implementing Merge Sort with Arrays and Linked lists mergesort(L,length, print) // L is a list of numbers, length is the number of elements in L 1. if(print = 1), then print the entire list L on a new line. 2. Break the list L into two parts list1 and list of (roughly) equal lengths 11 and 12. 3. Recursively sort L1 and L2. 4. Let L' be an empty list. 5. j = k = 0. 6. while j = 11) add all the remaining elements of L2 to the end of L'. 8. else add all the remaining elements of L1 to the end of L'. Download the files arrayMergeSort.cpp, arrayMergeSortheader.h, listMergeSort.cpp and listMerge Sortheader.h. 1. Write a routine void mergesort (int *array, int *array2, int start, int end, int print) which sorts the part of the input array1 from array1 [start] to array1 [end] using the mergesort algorithm above. You can use array2 for the merging part of the algorithm (as L'). Copy the contents of array2 back into arrayl before you return. 2. Write a routine listElement *mergesort (listElement *first, int length, int print) which sorts the linked list starting with first using the mergesort algorithm above. The algorithm should return the head of the sorted list. You are allowed to discuss the questions, but please do NOT copy code! I might check
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started