Académique Documents
Professionnel Documents
Culture Documents
Unit Code & Title : H/601/1456– Unit 34 - Data Structures and Algorithms
Assessment Title & No’s : Understand and implement Data structures and Strings (No 1 of 1)
I hereby, declare that I know what plagiarism entails, namely to use another’s work and to present it
as my own without attributing the sources in the correct way. I further understand what it means to
copy another’s work.
A palindrome is a phrase that reads the same forwards as it does backwards. For example, “a man, a
plan, a canal, Panama,” is a palindrome.
1.1. Write a program that figures out whether one string is a palindrome. The program
should ignore white space and punctuation. (LO3.2)(D3.4)
For example:
1.2. Create an Example Stack class for this problem. Use LinkedList, ArrayList or an array to
implement the Stack.(LO 1.1)
1.3. Identify and implement opportunities for error handling and reporting. (LO 2.2)
1.4. Test the above application with a suitable test cases (LO 2.3)
1.5. Prepare a user manual for the developed solution to assist the users to work with it.(M3)
Task 2
London Met University provides apartments to undergraduate students. The housing system uses a
waiting list for apartment allocation. According to the university policy, when a possible match
between applicant and apartment is found, the applicant is contacted via email or phone call and
must decide whether to accept the apartment. If the applicant does not accept, he or she is placed
back of the waiting list, and must wait again.
We will simulate this process using a queue, and simplify the rules. Moreover, we will ignore the
realistic constraints of the applicants, and simply have each applicant store a quality threshold for
the apartment quality (a random number between 0 and 100). We will also assume that each
apartment, once accepted, will be occupied for a random number of school years between 1 and 3.
Assume k students apply for housing each school year. Each student node should contain an ID
number to keep track. Get k from the user via command line arguments.
Insert apartment details through the keyboard. Each apartment should have an ID number, quality
score (a random number between 0 and 100)
The assignment process should remove a student from the queue if the student “accepts” the
apartment (is the apartment’s quality value above the student’s threshold?). If the student accepts
then delete the student node. If the student rejects the apartment delete the student, insert him to
the back of the queue and compare next student and repeat. This process repeats until all students
are housed.
2.1. Write your own implementation of the queue by using a linked list for this problem with
all the queue operations (enque, deque,etc). (LO 1.1)
2.2. Test the above application with a suitable test cases (LO 2.3)
3.1 Implement Binary search using recursive algorithm and non-recursive algorithm, and
compare the performance. (LO 1.2) (LO 1.3)
3.2. Sort the array given below with two different algorithms and compare the performance.
{10, 30, 20, 45, 85, 90, 75}
(LO 1.2)
3.3. Explain common string operations such as concatenation, substring, trim etc., also state
their practical applications.(LO 3.1)
D3.4 problems have been solved. Task 1.1, Task 2.1, Task 3.1, Task 3.2
Comments:
Assessor Name :
Date :
Signature :