daily pastebin goal
3%
SHARE
TWEET

Untitled

a guest May 16th, 2018 98 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # Se encola un nuevo elemento.
  2.     def enqueue(self, value):
  3.         new_node = Queue._Node(value, None)
  4.         if self.is_empty():
  5.             self._front = self._back = new_node
  6.         else:
  7.             self._back.next = self._back = new_node
  8.  
  9.     # Se desencola un elemento.
  10.     def dequeue(self):
  11.         assert not self.is_empty(), 'No se puede hacer dequeue de una cola vacia.'
  12.         value, self._front = self._front
  13.         if self._front is None:
  14.             self._back = None
  15.         return value
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top