Question: i'm supposed to rewrite the append method(the last method) to run in 0(1) time. i'm also supposed to update other methods in the class to

i'm supposed to rewrite the append method(the last method) to run in 0(1) time. i'm also supposed to update other methods in the class to make the tail point at the last node.
i'm supposed to rewrite the append method(the last method) to run in
0(1) time. i'm also supposed to update other methods in the class
to make the tail point at the last node. 8. (8 points)
Rewrite the append method to make it run in O(1) time. To

8. (8 points) Rewrite the append method to make it run in O(1) time. To do this - You will need to add the attribute tail to self. tail should always be pointing to the last node in the list. When a list is initialized the tail should be set to None. - Use the tail to append to the list by adding the new node after the tail and moving the tail over to the new node. 9. (8 points) Consider all the other methods in the class eg. add(), is empty() remove(), stri) etc. Update any that needs to be updated so that tail is always pointing to the last node on the list. 10. (8 points) Test your append method and any other method you updated in problem 9.5.how your expected results. Make sure you test appending to an empty list and to a list which contains some items. 11. (4 points) Read the section on OrderedLists. Describe in a comment at the END of your Aaraa code how and if the remove() method would be ditferent in a Ordered vs. Unordered list. 12. (+3 Extra): Have_str_return a string with the data separated by commas, except for the end

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!