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
Get step-by-step solutions from verified subject matter experts
