MCPcopy Create free account

hub / github.com/TheAlgorithms/Python / functions

Functions3,909 in github.com/TheAlgorithms/Python

↓ 1 callersFunctionmain
()
divide_and_conquer/inversions.py:121
↓ 1 callersFunctionmain
()
divide_and_conquer/convex_hull.py:480
↓ 1 callersFunctionmain
Print octal equivalents of decimal numbers.
conversions/decimal_to_octal.py:27
↓ 1 callersFunctionmain
()
backtracking/minimax.py:81
↓ 1 callersFunctionmain
()
backtracking/combination_sum.py:68
↓ 1 callersFunctionmain
Demonstrate the usage of the SuffixTree class. - Initializes a SuffixTree with a predefined text. - Defines a list of patterns to search
data_structures/suffix_tree/example/example_usage.py:12
↓ 1 callersFunctionmain
>>> pytests()
data_structures/linked_list/skip_list.py:426
↓ 1 callersFunctionmain
()
data_structures/linked_list/singly_linked_list.py:494
↓ 1 callersFunctionmain
Demonstrates the use of KD-Tree by building it from random points in a 10-dimensional hypercube and performing a nearest neighbor search.
data_structures/kd_tree/example/example_usage.py:16
↓ 1 callersFunctionmain
r""" Mirror binary trees with the given root and returns the root >>> tree = make_tree_nine() >>> tuple(tree) (7, 4, 8, 2, 5, 9, 1, 3
data_structures/binary_tree/mirror_binary_tree.py:114
↓ 1 callersFunctionmain
()
data_structures/binary_tree/lowest_common_ancestor.py:139
↓ 1 callersFunctionmain
()
data_structures/binary_tree/binary_tree_traversals.py:185
↓ 1 callersFunctionmain
()
data_structures/binary_tree/inorder_tree_traversal_2022.py:71
↓ 1 callersFunctionmain
>>> pytests()
data_structures/binary_tree/red_black_tree.py:698
↓ 1 callersFunctionmain
After each command, program prints treap
data_structures/binary_tree/treap.py:158
↓ 1 callersFunctionmain
>>> pytests()
data_structures/trie/radix_tree.py:215
↓ 1 callersFunctionmain
>>> pytests()
data_structures/trie/trie.py:119
↓ 1 callersFunctionmain
()
other/password.py:83
↓ 1 callersFunctionmain
starting point or function of script
other/guess_the_number_search.py:154
↓ 1 callersFunctionmain
()
other/tower_of_hanoi.py:22
↓ 1 callersFunctionmain
()
other/nested_brackets.py:64
↓ 1 callersFunctionmain
()
matrix/nth_fibonacci_using_matrix_exponentiation.py:73
↓ 1 callersFunctionmain
()
matrix/searching_in_sorted_matrix.py:31
↓ 1 callersFunctionmain
()
matrix/matrix_operation.py:186
↓ 1 callersFunctionmain
()
ciphers/simple_substitution_cipher.py:7
↓ 1 callersFunctionmain
()
ciphers/elgamal_key_generator.py:59
↓ 1 callersFunctionmain
()
ciphers/a1z26.py:28
↓ 1 callersFunctionmain
()
ciphers/vigenere_cipher.py:4
↓ 1 callersFunctionmain
()
ciphers/beaufort_cipher.py:69
↓ 1 callersFunctionmain
Driver function to pass message to get encrypted, then decrypted. Example: >>> main() Decrypted message: HELLO WORLD
ciphers/permutation_cipher.py:124
↓ 1 callersFunctionmain
>>> s = "".join(MORSE_CODE_DICT) >>> decrypt(encrypt(s)) == s True
ciphers/morse_code.py:43
↓ 1 callersFunctionmain
()
ciphers/transposition_cipher_encrypt_decrypt_file.py:8
↓ 1 callersFunctionmain
Handles I/O :return: void
ciphers/simple_keyword_cypher.py:77
↓ 1 callersFunctionmain
()
ciphers/rsa_cipher.py:115
↓ 1 callersFunctionmain
()
ciphers/rsa_key_generator.py:10
↓ 1 callersFunctionmain
()
ciphers/transposition_cipher.py:11
↓ 1 callersFunctionmain
()
ciphers/rot13.py:23
↓ 1 callersFunctionmain
()
ciphers/brute_force_caesar_cipher.py:48
↓ 1 callersFunctionmain
()
ciphers/mono_alphabetic_ciphers.py:47
↓ 1 callersFunctionmain
()
ciphers/hill_cipher.py:193
↓ 1 callersFunctionmain
()
file_transfer/receive_file.py:4
↓ 1 callersFunctionmain
Size of matrix created from array [30, 35, 15, 5, 10, 20, 25] will be: 30*35 35*15 15*5 5*10 10*20 20*25
dynamic_programming/matrix_chain_order.py:51
↓ 1 callersFunctionmain
()
dynamic_programming/rod_cutting.py:200
↓ 1 callersFunctionmain
()
dynamic_programming/optimal_binary_search_tree.py:137
↓ 1 callersFunctionmain
()
dynamic_programming/fibonacci.py:27
↓ 1 callersFunctionmake_common_ground
()
graphs/multi_heuristic_astar.py:172
↓ 1 callersFunctionmake_dataset
()
maths/triplet_sum.py:14
↓ 1 callersMethodmake_decrypt_key
>>> hill_cipher = HillCipher(np.array([[2, 5], [1, 6]])) >>> hill_cipher.make_decrypt_key() array([[ 6, 25], [
ciphers/hill_cipher.py:145
↓ 1 callersFunctionmake_key_files
(name: str, key_size: int)
ciphers/elgamal_key_generator.py:40
↓ 1 callersFunctionmake_key_files
(name: str, key_size: int)
ciphers/rsa_key_generator.py:43
↓ 1 callersFunctionmake_linked_list
Creates a Linked List from the elements of the given sequence (list/tuple) and returns the head of the Linked List. >>> make_linked_list([])
data_structures/linked_list/print_reverse.py:88
↓ 1 callersFunctionmake_points
Generates points between a and b with step size h for trapezoidal integration. :param a: The lower bound of integration :param b: The up
maths/trapezoidal_rule.py:36
↓ 1 callersFunctionmake_points
(a, b, h)
maths/numerical_analysis/simpson_rule.py:61
↓ 1 callersFunctionmake_sepia
Function create sepia tone. Source: https://en.wikipedia.org/wiki/Sepia_(color)
digital_image_processing/sepia.py:8
↓ 1 callersFunctionmake_set
Make x as a set.
data_structures/disjoint_set/disjoint_set.py:14
↓ 1 callersMethodmake_set
(self, data: T)
graphs/minimum_spanning_tree_kruskal2.py:22
↓ 1 callersMethodmake_set
(self, item)
graphs/minimum_spanning_tree_boruvka.py:113
↓ 1 callersFunctionmake_tree
r""" The below tree 1 / \ 2 3 / \ 4 5
data_structures/binary_tree/binary_tree_traversals.py:16
↓ 1 callersFunctionmake_tree
()
data_structures/binary_tree/inorder_tree_traversal_2022.py:60
↓ 1 callersFunctionmake_tree_nine
r""" Return a binary tree with 9 nodes that looks like this: :: 1 / \ 2 3 / \ \ 4 5
data_structures/binary_tree/mirror_binary_tree.py:83
↓ 1 callersFunctionmake_tree_seven
r""" Return a binary tree with 7 nodes that looks like this: :: 1 / \ 2 3 / \ / \ 4 5 6
data_structures/binary_tree/mirror_binary_tree.py:56
↓ 1 callersMethodmatch_in_pattern
Finds the index of char in pattern in reverse order. Parameters : char (chr): character to be searched Returns
strings/boyer_moore_search.py:36
↓ 1 callersFunctionmatch_pattern
uses bottom-up dynamic programming solution for matching the input string with a given pattern. Runtime: O(len(input_string)*len(pattern
strings/wildcard_pattern_matching.py:10
↓ 1 callersFunctionmatrix_chain_order
>>> matrix_chain_order([10, 30, 5]) ([[0, 0, 0], [0, 0, 1500], [0, 0, 0]], [[0, 0, 0], [0, 0, 1], [0, 0, 0]])
dynamic_programming/matrix_chain_order.py:13
↓ 1 callersFunctionmatrix_concurrency
Calculate sample co-occurrence matrix based on input image as well as selected coordinates on image. Implementation is made using basic
computer_vision/haralick_descriptors.py:222
↓ 1 callersFunctionmatrix_exponentiation_time
()
maths/matrix_exponentiation.py:98
↓ 1 callersFunctionmatrix_multiply
>>> matrix_multiply(matrix_1_to_4, matrix_5_to_8) [[19, 22], [43, 50]]
matrix/matrix_multiplication_recursion.py:71
↓ 1 callersFunctionmatrix_multiply_recursive
:param matrix_a: A square Matrix. :param matrix_b: Another square Matrix with the same dimensions as matrix_a. :return: Result of matrix_
matrix/matrix_multiplication_recursion.py:82
↓ 1 callersFunctionmatrix_pow_np
Raises a matrix to the power of 'power' using binary exponentiation. Args: m: Matrix as a numpy array. power: The power to w
maths/fibonacci.py:238
↓ 1 callersFunctionmax_cross_sum
( arr: Sequence[float], low: int, mid: int, high: int )
divide_and_conquer/max_subarray.py:64
↓ 1 callersMethodmax_flow
(self, source, sink)
graphs/dinic.py:38
↓ 1 callersFunctionmax_profit
>>> max_profit([7, 1, 5, 3, 6, 4]) 5 >>> max_profit([7, 6, 4, 3, 1]) 0
greedy_methods/best_time_to_buy_and_sell_stock.py:18
↓ 1 callersFunctionmax_subarray
Solves the maximum subarray problem using divide and conquer. :param arr: the given array of numbers :param low: the start index
divide_and_conquer/max_subarray.py:19
↓ 1 callersFunctionmax_subarray_sum
Solves the maximum subarray sum problem using Kadane's algorithm. :param arr: the given array of numbers :param allow_empty_subarrays: if
dynamic_programming/max_subarray_sum.py:16
↓ 1 callersFunctionmax_subsequence_sum
Return the maximum possible sum amongst all non - empty subsequences. Raises: ValueError: when nums is empty. >>> max_subsequence_sum(
other/maximum_subsequence.py:4
↓ 1 callersFunctionmax_sum_in_array
Returns the maximum sum of k consecutive elements >>> arr = [1, 4, 2, 10, 2, 3, 1, 0, 20] >>> k = 4 >>> max_sum_in_array(arr, k)
maths/max_sum_sliding_window.py:13
↓ 1 callersMethodmax_value
Gets the max value supported by the given number system. >>> NumberingSystem.max_value("short") == 10**18 - 1 True >
conversions/convert_number_to_words.py:33
↓ 1 callersFunctionmaxpooling
This function is used to perform maxpooling on the input array of 2D matrix(image) Args: arr: numpy array size: size of pooli
computer_vision/pooling_functions.py:8
↓ 1 callersFunctionmean_absolute_error
Calculates the Mean Absolute Error (MAE) between ground truth (observed) and predicted values. MAE measures the absolute difference
machine_learning/loss_functions.py:366
↓ 1 callersFunctionmean_squared_error
Calculate the mean squared error (MSE) between ground truth and predicted values. MSE measures the squared difference between true values an
machine_learning/loss_functions.py:333
↓ 1 callersFunctionmean_threshold
image: is a grayscale PIL image object
computer_vision/mean_threshold.py:9
↓ 1 callersFunctionmedian_of_3
>>> array = [4, 2, 6, 8, 1, 7, 8, 22, 14, 56, 27, 79, 23, 45, 14, 12] >>> median_of_3(array, 0, ((len(array) - 0) // 2) + 1, len(array) - 1)
sorts/intro_sort.py:82
↓ 1 callersFunctionmedian_of_medians
Return a pivot to partition data on by calculating Median of medians of input data :param arr: The data to be checked (a list) :retur
searches/median_of_medians.py:31
↓ 1 callersFunctionmel_spaced_filterbank
Create a Mel-spaced filter bank for audio processing. Args: sample_rate: The sample rate of the audio. mel_filter_num: The n
machine_learning/mfcc.py:310
↓ 1 callersFunctionmel_to_freq
Convert a frequency in the mel scale to Hertz. Args: mels: The frequency in mel scale. Returns: The frequency in Hertz.
machine_learning/mfcc.py:292
↓ 1 callersMethodmembership
Calculate the membership value of an input 'x' in the fuzzy set. Returns: The membership value of 'x' in the fuzzy set.
fuzzy_logic/fuzzy_operations.py:112
↓ 1 callersFunctionmerge
>>> merge([[1, 6], [9, 10]], [[2, 3], [4, 5], [7, 8]]) [[1, 6], [2, 3], [4, 5], [7, 8], [9, 10]]
sorts/merge_insertion_sort.py:38
↓ 1 callersFunctionmerge
Merge two sorted lists into a single sorted list. :param left: Left collection :param right: Right collection :retur
sorts/merge_sort.py:32
↓ 1 callersFunctionmerge
Helper function for mergesort. >>> left_half = [-2] >>> right_half = [-1] >>> merge(left_half, right_half) [-2, -1] >>> left_hal
divide_and_conquer/mergesort.py:4
↓ 1 callersMethodmerge
(self, filenames, outfilename, buffer_size)
sorts/external_sort.py:93
↓ 1 callersMethodmerge_heaps
In-place merge of two binomial heaps. Both of them become the resulting merged heap
data_structures/heap/binomial_heap.py:131
↓ 1 callersFunctionmerge_insertion_sort
Pure implementation of merge-insertion sort algorithm in Python :param collection: some mutable ordered collection with heterogeneous compara
sorts/merge_insertion_sort.py:64
↓ 1 callersFunctionmerge_lists
>>> SSL = SortedLinkedList >>> merged = merge_lists(SSL(test_data_odd), SSL(test_data_even)) >>> len(merged) 16 >>> str(merged)
data_structures/linked_list/merge_two_lists.py:62
↓ 1 callersFunctionmerge_sort
Pure implementation of the fastest merge sort algorithm in Python :param collection: some mutable ordered collection with heterogeneous compa
sorts/unknown_sort.py:9
↓ 1 callersFunctionmerge_sort
Sorts a list using the merge sort algorithm. :param collection: A mutable ordered collection with comparable items. :return: The same co
sorts/merge_sort.py:13
↓ 1 callersFunctionmerge_two_binary_trees
Returns root node of the merged tree. >>> tree1 = Node(5) >>> tree1.left = Node(6) >>> tree1.right = Node(7) >>> tree1.left.left
data_structures/binary_tree/merge_two_binary_trees.py:23
↓ 1 callersFunctionmethod_2
Calculate the definite integral of a function using Simpson's Rule. :param boundary: A list containing the lower and upper bounds of integrat
maths/numerical_analysis/simpson_rule.py:12
↓ 1 callersFunctionmf_knapsack
This code involves the concept of memory functions. Here we solve the subproblems which are needed unlike the below example F is a 2D arr
dynamic_programming/knapsack.py:10
↓ 1 callersFunctionmfcc
Calculate Mel Frequency Cepstral Coefficients (MFCCs) from an audio signal. Args: audio: The input audio signal. sample_rate
machine_learning/mfcc.py:69
↓ 1 callersMethodmiddle_element
>>> link = LinkedList() >>> link.middle_element() No element found. >>> link.push(5) 5 >>> link.push(
data_structures/linked_list/middle_element_of_linked_list.py:20
← previousnext →1,601–1,700 of 3,909, ranked by callers