Instructions In this program, we will implement and test a Linked List class. Recall that the Linked List is an Abstract
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am
Instructions In this program, we will implement and test a Linked List class. Recall that the Linked List is an Abstract
InstructionsIn this program, we will implement and test a Linked List class.Recall that the Linked List is an AbstractData Type (or data structure, as more commonly known as) thatorganizes data linearly. The Linked Listis designed using the concept of Nodes, where nodes represent asingle unit of data in the list. EachLinked List has two primary components: the data it contains and areference (or pointer, depending onthe language) to the next node in the list. Linked Lists also havea reference to the first node, which iscalled the head, and sometimes the last node, which is thetail.In this lab, we will build an Unordered Linked List, which is aLinked List where the nodes have noparticular order. We will implement the following operations forthis Linked List:• getSize – returns the size(number of nodes) of the linkedlist.• prepend – adds a new node to the front of the linked list. Thisoperation moves thecurrent head node to the second position in the linked list andcreate a new node with thepassed in data as the first node. Increases the size counter aswell.• append – adds a new node to the back of the linked list. Thisoperation creates a new nodewith the passed in data and adds it to the end of the Linked List.Increases the size counteras well.• insert – adds a new node at a certain position in the LinkedList. Note that if the positionspecified does not exist in the linked list, the operation shouldfail and return false toindicate failure.