Write the code that creates a new Node class.  It will store data and next attributes. You only need to create the __init__ method.   data and next variables will have default values, both set to None. Assume you are using the Node class from the previous connection to create a LinkedList.  You have the code below, create a method that removes the first node from the LinkedList. class LinkedList:

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

It is python language

 

 

Write the code that creates a new Node class.  It will store data and next attributes. You only need to create the __init__ method.  

data and next variables will have default values, both set to None.

Assume you are using the Node class from the previous connection to create a LinkedList.  You have the code below, create a method that removes the first node from the LinkedList.

class LinkedList:

    def __init__(self):

        self.head = None

Based on the code from the last two questions, create a new LinkedList. Add 2 values to the LinkedList (there is an add method that accepts data as an argument, called add).  Then call the removeFront method created in the previous question.

Based on the previous questions, create a Queue class that uses the LinkedList for its data storage.  Create the __init__, isEmpty, insert, remove, and size methods. Assume that LinkedList class has the addremoveFront and size methods defined.

Based on the LinkedList code already created previous, write a function that will insert a new value into the middle of a Linked List.  

INPUT:              The head of the Linked List, the value to insert

OUTPUT:        Nothing is output

RETURNED:  Nothing is returned

Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY