Answered step by step
Verified Expert Solution
Question
1 Approved Answer
CMPUT 175 - Lab 7: Linked Lists Goal: Learn about singly and doubly-linked lists, and learn to test your methods using assert statements rather than
CMPUT 175 - Lab 7: Linked Lists Goal: Learn about singly and doubly-linked lists, and learn to test your methods using assert statements rather than comparing to sample output. Exercise 1: In this task, you will complete the insert(pos, item) method for the singly-linked list. Recall that insert adds a new node (containing the item as its data) at the given position in the list. For example, if pos is 0, then the new node goes at the beginning (head) of the list. pos must be an integer, and for this exercise, cannot be negative. 1. Download and save SLinkedList.py from eClass. There are 2 classes in the file: the SLinkedListNode class, and the SLinkedList class. The SLinkedListNode class is already completed for you, based on the implementation in the lecture. The SLinkedList class is partially completed - you must complete the implementation of the insert method, and use the code in the main function to test it. Hints: . Think of the different cases you may encounter. What if you try to insert into a
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