Beispiel #1
0
    def pop(self):
        '''
        return -> any type: first item in stack

        Removes the first item in the stack and returns it. The
        functionality is similar to the pop() method defined in the
        LinkedList class except an argument of zero is necessary.

        Examples:
            - pop(): 2 ===> 2 (returned value), Empty Stack (modified stack)
            - pop(): 5 -> True -> 6 ===> 5 (returned value), True -> 6 (modified stack)
        '''

        return LinkedList.pop(self, 0)
Beispiel #2
0
    def dequeue(self):
        '''
        return -> any type: first item in queue

        Removes and returns the first item in the queue. This
        functionality is similar to the pop() method defined
        in the LinkedList class except an argument of zero is
        necessary.

        Examples:
            - dequeue(): 6 -> 3 -> 5 ===> 3 -> 5
            - dequeue(): True -> 25 ===> 25
        '''

        return LinkedList.pop(self, 0)
Beispiel #3
0
    def remove_rear(self):
        '''
        return -> any type: last item in deque

        Removes the last item in the deque and returns it. The
        functionality is the same as the pop() method defind in
        the LinkedList class.

        Examples:
            - remove_rear(): 2 -> True -> False ===> False (returned value)
                             2 -> True (modifed Deque)
            - remove_rear(): True -> 3.4 ===> 3.4 (returned value)
                             3.4 (modified Deque)
        '''

        return LinkedList.pop(self)
Beispiel #4
0
    def remove_front(self):
        '''
        return -> any type: first item in deque

        Removes the first item in the Deque and returns it. The
        functionality is similar to the pop() method defined in
        the LinkedList class except an argument of 0 is required.

        Examples:
            - remove_front(): 5 -> 2 -> 3 ===> 5 (returned value)
                              2 -> 3 (modified Deque)
            - remove_front(): 2 ===> 2 (returned value)
                              Empty Deque (modified Deque)
        '''

        return LinkedList.pop(self, 0)