You are on page 1of 2

WXES1115/WXES1117 Data Structure Assignment

Group Project 1 Part 2 / 2


Name: Azri Bin Mohd Khanil
Matric No: WEK110006
[Question 1]
Table 1 from Part 1 of Project 1 is copied below for quick reference purpose.

(a) By studying the values in Table 1, what data type should (, ) be and explain
why?
Ans:
By Studying the value in table 1 it is sufficient to use int data type because
the int data type is a 32-bit signed two's complement integer, which has a
maximum value of 231-1. It can be used to represent an unsigned 32-bit integer,
which has a minimum value of 0 and a maximum value of

231 -1.

(b) By using recursive method, implement the abovementioned relation.


Ans:
refer source code.
(c) Test your method by using (5,5), (10, 10), and (14,14).
Ans:
refer source code.

(d) Using Table 1, trace the intermediate results when computing (3,2).

F(3,2) = F(3-1, 2) + F(3, 2-1)


=

F ( 2, 2 )+ F (3,1)

return 3

F( 2,2)

F ( 2-1, 2 ) +F( 2, 2-1), urn 1urce code . m value of 232is sufficient use data type
=

F (1, 2) + F(2, 1)

return
1

return
2

=1+2
=3+3
=6

[Question 2]
Ans:
Refer source code