Question: Python homework:how to write and test a _swap method for the linked Deque. def _swap(self, l, r): ------------------------------------------------------- Swaps two pointers. Use: self._swap(self, l,

Python homework:how to write and test a _swap method for the linked Deque.

def _swap(self, l, r):

""" -------------------------------------------------------

Swaps two pointers. Use: self._swap(self, l, r):

-------------------------------------------------------

Preconditions:

l - a pointer to a deque node (_DequeNode)

r - a pointer to a deque node (_DequeNode)

Postconditions: l has taken the place of r, r has taken the place of l _front and _rear are updated as appropriate

-------------------------------------------------------

"""

assert l is not None and r is not None, "nodes to swap cannot be None"

please give a thinking of this, I don;t know which method to use.

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!