data_structures.linked_list.has_loop ==================================== .. py:module:: data_structures.linked_list.has_loop Attributes ---------- .. autoapisummary:: data_structures.linked_list.has_loop.root_node Exceptions ---------- .. autoapisummary:: data_structures.linked_list.has_loop.ContainsLoopError Classes ------- .. autoapisummary:: data_structures.linked_list.has_loop.Node Module Contents --------------- .. py:exception:: ContainsLoopError Bases: :py:obj:`Exception` Common base class for all non-exit exceptions. .. py:class:: Node(data: Any) .. py:method:: __iter__() .. py:attribute:: data :type: Any .. py:property:: has_loop :type: bool A loop is when the exact same Node appears more than once in a linked list. >>> root_node = Node(1) >>> root_node.next_node = Node(2) >>> root_node.next_node.next_node = Node(3) >>> root_node.next_node.next_node.next_node = Node(4) >>> root_node.has_loop False >>> root_node.next_node.next_node.next_node = root_node.next_node >>> root_node.has_loop True .. py:attribute:: next_node :type: Node | None :value: None .. py:data:: root_node