assignment 1 - part 2 of 2

2
WXES1115/WXES1117 Data Structure Assignment Sem. 2, 2014/15 Page 1 of 2 Group Project 1 – Part 2 / 2 Instructions: Answer all questions and all parts. Submit via Spectrum. Due on Monday of 20 April 2015 by 23:59:59 (UTC+08:00). Up to 3 students per group (solo allowed), for the same group as in Part 1 of Project 1. [Question 1] Table 1 from Part 1 of Project 1 is copied below for quick reference purpose. Table 1. The first few values captured by virtual queue decomposition It is mathematically proven that the following 2D recurrence relation governs the values: , = 1 , + , 1 Now, answer the following questions: (a) By studying the values in Table 1, what data type should (, ) be and explain why? (b) By using recursive method, implement the abovementioned relation. (c) Test your method by using (5,5), (10, 10), and (14,14). (d) Using Table 1, trace the intermediate results when computing (3,2). [Question 2] Discrete Wavelet Transformation (DWT) is a powerful signal processing method for de- correlating signal samples. Among all wavelet functions, Haar wavelet is the simplest one. To facilitate the discussion, let and denote the average and difference values, respectively. DWT can be perform on an array of values as follow: (a) Find of two concequtive numbers and store them as = 1, 2, . Extract the 1 st number of each pair, and store them as . Note that the size and will be half of that of . (b) Let = , and let = [, ]. (c) If B contains more than one element (number), return to step (a) by assigning . Otherwise return B (this is the base case). t

Upload: azri-mohd-khanil

Post on 04-Sep-2015

240 views

Category:

Documents


1 download

DESCRIPTION

test

TRANSCRIPT

  • WXES1115/WXES1117 Data Structure Assignment Sem. 2, 2014/15

    Page 1 of 2

    Group Project 1 Part 2 / 2 Instructions: Answer all questions and all parts. Submit via Spectrum. Due on Monday of 20 April 2015 by 23:59:59 (UTC+08:00). Up to 3 students per group (solo allowed), for the same group as in Part 1 of Project 1. [Question 1] Table 1 from Part 1 of Project 1 is copied below for quick reference purpose.

    Table 1. The first few values captured by virtual queue decomposition

    It is mathematically proven that the following 2D recurrence relation governs the values: , = 1, + , 1 Now, answer the following questions:

    (a) By studying the values in Table 1, what data type should (, ) be and explain why? (b) By using recursive method, implement the abovementioned relation. (c) Test your method by using (5,5), (10, 10), and (14,14). (d) Using Table 1, trace the intermediate results when computing (3,2).

    [Question 2] Discrete Wavelet Transformation (DWT) is a powerful signal processing method for de-correlating signal samples. Among all wavelet functions, Haar wavelet is the simplest one. To facilitate the discussion, let and denote the average and difference values, respectively. DWT can be perform on an array of values as follow:

    (a) Find of two concequtive numbers and store them as = 1, 2, . Extract the 1st number of each pair, and store them as . Note that the size and will be half of that of .

    (b) Let = , and let = [,]. (c) If B contains more than one element (number), return to step (a) by assigning .

    Otherwise return B (this is the base case).

    t

  • WXES1115/WXES1117 Data Structure Assignment Sem. 2, 2014/15

    Page 2 of 2

    As an example, consider = 60, 52, 59, 8, 28, 53, 19, 24 as the input array with eight numbers, and the 1st iteration yield the following intermediate results:

    = 56, 33.5, 40.5, 21.5 = 60, 59, 28, 19 , = 4, 25.5,12.5,2.5 = , = 56, 33.5, 40.5, 21.5, 4, 25.5,12.5,2.5 To continue with the next iteration, = 56, 33.5, 40.5, 21.5 . The resulting Haar wavelet coefficients (after 4 iterations) are given as follows in Table II:

    Table 2

    *** Here is what you need to do for this assignment *** Implement the method called compDWT recursively that takes an array of floating point values with length 2!, for = 1,2,. Your main method should read the array of values from the input file called dwtsample, which consists of one line of numbers only, compute the discrete wavelet transformation for the input array of values, then print the output coefficient values. Samples will be provided online at Spectrum. Hint / advise:

    (a) Ask yourself Should we perform the operations (i.e., finding average and difference) before or after splitting the problem into a smaller one (recursive part)?

    (b) This problem can be solve without reducing the size of the array

    End of Part 2 Group Project 1