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
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