Question
Part B: Implementing a Sorted Linked list The class declarations has been created in the a1.py starter file. The data member names are provided (but
Part B: Implementing a Sorted Linked list
The class declarations has been created in the a1.py starter file. The data member names are provided (but not initialized so code will not compile).
Aside from the class declaration you will find a functions called iter
You are allowed to add data members to both Node and Linked list. You are also allowed to rename your data members BUT, if you do this, you will need to alter the iter function to match your new data member names.
A sorted linked list is a linked list where values stay sorted from smallest to biggest. That is the smallest value is at the front of the list while the largest is in the back.
When a doubly linked sorted list is first created it is empty.
The sorted list has the following member functions
def insert(self,data)
this function inserts data into the list such that the list stays sorted. You may assume that the data being added can be compared using comparison operators
def remove(self,data)
this function finds and removes node containing data from the list. If a node containing data was found and removed, function returns True. If no such node was found (data was not in list), function returns False
insert(30); front_ back_
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started