Beispiel #1
0
    def add_rear(self, item):
        '''
        item -> any type: data to add to the end of the deque

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

        Examples:
            - add_rear(5): 2 -> 3.5 ===> 2 -> 3.5 -> 5
            - add_rear(12): Empty Deque ===> 12
        '''

        LinkedList.append(self, item)
Beispiel #2
0
    def enqueue(self, item):
        '''
        item -> any type: data to add to the end of the queue
        return -> nothing

        Adds an item to the end of the queue. This functionality is
        the same as the append() method defined in the LinkedList class.

        Examples:
            - enqueue(5): 2 -> 3 ===> 2 -> 3 -> 5
            - enqueue(True): Empty Queue ===> True
            - enqueue(23.5): 2 ===> 2 -> 23.5
        '''

        LinkedList.append(self, item)