Someone help please
Let A be an array of 5 integers, whose contents are as
follows:
3, 2, 1, 5, 4
We will apply quick sort to sort this array. Show all of the
element-wise comparisons made by the algorithm in the correct
order. Here an element-wise comparison means the comparison of one
element of the array with another element of the array or the key
set in a particular step of the algorithm. Since the algorithm may
move the elements of the array, you need to show the values of the
elements being compared (rather than the form of A[i]). The first
element-wise comparison is 3 ≤ 4? You should start with this
element-wise comparison to write out all element-wise comparisons,
one comparison per row.
Draw the portion of the decision tree for insertion sort on 5 elements a1,a2,a3,a4,a5 that contains the path from the root node to the permutation < a3,a2,a1,a5,a4 >.
Draw the portion of the decision tree for quicksort on 5
elements a1,a2,a3,a4,a5 that contains the path from the root node
to the permutation < a3,a2,a1,a5,a4 >.
T(n) = 6·T(n/2)+n3. Use the master method to solve T(n). You
need to specify a, b, logb a, and decide the case. You also need to
write the derived conclusion.
Quick Sort follows divide and conquer method. That means it divides the problem into sub problems and find out the solution
In our example 3,2, 1,5,4
consider pivot element is 3 again leftmost element is= 3 and rightmost=4
pivot is 3 that means 3 must be in sorted position that means leftside of 3 contains elements less than 3 and rightside contains elements greater than 3
increment leftmost now its =2 which is less than pivot element then keep it as it is.
increment rightmost now its =4 which is greater than pivot element then keep it as it is .
increment leftmost now its =1 which is less than pivot element then keep it as it is.
increment rightmost now its =5 which is greater than pivot element then keep it as it is
increment rightmost now its =1 which is less than pivot element then exchange it with 3
now our list is = 1,2,3 ,5,4
Now divide the list into 2 parts and apply quick sort recurrsively .leftmost part of the 3 is already sorted right part contains elements 5 and 4
now consider pivot as =5 and leftmost element is also 5 rightmost element=4
now 4<5 therefore exchange it
now we get list= 1,2,3,4,5 which is in sorted order
Decision tree for insertion sort

Someone help please Let A be an array of 5 integers, whose contents are as follows:...
(7 pts) Draw the portion of the decision tree for insertion sort on 5 elements a1, a2, a3, a4, a5 that contains the path from the root node to the permutation < a3, a2, a1, a5, a4>.
6. (7 pts) Draw the portion of the decision tree for insertion sort on 5 elements a1; a2; a3; a4; a5 that contains the path from the root node to the permutation < a2; a3; a1; a5; a4 >.
4. (7 pts) Let A be an array of 5 integers, whose contents are as follows: 3, 2, 1, 5, 4. We will apply insertion sort to sort this array. Show all of the element-wise comparisons made by the algorithm in the correct order. Here an element-wise comparison means the comparison of one element of the array with another element of the array or the key set in a particular step of the algorithm. Since the algorithm may move the...
similar to this format shown at bottom
this is an example of what the answer should look like NOT
related to this question
1. (10 pts) There is a unique decision tree T for insertion sort on five element a1, a2, a3, a4, a5 Draw the portion of the tree T showing the path from the root node to the leave node a5, a4, a3, a2, a1 For each node, you need to show the comparison made. For each edge,...
There is a unique decision tree T for quicksort on five element a_1, a_2, a_3, a_4, a_5. Draw the portion of the tree T showing the path from the root node to the leave node < a_5, a_4, a_3, a_2, a_1 >. For each node, you need to show the comparison made. For each edge, you need to label it with either YES or NO.
Hello, IN C++ please help creating a 100% functional program that follows all the guidelines shown below. (I WILL RATE, NO INCOMPLETE OR OTHER PEOPLE'S SOLUTIONS PLEASE): THANK YOU. a. Randomly generate three integer arrays A1, A2, and A3 of sizes N=103 , 105 , and 107 (or 106 , if your computer cannot handle an integer array of size 107 ), in that order. b. Run all the four sorting algorithms (insertion, merge, heap and quick sort) we’ve learned...
the two problems are related. Please explain your
answer in full detail
Problem 1: On input a Binary Search Tree T show how to output an array that contains all the elements in T in sorted order. What's the running time of your algorithm? Does it perform any comparisons? Problem 2: Your classmate claims that they have an algorithm that on input n elements, constructs a Binary Search Tree T with those n elements using only O(n) comparisons. Can you...
4) [15 points total (5 points each)] Assume you are given a sorted array A of n numbers, where A is indexed from 1 up to n, anda number num which we wish to insert into A, in the proper sorted position. The function Search finds the minimum index i such that num should be inserted into Ali]. It searches the array sequentially until it finds the location i. Another function MakeRoom moves A[i], .., AIn] to Ali+1]...AIn+1] same sort...
The purpose of this assignment is to familiarize you with sort algorithms. Problem Description is as follows: 8. Search Benchmarks Write a program that has at least 20 250 integers stored in an array in ascending order. It should call a function that uses the linear search algorithm to locate one of the values. The function should keep a count of the number of comparisons it makes until it finds the value. The program then should call a function that...
Please help me with FLOWCHART and UML diagram for class, thank you! #include <iostream> #include <fstream> #define MAX 10 using namespace std; class WordListTree { public: // Structure of a node struct Node { string key; // Create an array of up to MAX children Node* child[MAX]; }; // Create a tree of strings Node* newNode(string key) { Node* temp = new Node; (*temp).key =...