Answered step by step
Verified Expert Solution
Question
1 Approved Answer
NEEEEDDDDDDDDD WITHIN 1 0 MINUTES PLEASEEEEEEE!!!!!!!!!!!The file List linked.py . contains the linked implementation of the List ADT. For the List _ linked library complete
NEEEEDDDDDDDDD WITHIN MINUTES PLEASEEEEEEE!!!!!!!!!!!The file List linked.py contains the linked implementation of the List ADT. For the Listlinked library complete the implementation of and test the following methods with both integer and Food data. Use the same tests you used for the earlier Lists lab: prepend, append, and insert Hint: prepend and append are much simpler than insert, and you are allowed to call prepend and append from within insert if you wish. linearsearch Note tha his linear search returns more results than tharraybased linear search, which returns only an integer index. First, we can do this because the linear search is a private helper method. Because it is never supposed to be used outside the List class definition, we can tailor it to suit an arraybased or a linked implementation as required. Second, it returns three values because when we find a particular node in the linked list, we may need to know what comes before this node and how many nodes we visited. We can ignore the results we don't need. See the definition of the remove method. Hint: the linked linear search is used in many other methods, just as it was in the arraybased implementation count, max, and min find, index, and peek and remove and tis Listlinked.py the number values yourcodehere return defprependvalue: Adds a copy of value to the front of the List. Use: ist.prependvalue Parameters: value a data element. Returns: None # your code herd return def appendself value: Adds a copy of value to the end of the list. Use: Ist.appendvalue Parameters: value a data element Returns: None # your code here return def insertself i value: A copy of value is added to index following values are pusi If i outside of range of len list to lenlist the vali prepended or appended as appropriate. Use: lstinserti value Parameters: index value int value a data element Returns: None # your code here return def ninearsearchself key: The file List linked.py contains the linked implementation of the List ADT. For the Listlinked library complete the implementation of and test the following methods with both integer and Food data. Use the same tests you used for the earlier Lists lab: prepend, append, and insert Hint: prepend and append are much simpler than insert, and you are allowed to call prepend and append from within insert if you wish. linearsearch Note the his linear search returns more results than tharraybased linear search, which returns only an integer index. First, we can do this because the linear search is a private helper method. Because it is never supposed to be used outside the List class definition, we can tailor it to suit an arraybased or a linked implementation as required. Second, it returns three values because when we find a particular node in the linked list, we may need to know what comes before this node and how many nodes we visited. We can ignore the results we don't need. See the definition of the remove method. Hint: the linked linear search is used in many other methods, just as it was in the arraybased implementation count, max, and min find, index, and peek and remove and
NEEEEDDDDDDDDD
WITHIN MINUTES PLEASEEEEEEE!!!!!!!!!!!The file List
linked.py contains the linked implementation of the List ADT.
For the Listlinked library complete the implementation of and test the following methods with both integer and Food data. Use the same tests you used for the earlier Lists lab:
prepend, append, and insert
Hint: prepend and append are much simpler than insert, and you are allowed to call prepend and append from within insert if you wish.
linearsearch
Note tha his linear search returns more results than tharraybased linear search, which returns only an integer index. First, we can do this because the linear search is a private helper method. Because it is never supposed to be used outside the List class definition, we can tailor it to suit an arraybased or a linked implementation as required. Second, it returns three values because when we find a particular node in the linked list, we may need to know what comes before this node and how many nodes we visited. We can ignore the results we don't need. See the definition of the remove method.
Hint: the linked linear search is used in many other methods, just as it was in the arraybased implementation
count, max, and min
find, index, and
peek and remove
and
tis
Listlinked.py
the number values
yourcodehere
return
defprependvalue:
Adds a copy of value to the front of the List. Use: ist.prependvalue
Parameters:
value a data element.
Returns:
None
# your code herd
return
def appendself value:
Adds a copy of value to the end of the list.
Use: Ist.appendvalue
Parameters:
value a data element
Returns:
None
# your code here
return
def insertself i value:
A copy of value is added to index following values are pusi If i outside of range of len list to lenlist the vali prepended or appended as appropriate.
Use: lstinserti value
Parameters:
index value int
value a data element
Returns:
None
# your code here
return
def ninearsearchself key:
The file List
linked.py contains the linked implementation of the List ADT.
For the Listlinked library complete the implementation of and test the following methods with both integer and Food data. Use the same tests you used for the earlier Lists lab:
prepend, append, and insert
Hint: prepend and append are much simpler than insert, and you are allowed to call prepend and append from within insert if you wish.
linearsearch
Note the his linear search returns more results than tharraybased linear search, which returns only an integer index. First, we can do this because the linear search is a private helper method. Because it is never supposed to be used outside the List class definition, we can tailor it to suit an arraybased or a linked implementation as required. Second, it returns three values because when we find a particular node in the linked list, we may need to know what comes before this node and how many nodes we visited. We can ignore the results we don't need. See the definition of the remove method.
Hint: the linked linear search is used in many other methods, just as it was in the arraybased implementation
count, max, and min
find, index, and
peek and remove
and
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