Functionmerge_sortReturns a list of sorted array elements using merge sort. >>> from random import shuffle >>> array = [-2, 3, -10, 11, 99, 100000, 100, -200]
divide_and_conquer/mergesort.py:60
Functionmincost_tickets >>> mincost_tickets([1, 4, 6, 7, 8, 20], [2, 7, 15]) 11 >>> mincost_tickets([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 30, 31], [2, 7, 15]) 17
dynamic_programming/minimum_tickets_cost.py:28
Functionmse Examples(rounded for precision): >>> actual = [1,2,3];predict = [1,4,3] >>> float(np.around(mse(predict,actual),decimals = 2)) 1.33
machine_learning/scoring_functions.py:40
Functionn_input_and_gate Calculate AND of a list of input values >>> n_input_and_gate([1, 0, 1, 1, 0]) 0 >>> n_input_and_gate([1, 1, 1, 1, 1]) 1
boolean_algebra/and_gate.py:35
Functionnor_gate >>> nor_gate(0, 0) 1 >>> nor_gate(0, 1) 0 >>> nor_gate(1, 0) 0 >>> nor_gate(1, 1) 0 >>> nor_gate(0.0, 0.0) 1
boolean_algebra/nor_gate.py:19
Functionoe_process(
position,
value,
l_send,
r_send,
lr_cv,
rr_cv,
result_pipe,
multiprocessing_
sorts/odd_even_transposition_parallel.py:32
Functionohms_law Apply Ohm's Law, on any two given electrical values, which can be voltage, current, and resistance, and then in a Python dict return name/val
electronics/ohms_law.py:5
Functionpairs_with_sum Return the no. of pairs with sum "sum" >>> pairs_with_sum([1, 5, 7, 1], 6) 2 >>> pairs_with_sum([1, 1, 1, 1, 1, 1, 1, 1], 2) 28
data_structures/arrays/pairs_with_given_sum.py:13
Methodparent_index returns the parent index based on the given child index >>> h = Heap() >>> h.build_max_heap([103, 9, 1, 7, 11, 15, 25, 201,
data_structures/heap/heap.py:55
Functionpeak Return the peak value of `lst`. >>> peak([1, 2, 3, 4, 5, 4, 3, 2, 1]) 5 >>> peak([1, 10, 9, 8, 7, 6, 5, 4]) 10 >>> peak([1, 9
divide_and_conquer/peak.py:14
Functionpermute_recursive Return all permutations. >>> permute_recursive([1, 2, 3]) [[3, 2, 1], [2, 3, 1], [1, 3, 2], [3, 1, 2], [2, 1, 3], [1, 2, 3]]
data_structures/arrays/permutations.py:1
Functionprefix_sum >>> prefix_sum([1, 4, 6, 2, 61, 12], [(2, 5), (1, 5), (3, 4)]) [81, 85, 63] >>> prefix_sum([4, 2, 1, 6, 3], [(3, 4), (1, 3), (0, 2)])
dynamic_programming/range_sum_query.py:64
Functionpresent_value >>> present_value(0.13, [10, 20.70, -293, 297]) 4.69 >>> present_value(0.07, [-109129.39, 30923.23, 15098.93, 29734,39]) -42739.63
financial/present_value.py:12