PyDS.LinkedList package¶
Submodules¶
PyDS.LinkedList.DoublyLinkedList module¶
- class PyDS.LinkedList.DoublyLinkedList.DoublyLinkedList(head: Optional[DoublyNode] = None, tail: Optional[DoublyNode] = None, size: int = 0)¶
Bases:
object
- append(value: Any) None ¶
- head: Optional[PyDS.Node.DoublyNode] = None¶
- is_empty()¶
- prepend(value: Any) None ¶
- remove(target: Any) None ¶
- remove_end()¶
- remove_front() None ¶
- search(target: Any) int ¶
- size: int = 0¶
- tail: Optional[PyDS.Node.DoublyNode] = None¶
PyDS.LinkedList.LinkedList module¶
- class PyDS.LinkedList.LinkedList.LinkedList(head: Optional[PyDS.Node.Node] = None, tail: Optional[PyDS.Node.Node] = None, size: int = 0)¶
Bases:
object
Implementation of Singly Linked List
- Parameters
head (Optional[Node]) – A node at the front of list
tail – A node at the end of list
size (int) – The length of list
- append(value: Any) None ¶
Adds node to the end of list
- Parameters
value (Any) – A value
- get_at(index: int) Any ¶
Gets value at a certain index
- Parameters
index (int) – The index of the value you’re trying to get
- Returns
The value at certain index
- Return type
Any
- head: Optional[PyDS.Node.Node] = None¶
- is_empty() bool ¶
Checks to see if linked list is empty
- Returns
Whether or not list is empty
- Return type
bool
- prepend(value: Any) None ¶
Adds node to the front of list
- Parameters
value (Any) – A value
- remove(target: Any) None ¶
Removes node containing a certain value
- Parameters
target (Any) – The value you’re trying to delete
- remove_front() None ¶
Removes node at the front of list
- remove_last() None ¶
Removes node at end of list
- search(target: Any) int ¶
Searches value in list and retrieves its index
- Parameters
target (Any) – The value you need to find
- Returns
The index of value found, otherwise -1
- Return type
int
- size: int = 0¶
- tail: Optional[PyDS.Node.Node] = None¶