We Have Numbers Of Free Samples


For Each Subject To Make A Difference In Your Grade

 
 
 
 

Advanced Algorithm Analysis



Total Views 707

Question 1

For a tree T, let nI denote the number of its internal nodes, and let nE denote the number of its external nodes. Show that if every internal node in T has exactly 3 children, then nE = 2ni + 1.

Solutions 1

Let

1 root +3 externals = 3

And 3 = 2*1+1

Suppose the true value for the n nodes see the following

ne = 2ni + 1

now I have to spread the tree by add more nodes on tree.

  • We cannot add only 1 node deprived of disrespectful the property of proper 3-ary tree.
  • Add 3 nodes on existing tree.

Question 2

Insert entries with keys, 2, 7, 3, 12, 5, 20, 14, 6, 11, 8, 15, 17, 1, 19, 23, 14 (in this order), into an empty:

(a) heap.

(b) binary search tree.

(c) AVL tree.

(d) (2, 4) tree.

Binary search tree

Heap

AVL Tree

(2,4) tree

Question 3

Although merge sort runs in ? (n lg n) worst-case time and insertion sort runs in ? (n2) worst case time, the constant factors in insertion sort make it faster for small n. Thus, it makes sense to use insertion sort within merge sort when sub problems become sufficiently small. Consider a modification to merge sort in which n/k sub lists of length k are sorted using insertion sort and then merged using the standard merging mechanism, where k is a value to be determined.

i) Show that the n/k sub lists, each of length k, can be sorted by insertion sort in ? (nk) worst-case time.

ii) Show that the sub lists can be merged in ? (n lg(n/k)) worst-case time.

iii) Given that the modified algorithm runs in ? (nk + n lg(n/k)) worst-case time, what is the largest asymptotic (?-notation) value of k as a function of n for which the modified algorithm has the same asymptotic running time as standard merge sort.

Solutions 3

Question 4

Consider the recurrence T(n) = 3T(⌊n/2⌋) + n.

i) Use the master method to give tight asymptotic bound for this recurrence (if the master method cannot be used, explain why).

ii) Use a recursion tree to determine a good asymptotic upper bound on this recurrence.

iii) Use the substitution method to verify your answer.

Solution 4

Question 5

Show all the steps for performing any of the following algorithms for matching the pattern ‘rithm’ in the text ‘advancedalgorithmanalysis’.

(a) brute-force

(b) Boyer-Moore

(c) Knuth-Morris-Pratt

Solution 5

BookMyEssay has a team of experts assignment help tutors, who are ready to provide the last minute writing service to students according to their topic requirement. Student require to pay the additional charges to take the advantage of this facility. They no longer need to waste their time to search, “can somebody write my essay at lowest prices”, instead they can hire our assignment providers to complete their assignment within deadline.

[Download not found]


Download

505

Size

140.91 KB

File Type

[contact-form-7 404 "Not Found"]

Subject Categories



Get Guaranteed Higher Grades
Book Your Order