PE424001 Algorithm and Data Structure
Assignment 2
(25% of the module score)
Q1. (10 Marks) Answer the following questions using Figure 1
Figure 1 A directed graph
a) Construct the corresponding adjacency matrix of Figure 1 (2 Marks)
b) What is the main disadvantage of using matrix to form the graph relationship? (1 Mark)
c) Execute Dijkstra’s algorithm on the graph of Figure 1 starting at vertex A. It is noted that each vertex MUST be visited at least once. (3 Marks)
d) What is the shortest path from A to F. Show the route. (1 Marks)
Figure 2 An undirected graph
e) An undirected version is shown in Figure 2. Use Depth-First search traverse the graph (from node A) and illustrate the steps using proper data structure. (3 Marks)
Q2. (9 Marks) Given the following data sequence.
[35, 20, 38, 16, 31, 40, 10, 22, 34]
a) Draw the binary search tree formed by entering the data in the order from 20 to 50 one by one and assign a balancing factor in each node. (4 Marks)
b) Using the tree above, give the preorder scan of the nodes. (1 Marks)
c) Using the tree above, give the inorder scan the nodes. (1 Marks)
d) Using the tree above, give the postorder scan the nodes. (1 Marks)
e) Reform the tree into AVL tree and put the balancing factor in each node. (2 Marks)
Q3. (6 Marks) Huffman code is one of the Greedy approach to compress data string. Given the following simple frequency
49 e’s 11 b’s 8 c’s 12 d’s
a) Draw a Huffman tree and label the binary number (try to make your tree as balance as possible) (2 Mark)
b) Write down the final codeword of each symbol (2 Marks)
c) Consider the following code fragment
Cost
Times
i = 1;
C1
T1
sum = 0;
C2
T2
While (I <= n) {
C3
T3
i = i +1 ;
C4
T4
sum = sum + i;
C5
T5
}
Complete T1 to T5 and write down the total cost formula. (2 Marks)
iii) Submission
– DEADLINE: 22:00:00 31st August, 2015
– Submission method:
1. Zip up all the files and name the zip file to “[Last name]_[First name].zip”. (E.g. Chan_Peter.zip)
2. Send the zip file to alexng88@vtc.edu.hk
3. Enter “ADS Assignment 2 Submission – [Last name] [First name]” in the subject.
4. Marks will be deducted if you don’t follow the submission method.
Marks will be deducted on late submission.
iv) Marking Scheme
This assignment contributes 25% of the final grade of PE424001
The full mark for this assignment is 25 marks, which break down into:
– Question 1 contributes 10 marks.
– Question 2 contributes 9 marks.
– Question 3 contributes 6 marks.
– End –
1 week
Your marks x 90%
2 weeks
Your marks x 80%
More than 2 weeks
Your marks x 0%
Our Service Charter
-
Excellent Quality / 100% Plagiarism-Free
We employ a number of measures to ensure top quality essays. The papers go through a system of quality control prior to delivery. We run plagiarism checks on each paper to ensure that they will be 100% plagiarism-free. So, only clean copies hit customers’ emails. We also never resell the papers completed by our writers. So, once it is checked using a plagiarism checker, the paper will be unique. Speaking of the academic writing standards, we will stick to the assignment brief given by the customer and assign the perfect writer. By saying “the perfect writer” we mean the one having an academic degree in the customer’s study field and positive feedback from other customers. -
Free Revisions
We keep the quality bar of all papers high. But in case you need some extra brilliance to the paper, here’s what to do. First of all, you can choose a top writer. It means that we will assign an expert with a degree in your subject. And secondly, you can rely on our editing services. Our editors will revise your papers, checking whether or not they comply with high standards of academic writing. In addition, editing entails adjusting content if it’s off the topic, adding more sources, refining the language style, and making sure the referencing style is followed. -
Confidentiality / 100% No Disclosure
We make sure that clients’ personal data remains confidential and is not exploited for any purposes beyond those related to our services. We only ask you to provide us with the information that is required to produce the paper according to your writing needs. Please note that the payment info is protected as well. Feel free to refer to the support team for more information about our payment methods. The fact that you used our service is kept secret due to the advanced security standards. So, you can be sure that no one will find out that you got a paper from our writing service. -
Money Back Guarantee
If the writer doesn’t address all the questions on your assignment brief or the delivered paper appears to be off the topic, you can ask for a refund. Or, if it is applicable, you can opt in for free revision within 14-30 days, depending on your paper’s length. The revision or refund request should be sent within 14 days after delivery. The customer gets 100% money-back in case they haven't downloaded the paper. All approved refunds will be returned to the customer’s credit card or Bonus Balance in a form of store credit. Take a note that we will send an extra compensation if the customers goes with a store credit. -
24/7 Customer Support
We have a support team working 24/7 ready to give your issue concerning the order their immediate attention. If you have any questions about the ordering process, communication with the writer, payment options, feel free to join live chat. Be sure to get a fast response. They can also give you the exact price quote, taking into account the timing, desired academic level of the paper, and the number of pages.