MCPcopy Create free account

hub / github.com/TheAlgorithms/Python / functions

Functions3,909 in github.com/TheAlgorithms/Python

Method__init__
Initializes a cipher object with a passcode as it's entity Note: No new passcode is generated if user provides a passcode whi
ciphers/shuffled_shift_cipher.py:31
Method__init__
Initialize hand. Hand should of type str and should contain only five cards each separated by a space. The cards sho
project_euler/problem_054/sol1.py:105
Method__init__
(self, vertices: set[int], edges: Mapping[EdgeT, int])
project_euler/problem_107/sol1.py:44
Method__init__
(self, order: int)
audio_filters/iir_filter.py:26
Method__init__
(self, task_performed, total)
dynamic_programming/bitmask.py:16
Method__init__
(self, n=0)
dynamic_programming/floyd_warshall.py:5
Method__init__
(self)
dynamic_programming/edit_distance.py:21
Method__init__
(self, key, freq)
dynamic_programming/optimal_binary_search_tree.py:26
Method__init__
(self)
dynamic_programming/fibonacci.py:8
Method__iter__
(self)
sorts/tree_sort.py:19
Method__iter__
>>> tuple(Index2DArrayIterator([[5], [-523], [-1], [34], [0]])) (5, -523, -1, 34, 0) >>> tuple(Index2DArrayIterator([[5, -523
data_structures/arrays/index_2d_array_in_1d.py:31
Method__iter__
(self)
data_structures/queues/linked_queue.py:49
Method__iter__
>>> our_deque = Deque([1, 2, 3]) >>> iterator = iter(our_deque)
data_structures/queues/double_ended_queue.py:63
Method__iter__
Implements iteration. Time complexity: O(1) >>> our_deque = Deque([1, 2, 3]) >>> for v in our_deque: ...
data_structures/queues/double_ended_queue.py:419
Method__iter__
(self)
data_structures/linked_list/has_loop.py:15
Method__iter__
>>> tuple(SortedLinkedList(test_data_odd)) == tuple(sorted(test_data_odd)) True >>> tuple(SortedLinkedList(test_data_even)) =
data_structures/linked_list/merge_two_lists.py:26
Method__iter__
Iterate through all nodes in the Circular Linked List yielding their data. Yields: The data of each node in the linked li
data_structures/linked_list/circular_linked_list.py:19
Method__iter__
>>> linked_list = LinkedList() >>> list(linked_list) [] >>> linked_list.push(0) >>> tuple(linked_list)
data_structures/linked_list/swap_nodes.py:18
Method__iter__
(self)
data_structures/linked_list/doubly_linked_list_two.py:32
Method__iter__
(self)
data_structures/linked_list/doubly_linked_list_two.py:65
Method__iter__
(self)
data_structures/linked_list/skip_list.py:109
Method__iter__
>>> linked_list = DoublyLinkedList() >>> linked_list.insert_at_head('b') >>> linked_list.insert_at_head('a') >>> link
data_structures/linked_list/doubly_linked_list.py:21
Method__iter__
>>> ints = [] >>> list(LinkedList(ints)) == ints True >>> ints = tuple(range(5)) >>> tuple(LinkedList(ints))
data_structures/linked_list/reverse_k_group.py:19
Method__iter__
Iterates through the linked list. Returns: Iterator: An iterator over the linked list. Examples: >>> li
data_structures/linked_list/floyds_cycle_detection.py:36
Method__iter__
This function is intended for iterators to access and iterate through data inside linked list. >>> linked_list = LinkedList()
data_structures/linked_list/singly_linked_list.py:50
Method__iter__
Iterate the LinkedList yielding each Node's data. >>> linked_list = LinkedList() >>> items = (1, 2, 3, 4, 5) >>> linked_list.e
data_structures/linked_list/print_reverse.py:27
Method__iter__
Returns sorted list containing all the values in the heap. >>> sh = SkewHeap([3, 1, 3, 7]) >>> list(sh) [1, 3, 3, 7]
data_structures/heap/skew_heap.py:141
Method__iter__
>>> root = Node(data=2.1) >>> list(root) [2.1] >>> root.left=Node(data=2.0) >>> list(root) [2.0, 2.1]
data_structures/binary_tree/is_sorted.py:29
Method__iter__
(self)
data_structures/binary_tree/mirror_binary_tree.py:23
Method__iter__
>>> root = Node(2) >>> list(root) [2] >>> root.left = Node(1) >>> tuple(root) (1, 2)
data_structures/binary_tree/is_sum_tree.py:19
Method__iter__
>>> list(BinaryTree.build_a_tree()) [1, 2, 7, 11, 15, 29, 35, 40]
data_structures/binary_tree/is_sum_tree.py:75
Method__iter__
(self)
data_structures/binary_tree/basic_binary_tree.py:13
Method__iter__
(self)
data_structures/binary_tree/basic_binary_tree.py:35
Method__iter__
(self)
data_structures/binary_tree/floor_and_ceiling.py:25
Method__iter__
>>> list(Node(0)) [0] >>> list(Node(0, Node(-1), Node(1), None)) [-1, 0, 1]
data_structures/binary_tree/binary_search_tree.py:106
Method__iter__
(self)
data_structures/binary_tree/binary_search_tree.py:136
Method__iter__
(self)
data_structures/binary_tree/binary_tree_node_sum.py:68
Method__iter__
Iterate through the tree in preorder. Returns: An iterator of the tree nodes. >>> list(TreeNode(1)) [1,
data_structures/binary_tree/serialize_deserialize_binary_tree.py:26
Method__iter__
(self)
data_structures/hashing/hash_map.py:314
Method__iter__
(self)
data_structures/stacks/stack_with_singly_linked_list.py:53
Method__le__
(self, other)
divide_and_conquer/convex_hull.py:74
Method__le__
(self, other)
project_euler/problem_054/sol1.py:347
Method__len__
(self)
sorts/tree_sort.py:26
Method__len__
returns the size of the vector
linear_algebra/src/lib.py:60
Method__len__
(self)
physics/n_body_simulation.py:133
Method__len__
(self)
graphs/minimum_spanning_tree_prims2.py:91
Method__len__
(self)
graphs/minimum_spanning_tree_prims2.py:203
Method__len__
(self)
graphs/minimum_spanning_tree_boruvka.py:110
Method__len__
>>> queue = LinkedQueue() >>> for i in range(1, 6): ... queue.put(i) >>> len(queue) 5 >>> for i i
data_structures/queues/linked_queue.py:55
Method__len__
>>> cq = CircularQueue(5) >>> len(cq) 0 >>> cq.enqueue("A") # doctest: +ELLIPSIS <data_structures.queues.cir
data_structures/queues/circular_queue.py:14
Method__len__
>>> len(QueueByTwoStacks()) 0 >>> from string import ascii_lowercase >>> len(QueueByTwoStacks(ascii_lowercase))
data_structures/queues/queue_by_two_stacks.py:19
Method__len__
>>> len(QueueByList()) 0 >>> from string import ascii_lowercase >>> len(QueueByList(ascii_lowercase)) 26
data_structures/queues/queue_by_list.py:18
Method__len__
Implements len() function. Returns the length of the deque. Time complexity: O(1) >>> our_deque = Deque([1, 2, 3]) >>
data_structures/queues/double_ended_queue.py:353
Method__len__
>>> for i in range(3): ... len(SortedLinkedList(range(i))) == i True True True >>> len(SortedLink
data_structures/linked_list/merge_two_lists.py:38
Method__len__
Get the length (number of nodes) in the Circular Linked List.
data_structures/linked_list/circular_linked_list.py:32
Method__len__
>>> linked_list = LinkedList() >>> len(linked_list) 0 >>> linked_list.push(0) >>> len(linked_list)
data_structures/linked_list/swap_nodes.py:32
Method__len__
>>> linked_list = LinkedList() >>> len(linked_list) 0 >>> linked_list.add("a") >>> len(linked_list) 1
data_structures/linked_list/__init__.py:115
Method__len__
>>> linked_list = DoublyLinkedList() >>> for i in range(0, 5): ... linked_list.insert_at_nth(i, i + 1) >>> len(li
data_structures/linked_list/doubly_linked_list.py:46
Method__len__
>>> for i in range(3): ... len(LinkedList(range(i))) == i True True True >>> len(LinkedList("abcd
data_structures/linked_list/reverse_k_group.py:33
Method__len__
Return length of linked list i.e. number of nodes >>> linked_list = LinkedList() >>> len(linked_list) 0 >>> l
data_structures/linked_list/singly_linked_list.py:69
Method__len__
Length of the array
data_structures/heap/max_heap.py:66
Method__len__
(self)
data_structures/binary_tree/mirror_binary_tree.py:30
Method__len__
>>> root = Node(2) >>> len(root) 1 >>> root.left = Node(1) >>> len(root) 2
data_structures/binary_tree/is_sum_tree.py:34
Method__len__
>>> len(BinaryTree.build_a_tree()) 8
data_structures/binary_tree/is_sum_tree.py:82
Method__len__
(self)
data_structures/binary_tree/basic_binary_tree.py:20
Method__len__
(self)
data_structures/binary_tree/basic_binary_tree.py:38
Method__len__
(self)
data_structures/binary_tree/floor_and_ceiling.py:32
Method__len__
Return the number of nodes in this tree.
data_structures/binary_tree/red_black_tree.py:455
Method__len__
Count the number of nodes in the tree. Returns: The number of nodes in the tree. >>> len(TreeNode(1)) 1
data_structures/binary_tree/serialize_deserialize_binary_tree.py:42
Method__len__
Returns the number of items present in hashmap >>> hm = HashMap(5) >>> hm._add_item(1, 10) >>> hm._add_item(2, 20)
data_structures/hashing/hash_map.py:297
Method__len__
>>> stack = LinkedStack() >>> len(stack) == 0 True >>> stack.push("c") >>> stack.push("b") >>>
data_structures/stacks/stack_with_singly_linked_list.py:70
Method__len__
(self)
data_structures/stacks/stack_with_doubly_linked_list.py:74
Method__len__
To print a clause as in Conjunctive Normal Form. >>> len(Clause([])) 0 >>> len(Clause(["A1", "A2'", "A3"]))
other/davis_putnam_logemann_loveland.py:50
Method__linear
Linear kernel (as if no kernel used at all)
machine_learning/support_vector_machines.py:81
Method__lt__
>>> WordCount('a', 1).__lt__(WordCount('b', 1)) False >>> WordCount('a', 1).__lt__(WordCount('a', 1)) False >
strings/top_k_frequent_words.py:45
Method__lt__
(self, other)
sorts/patience_sort.py:24
Method__lt__
(self, other: Any, /)
sorts/insertion_sort.py:21
Method__lt__
Compare two points for sorting (bottom-most, then left-most). >>> Point(1, 2) < Point(1, 3) True >>> Point(1, 2) < P
geometry/graham_scan.py:65
Method__lt__
(self, other: Any, /)
searches/jump_search.py:17
Method__lt__
(self, other)
graphs/greedy_best_first.py:83
Method__lt__
(self, other: Node)
graphs/bidirectional_a_star.py:74
Method__lt__
Comparison rule to < operator.
graphs/prim.py:30
Method__lt__
(self, other)
divide_and_conquer/convex_hull.py:64
Method__lt__
(self, other)
data_structures/heap/min_heap.py:13
Method__lt__
(self: T, other: T)
data_structures/heap/heap.py:10
Method__lt__
(self, other)
project_euler/problem_054/sol1.py:342
Method__matmul__
(self, other: Variable)
machine_learning/automatic_differentiation.py:101
Method__mul__
(self, other: Variable)
machine_learning/automatic_differentiation.py:83
Method__mul__
(self, other: float)
linear_algebra/src/lib.py:109
Method__mul__
(self, other: float)
linear_algebra/src/lib.py:320
Method__mul__
(self, other)
maths/dual_number_automatic_differentiation.py:48
Method__mul__
(self, b: Matrix)
maths/matrix_exponentiation.py:22
Method__mul__
Polynomial multiplication >>> p = Polynomial(2, [1, 2, 3]) >>> q = Polynomial(2, [1, 2, 3]) >>> p * q 9x^4 +
maths/polynomials/single_indeterminate_operations.py:73
Method__mul__
(self, other: Matrix | float)
matrix/matrix_class.py:318
Method__mul__
<method Matrix.__mul__> Return self * another. Example: >>> a = Matrix(2, 3, 1) >>> a[0,2] = a[1,2] = 3
matrix/sherman_morrison.py:149
Method__ne__
Checks if two polynomials are not equal. >>> p = Polynomial(2, [1, 2, 3]) >>> q = Polynomial(2, [1, 2, 3]) >>> p != q
maths/polynomials/single_indeterminate_operations.py:180
Method__ne__
(self, other)
divide_and_conquer/convex_hull.py:54
Method__ne__
(self, other: object)
matrix/matrix_class.py:292
Method__neg__
Polynomial negation >>> p = Polynomial(2, [1, 2, 3]) >>> -p - 3x^2 - 2x - 1
maths/polynomials/single_indeterminate_operations.py:64
Method__neg__
(self)
matrix/matrix_class.py:295
← previousnext →2,601–2,700 of 3,909, ranked by callers