Already have an account? Get multiple benefits of using own account!
Login in your account..!
Remember me
Don't have an account? Create your account in less than a minutes,
Forgot password? how can I recover my password now!
Enter right registered email to receive password!
Q. Calculate that how many key comparisons and assignments an insertion sort makes in its worst case?
Ans:
The worst case performance occurs in insertion sort occurs when the elements of the input array are in descending order. In that case, the first pass requires one comparison, the second pass requires two comparisons, third pass three comparisons till the kth pass requires (k-1), and in the end the last pass requires (n-1) comparisons. Therefore, we obtain the total numbers of comparisons as follows : f(n) = 1+2+3+.........+(n-k)+.....+(n-2)+(n-1) = n(n-1)/2 = O(n2)
The worst case performance occurs in insertion sort occurs when the elements of the input array are in descending order. In that case, the first pass requires one comparison, the second pass requires two comparisons, third pass three comparisons till the kth pass requires (k-1), and in the end the last pass requires (n-1) comparisons. Therefore, we obtain the total numbers of comparisons as follows :
f(n) = 1+2+3+.........+(n-k)+.....+(n-2)+(n-1)
= n(n-1)/2
= O(n2)
Explain Internal and External Nodes To draw the tree's extension by changing the empty subtrees by special nodes. The extra nodes shown by little squares are know
Algorithm for determining strongly connected components of a Graph: Strongly Connected Components (G) where d[u] = discovery time of the vertex u throughout DFS , f[u] = f
Definition of Algorithm Algorithm must have the following five characteristic features: 1. Input 2. Output 3. Definiteness 4. Effectiveness 5
Hear is given a set of input representing the nodes of a binary tree, write a non recursive algorithm that must be able to give the output in three traversal orders. Write down an
Q. Execute your algorithm to convert the infix expression to the post fix expression with the given infix expression as input Q = [(A + B)/(C + D) ↑ (E / F)]+ (G + H)/ I
what is the impoartance of average case analysis of algorithm
By changing the NULL lines in a binary tree to the special links called threads, it is possible to execute traversal, insertion and deletion without using either a stack or recursi
Gouraud Shading The faceted appearance of a Lambert shaded model is due to each polygon having only a single colour. To avoid this effect, it is necessary to vary the colour ac
Read the scenario (Pickerings Properties). (a) List the functions of the system, as perceived by an external user. (b) List the external entities. Note that because we are mo
The data structure needed for Breadth First Traversal on a graph is Queue
Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!
whatsapp: +91-977-207-8620
Phone: +91-977-207-8620
Email: [email protected]
All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd