CN5005 – Data Structures and Algorithms

FIND A SOLUTION AT American Essay Writers

CN5005 – Data Structures and AlgorithmsDate: 14th Oct 2020Week 3 Lab (Linked Lists)Module Leader: Rawad HammadTotal Marks: 5 Marks (Continuous Assessment)Instructions: This lab is divided into the following two exercises: (i) required exercise that you need tosubmit via Moodle as part of your continuous assessment and (ii) practice exercise that you DO NOT needto 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 3lecture.
(2 Marks)
2. Allow the end user to initiate the Linked List by: (i) providing the number ofelements he/she wants to add to the linked list and (ii) providing the values of theseelements.Hint: For instance, you need to ask the user how many elements do you want to add tothe linked list? Ideally, the user should type 9 to accommodate the nine elements shownabove. 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/shewould 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 thelist 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 userselection.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

YOU MAY ALSO READ ...  Select a process you perform daily, but would like to spend less time doing,…
Best Essay Writers