CN5005 – Data Structures and Algorithms Assessment Criteria PPP Grammar Lesson Table: First Conditional Markov Processes Impact …

FIND A SOLUTION AT Academic Writers Bay

CN5005 – Data Structures and Algorithms
Date: 14th Oct 2020
Week 3 Lab (Linked Lists)
Module Leader: Rawad Hammad
Total Marks: 5 Marks (Continuous Assessment)
Instructions: This lab is divided into the following two exercises: (i) required exercise that you need to
submit via Moodle as part of your continuous assessment and (ii) practice exercise that you DO NOT need
to submit, it is just for you to practice coding.
Required Exercise (Please submit on Moodle):
Suppose that you have a Singly Linked List (SLL) as follows:
8  7  11  4  9  2  14  1  5  Ø
Implement the following:
1. Develop the Linked List Structure according to the instructions provided in week 3
lecture.
(2 Marks)
2. Allow the end user to initiate the Linked List by: (i) providing the number of
elements he/she wants to add to the linked list and (ii) providing the values of these
elements.
Hint: For instance, you need to ask the user how many elements do you want to add to
the linked list? Ideally, the user should type 9 to accommodate the nine elements shown
above. Then use a loop to allow the user to provide these number one by one.
(2 Marks)
3. Write a method named PrintMe to print all elements in the linked lists.
(2 Marks)
4. Write a method to print a selected element from your list.
Hint: For instance, ask the user to provide you with the index of the element he/she
would like to print, then retrieve the element and print it on screen.
(2 Marks)
5. Write a method to delete one element from the list either from head or tail.
Hint: For instance, ask the user if the element to be deleted from the beginning of the
list or the end and pass his/her answer as a parameter for Delete Method.
(2 Marks)
Practice Exercise (Do not submit this on Moodle):
This section is for you to practice only, please don’t submit on Moodle.
1. Implement a method called “DeletionByKey” to delete any element from the linked list based on user
selection.
Hint: For instance, you need to ask the user to provide the key/index of the element to be deleted. Then,
access the node by the provided key/index and delete it.
Solution is provided on Moodle.
2. Is there any way to implement Linked Lists in Java in an easier way.
Solution is provided on Moodle.
3. Convert the above Singly Linked List to Circular Linked List.
Change the pointer of the tail, i.e., the last element, to refer to the head.
All the best,
Module Team

READ ALSO...   Audit Logs Assignment
Order from Academic Writers Bay
Best Custom Essay Writing Services

QUALITY: 100% ORIGINAL PAPERNO PLAGIARISM – CUSTOM PAPER