Question: ( 1 ) ( 5 marks ) Given two arrays A [ 0 . . n 1 ] and B [ 0 . . n
marks Given two arrays An and Bn of numbers. Find their
intersection set, ie the set that contains those numbers that are both in A and B A
bruteforce algorithm would be easy: for each number in A check to see whether it is
in B
a Analyze the time complexity of the bruteforce algorithm for solving the problem.
b Design a presortingbased algorithm for solving the problem and analyze its
complexity.
marks You are given a dictionary, in which each word can have a maximum of
letters. This assumption is unrealistic. Design a presortingbased algorithm to find
all sets of anagrams. For example, eat, ate and tea belong to the same anagram set.
Analyze the complexity of your algorithm.
marks For the following list of numbers, construct an AVL tree by inserting them,
one by one successively, into an empty tree:
marks Deletion is another operation that could cause an AVL tree to be
unbalanced. Suppose that you are given a pointer pointing to the node to be deleted.
Discuss what you should do in order to make sure that, after deleting the node, the
tree is still AVL.
marks Apply Prims algorithm and Kruskals algorithm, respectively, to the
following graph to find its MST Show details.
marks Apply Dijkstras algorithm to the above graph to find the shortest paths
from vertex a to all other vertices. Show details. marks Apply Prim's algorithm and Kruskal's algorithm, respectively, to the following graph to find its MST Show details.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
