Question: Provided below are two classes: Node & LinkedList. The Node class is complete. The LinkedList class, consists of 7 functions. The search, size, is_empty and

Provided below are two classes: Node & LinkedList.

The Node class is complete.

The LinkedList class, consists of 7 functions.

The search, size, is_empty and count functions have already been completed and are correct.

The add and remove functions need to be modified so they give the required output for the test code.

While, the remove_duplicate function need to be completed from scratch.

Below is all the code and the test code w/ required results you will need to modify the add and remove functions and complete the remove_duplicate function.

Node Class:

Provided below are two classes: Node & LinkedList. The Node class is

LinkedList Class: (the add and remove functions)

complete. The LinkedList class, consists of 7 functions. The search, size, is_empty

LinkedList Class (The remaining functins that are correct and the remove_duplicate function which needs to be completed)

and count functions have already been completed and are correct. The add

Below are the test codes and desired results for three functions (Got results are based on what the code is at the moment)

add:

Define the add function for a linked list. This should add a new node with the parameter as its value to the start of the linked list.

and remove functions need to be modified so they give the required

remove:

Define the remove function for a linked list. This should remove only the first occurrence of a node with the parameter value.

output for the test code. While, the remove_duplicate function need to be

remove_duplicate:

Define the remove_duplicate function for a linked list. This should remove all nodes with the value, except for the first one found in the list.

completed from scratch. Below is all the code and the test code

class Node: def __init__(self, new_value): self.next-node = None def get_value(self): return self.value def get_next_node(self) return self.next_node def set value( alue self.value = new.value def set_next_node(self, new_next): self. next-node = new-next

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!