Module dsa.generators

Functions

def linear_doubly_linked_list(size: int, min_val: int = 0, max_val=100) ‑> DoublyLinkedList

Generates a linear doubly linked list of integers. arguments: size – number of nodes in the list min_val – minimum value of the nodes
max_val – maximum value of the nodes returns: DoublyLinkedList

def linear_dynamic_queue(size: int, min_val: int = 0, max_val=100) ‑> DynamicQueue

Generates a linear dynamic queue of integers. arguments: size – number of elements in the queue min_val – minimum value of the elements max_val – maximum value of the elements returns: DynamicQueue

def linear_dynamic_stack(size: int, min_val: int = 0, max_val=100) ‑> DynamicStack

Generates a linear dynamic stack of integers. arguments: size – number of elements in the stack min_val – minimum value of the elements max_val – maximum value of the elements returns: DynamicStack

def linear_linked_list(size: int, min_val: int = 0, max_val=100) ‑> LinkedList

Generates a linear linked list of integers. arguments: size – number of elements in the linked list min_val – minimum value of the elements max_val – maximum value of the elements returns: LinkedList

def linear_queue(size: int, min_val: int = 0, max_val=100) ‑> Queue

Generates a linear queue of integers. arguments: size – number of elements in the queue min_val – minimum value of the elements max_val – maximum value of the elements returns: Queue

def linear_stack(size: int, min_val: int = 0, max_val=100) ‑> Stack

Generates a linear stack of integers. arguments: size – number of elements in the stack min_val – minimum value of the elements max_val – maximum value of the elements returns: Stack

def random_adjacency_list_graph(n, density=0.1, directed=False) ‑> AdjacencyListGraph
def random_adjacency_list_weighted_graph(n, density=0.1, directed=False) ‑> AdjacencyListWeightedGraph
def random_adjacency_matrix_graph(n, density=0.1, directed=False) ‑> AdjacencyMatrixGraph
def random_adjacency_matrix_weighted_graph(n, density=0.1, directed=False) ‑> AdjacencyMatrixWeightedGraph
def random_array(size: int, min_val: int = 0, max_val=100) ‑> Array

Generates a random array of integers. arguments: size – number of elements in the array min_val – minimum value of the elements max_val – maximum value of the elements returns: Array

def random_binary_tree(n: int) ‑> Tree

Generates a random binary tree. arguments: n – number of nodes in the tree returns: Tree

def random_binary_tree_node(n: int) ‑> TreeNode

Generates a random binary tree with exactly n nodes. arguments: n – number of nodes in the tree returns: TreeNode

def random_deque(size: int, min_val: int = 0, max_val=100) ‑> Deque

Generates a random deque of integers. arguments: size – number of elements in the deque min_val – minimum value of the elements max_val – maximum value of the elements returns: Deque

def random_doubly_linked_list(size: int, min_val: int = 0, max_val=100) ‑> DoublyLinkedList

Generates a random doubly linked list of integers. arguments: size – number of nodes in the list min_val – minimum value of the nodes max_val – maximum value of the nodes returns: DoublyLinkedList

def random_dynamic_queue(size: int, min_val: int = 0, max_val=100) ‑> DynamicQueue

Generates a random dynamic queue of integers. arguments: size – number of elements in the queue min_val – minimum value of the elements max_val – maximum value of the elements returns: DynamicQueue

def random_dynamic_stack(size: int, min_val: int = 0, max_val=100) ‑> DynamicStack

Generates a random dynamic stack of integers. arguments: size – number of elements in the stack min_val – minimum value of the elements max_val – maximum value of the elements returns: DynamicStack

def random_dynamicarray(size: int, min_val: int = 0, max_val=100) ‑> DynamicArray

Generates a random dynamic array of integers. arguments: size – number of elements in the array min_val – minimum value of the elements max_val – maximum value of the elements returns: DynamicArray

def random_heap(n: int) ‑> Heap

Generates a random heap. arguments: n – number of nodes in the heap returns: Heap

def random_linked_list(size: int, min_val: int = 0, max_val=100) ‑> LinkedList

Generates a random linked list of integers. arguments: size – number of elements in the linked list min_val – minimum value of the elements max_val – maximum value of the elements returns: LinkedList

def random_queue(size: int, min_val: int = 0, max_val=100) ‑> Queue

Generates a random queue of integers. arguments: size – number of elements in the queue min_val – minimum value of the elements max_val – maximum value of the elements returns: Queue

def random_stack(size: int, min_val: int = 0, max_val=100) ‑> Stack

Generates a random stack of integers. arguments: size – number of elements in the stack min_val – minimum value of the elements max_val – maximum value of the elements returns: Stack

def random_trie(n: int) ‑> Trie

Generates a random trie.

arguments: n – number of words in the trie returns: Trie