Ejemplo n.º 1
0
    def add_front(self, item):
        '''
        item -> any type: data to add to the front of the deque

        Adds an item to the front of the deque. This functionality
        is the same as the add() method defined in the LinkedList class.

        Examples:
            - add_front(-6.7): 1 -> True ===> -6.7 -> 1 -> True
            - add_front(5): Empty Deque ===> 5
        '''

        LinkedList.add(self, item)
Ejemplo n.º 2
0
    def push(self, item):
        '''
        item -> any type: data to add to the front of the stack
        return -> nothing

        Adds an item to the front of the stack. This functionality is
        the same as the add() method defined in the LinkedList class.

        Examples:
            - push(5): 2 -> 3 -> True ===> 5 -> 2 -> 3 -> True
            - push(-5.6): Empty Stack ===> -5.6
            - push(2.3): 4 ===> 2.3 -> 4
        '''

        LinkedList.add(self, item)