Answered step by step
Verified Expert Solution
Question
1 Approved Answer
here is the zip file http://www.cs.uni.edu/~fienup/cs1520s19/homework/ Word Pro -hw3.lwp 1/2 To start the homework: Download and extract the file hw3.zip from The hw3.zip file contains:
here is the zip file http://www.cs.uni.edu/~fienup/cs1520s19/homework/
Word Pro -hw3.lwp 1/2 To start the homework: Download and extract the file hw3.zip from The hw3.zip file contains: the Node class (in the node.py module) and the Node2Way class (in the node2way-py module) the skeleton CursorBasedList class (in the cursor based list.py module) which you will complete the cursorBasedListTester.py file that you can use to interactively test your CursorBasedist class. Part A: Recall that in a cursor-hase list a cursor (indicating the current item) can he moved around the list with the cursor being used to identify the region of the list to be manipulated. We will insert and removing items relative to the current item. A current item must always he defined as long as the list is not e rations Description of operation L.getCurrent() L.hasNext () L.next() Precondition: the list is not empty. Returns the current item without removing it or changing the current Precondition: the ist is not empty. Retums True if the current item has a next item; otherwise return False Precondition: hasNext returns True. Postcondition: The current item has moved nght one item Precondition: the list is not empty. Returns True if the current item has a asPrevious( T.-previous) Precondition: hasPrevious retums True. Postcondition: The current item has moved left one item Precondition: the list is not empty, Makes the first item the current item. .1asto L.insertAfteritem) Inserts item after the current item, or as the only item if the list is empty. The Makes the last item the current item. new item is the current item. insert etore(item) Inserts item hefore the current item, or as the only item if the list is empty. The ncw itcm is the current itcm .replace (newValue Precondition: the list is not L.remove) the current item by the new Value. Precondition: the list is not empty. Removes and returns the current item Making the next item the current item if one exists; otherwise the tail item in the list is the current item unless the list in now The cursor_based list.py file contains a skeleton CursorBasedList class. You MUST uses a doubly-linked list implementation with a header node and a trailer node. All "real list items will be inserted between the header and trailer nodes to reduce the number of "special cases (e.g., inserting first iem in an empty list, deleting the last item from the list, etc.). An empty doubly-linked list implementation with a header node and a trailer nude looks like: Header Node" Trailer Node ous data next previous data next trailer Word Pro -hw3.lwp 1/2 To start the homework: Download and extract the file hw3.zip from The hw3.zip file contains: the Node class (in the node.py module) and the Node2Way class (in the node2way-py module) the skeleton CursorBasedList class (in the cursor based list.py module) which you will complete the cursorBasedListTester.py file that you can use to interactively test your CursorBasedist class. Part A: Recall that in a cursor-hase list a cursor (indicating the current item) can he moved around the list with the cursor being used to identify the region of the list to be manipulated. We will insert and removing items relative to the current item. A current item must always he defined as long as the list is not e rations Description of operation L.getCurrent() L.hasNext () L.next() Precondition: the list is not empty. Returns the current item without removing it or changing the current Precondition: the ist is not empty. Retums True if the current item has a next item; otherwise return False Precondition: hasNext returns True. Postcondition: The current item has moved nght one item Precondition: the list is not empty. Returns True if the current item has a asPrevious( T.-previous) Precondition: hasPrevious retums True. Postcondition: The current item has moved left one item Precondition: the list is not empty, Makes the first item the current item. .1asto L.insertAfteritem) Inserts item after the current item, or as the only item if the list is empty. The Makes the last item the current item. new item is the current item. insert etore(item) Inserts item hefore the current item, or as the only item if the list is empty. The ncw itcm is the current itcm .replace (newValue Precondition: the list is not L.remove) the current item by the new Value. Precondition: the list is not empty. Removes and returns the current item Making the next item the current item if one exists; otherwise the tail item in the list is the current item unless the list in now The cursor_based list.py file contains a skeleton CursorBasedList class. You MUST uses a doubly-linked list implementation with a header node and a trailer node. All "real list items will be inserted between the header and trailer nodes to reduce the number of "special cases (e.g., inserting first iem in an empty list, deleting the last item from the list, etc.). An empty doubly-linked list implementation with a header node and a trailer nude looks like: Header Node" Trailer Node ous data next previous data next trailer
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