2324 HK1 DSA QT2 01 N09T02 en

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

Ton Duc Thang University

Faculty of Information Technology

PROGRESS II – EXAM 1
Course: Data Structures & Algorithms
Group/Nest: N09T02
Duration: 45 minutes

I. Formation
- Students conduct the examination individually in computers of the laboratory.
- Submit your work following the instruction of the supervisor.
- For each task, students are provided base source code files, then programming in
these files.
- Students take your own responsibility for identifiers (class names, function names,
file names, etc.) and the structure of the project folder in case you modify them
differently from requirements.

II. Requirement
Create a folder named <Student ID> (for example, 522K0001)
Copy the provided source code folders to the <Student ID> folder above
Conduct the following requirements
After completion, students delete bytecode files (.class), compress the project folder as
<Student ID>.zip, and then submit following the instruction.
a) Question 1 (4.0 points)
<<interface>>
ListInterface

+ size(): int
+ max(): Node
+ getNode(k: int): Node

504008 – DSA nguyenthanhan@tdtu.edu.vn 1/3


Ton Duc Thang University
Faculty of Information Technology
Students implements designated methods in MyLinkedList.java
 size(): return the number of nodes. If the list is empty, then return 0.
 max(): return the node with the maximum key in the list. If the list is empty, then
return null.
 getNode(k): return the first node consisting of the given key k. If the list does not
contain the key, then return null.

Notes
- Do not perform inputting and printing the designated methods.
- Students can add the main method to test your work; however, if it causes any
compilation errors, then the whole question is scored 0.0 points.

b) Question 2 (3.0 points)


Students are allowed to use
java.util.Stack
java.util.Queue
java.util.LinkedList

Implement the method below in Question2.java


public static a reverse(int a)
to reverse a given positive integer using a Queue.
For example,
 a = 1234
 returned value: 4321

Notes
- Do not perform inputting and printing the designated methods.
- Students can add the main method to test your work; however, if it causes any
compilation errors, then the whole question is scored 0.0 points.

c) Question 3 (3.0 points)


Implement the recursive method below in Question3.java
public static int sumEvenDigits(int a)
504008 – DSA nguyenthanhan@tdtu.edu.vn 2/3
Ton Duc Thang University
Faculty of Information Technology
to compute the summation of even digits of a positive integer a.
For example,
 a = 2417
 returned value: 6 (2+4)

Notes
- Do not perform inputting and printing the designated methods.
- Students can add the main method to test your work; however, if it causes any
compilation errors, then the whole question is scored 0.0 points.

III. Policy
- Copying source code on the internet/from other students’, sharing your work
with the others, etc. cause 0.0 points for all related students.
- If there exist any signs of illegal copying or sharing of the assignment, then
extra interviews are conducted to verify your work.
-- END --

504008 – DSA nguyenthanhan@tdtu.edu.vn 3/3

You might also like