Question: We are given a dictionary D, which is an array of n distinct strings, sorted in lexicographic order We are also given a procedure CoMPARE-STRINGs(x,

We are given a dictionary D, which is an array of n distinct strings, sorted in lexicographic order We are also given a procedure CoMPARE-STRINGs(x, y), which will compare two strings x and y in 6(1) time, and return true if x comes before y, and false if y comes before x in lexicographic order. We are also given an array C, which contains n-1 of the n strings in D, but C is not sorted We would like to develop an algorithm that will find the string that is missing in C (a) Design a divide-and-conquer algorithm that will find the missing string in (n) time. You can assume that we can utilize the PaRTITION algorithm that is used by QUICKSorT, by modifying it to compare strings instead of comparing numbers (you do not need to show how to do the modification). Write the pseudo-code of your algorithm and explain how it works. (b) Show that the runtime of your algorithm is (n) Example. Suppose D-f"W","X","Y", " Z"] and C-f"Y", "Z","W"]. Then, the missing string in C is: "X". We are given a dictionary D, which is an array of n distinct strings, sorted in lexicographic order We are also given a procedure CoMPARE-STRINGs(x, y), which will compare two strings x and y in 6(1) time, and return true if x comes before y, and false if y comes before x in lexicographic order. We are also given an array C, which contains n-1 of the n strings in D, but C is not sorted We would like to develop an algorithm that will find the string that is missing in C (a) Design a divide-and-conquer algorithm that will find the missing string in (n) time. You can assume that we can utilize the PaRTITION algorithm that is used by QUICKSorT, by modifying it to compare strings instead of comparing numbers (you do not need to show how to do the modification). Write the pseudo-code of your algorithm and explain how it works. (b) Show that the runtime of your algorithm is (n) Example. Suppose D-f"W","X","Y", " Z"] and C-f"Y", "Z","W"]. Then, the missing string in C is: "X
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
