Skip to main content

TailedLinkedList.add_back

Adds an item to the back of the Linked List

Usage

addBack(item:Any)

Parameters:
      item : element
            The new element will be added to the back of the Linked List.

Returns:
      TailedLinkedList
            Returns the same Linked List containing the newly added item.

Example

from jellybeans.structures import TailedLinkedListLL1 = TailedLinkedList()LL1.add_back(4).add_back(3).add_back(2).add_back(1)print(LL1) # 4 => 3 => 2 => 1LL2 = TailedLinkedList([5, 6, 7])LL2.add_back(109)print(LL2) # 5 => 6 => 7 => 109