MCPcopy Create free account

hub / github.com/TheAlgorithms/TypeScript / functions

Functions286 in github.com/TheAlgorithms/TypeScript

↓ 105 callersMethodpush
(data: T)
data_structures/list/linked_list.ts:7
↓ 38 callersMethodset
(key: K, value: V)
data_structures/map/map.ts:8
↓ 27 callersFunctiontest
(func: (n: number) => number)
maths/test/fibonacci.test.ts:7
↓ 24 callersMethodenqueue
(item: T)
data_structures/queue/queue.ts:2
↓ 19 callersFunctionadd_edge
( graph: [number, number][][], a: number, b: number, weight: number )
graph/test/johnson.test.ts:12
↓ 18 callersFunctionadd_edge
( graph: [number, number][][], a: number, b: number, weight: number )
graph/test/dijkstra.test.ts:12
↓ 18 callersFunctionadd_edge
( graph: [number, number][][], a: number, b: number, weight: number )
graph/test/bellman_ford.test.ts:12
↓ 18 callersMethodisEmpty
()
data_structures/queue/queue.ts:5
↓ 16 callersFunctiontarjan
(graph: number[][])
graph/tarjan.ts:11
↓ 15 callersFunctionkosajaru
(graph: number[][])
graph/kosajaru.ts:64
↓ 14 callersMethodpop
()
data_structures/list/linked_list.ts:8
↓ 13 callersMethodfind
* Searches for a word in the Trie. * * @param word - The word to search for. * @param isPrefixMatch - Indicates whether to perform a prefix m
data_structures/tries/tries.ts:49
↓ 13 callersMethodget
(index: number)
data_structures/list/linked_list.ts:6
↓ 12 callersMethodadd
(value: K)
data_structures/set/set.ts:6
↓ 10 callersFunctionQuickSelect
( array: number[], k: number, left: number = 0, right: number = array.length - 1 )
sorts/quick_select.ts:13
↓ 10 callersMethodget
(key: K)
data_structures/map/map.ts:9
↓ 10 callersMethodincreasePriority
(idx: number, value: T)
data_structures/heap/heap.ts:187
↓ 9 callersMethodinsert
(value: T)
data_structures/heap/heap.ts:173
↓ 9 callersMethodlength
()
data_structures/queue/queue.ts:6
↓ 8 callersFunctionbellmanFord
( graph: [number, number][][], start: number )
graph/bellman_ford.ts:12
↓ 8 callersFunctionisLeapYear
(year: number)
maths/is_leap_year.ts:12
↓ 8 callersFunctionjohnson
( graph: [number, number][][] )
graph/johnson.ts:14
↓ 7 callersMethodfind
* Find the representative index for an element
data_structures/disjoint_set/disjoint_set.ts:33
↓ 7 callersFunctiongetWeekday
( year: number, month: number, day: number, calendar: Calendar = Calendar.Gregorian )
maths/zellers_congruence.ts:17
↓ 7 callersFunctionlongestCommonSubsequence
( text1: string, text2: string )
dynamic_programming/lcs.ts:8
↓ 6 callersFunctionaddBinary
( firstBinaryNo: string, secondBinaryNo: string )
bit_manipulation/add_binary.ts:8
↓ 6 callersMethodappend
(data: T)
data_structures/list/linked_list.ts:9
↓ 6 callersFunctionbinaryConvert
(num: number)
maths/binary_convert.ts:11
↓ 6 callersFunctionbinaryLCM
(a: number, b: number)
maths/lowest_common_multiple.ts:42
↓ 6 callersMethodextract
()
data_structures/heap/heap.ts:178
↓ 6 callersFunctionfactorial
(num: number)
maths/factorial.ts:10
↓ 6 callersFunctioninit_graph
(N: number)
graph/test/johnson.test.ts:4
↓ 6 callersMethodinsert
* Inserts the given data into the binary search tree. * * @param data The data to be stored in the binary search tree. * @returns
data_structures/tree/binary_search_tree.ts:86
↓ 6 callersMethodjoin
* Join two sets
data_structures/disjoint_set/disjoint_set.ts:44
↓ 5 callersFunctionabsoluteValue
(number: number)
maths/absolute_value.ts:12
↓ 5 callersFunctioncalculateMean
(numbers: number[])
maths/calculate_mean.ts:11
↓ 5 callersFunctiondijkstra
( graph: [number, number][][], start: number )
graph/dijkstra.ts:13
↓ 5 callersFunctionedmondsKarp
( graph: [number, number][][], source: number, sink: number )
graph/edmonds_karp.ts:15
↓ 5 callersFunctionextract_all
(heap: MaxHeap<number>)
data_structures/heap/test/heap.test.ts:33
↓ 5 callersFunctionfloydWarshall
(graph: number[][])
graph/floyd_warshall.ts:11
↓ 5 callersFunctioninit_graph
(N: number)
graph/test/bellman_ford.test.ts:3
↓ 5 callersFunctionisBipartite
(graph: number[][])
graph/bipartite_graph.ts:33
↓ 5 callersMethodisSame
* Check whether two elements are in the same set
data_structures/disjoint_set/disjoint_set.ts:67
↓ 5 callersMethodlength
* @function length * @description - number of elements in the stack * @return {number} the number of elements in the stack
data_structures/stack/stack.ts:51
↓ 5 callersMethodpeek
()
data_structures/queue/queue.ts:4
↓ 5 callersFunctionperfectSquare
(num: number)
maths/perfect_square.ts:9
↓ 5 callersMethodtop
* @function top * @description - return the last element in the stack without removing it * @return {T | null} return the last element or null i
data_structures/stack/stack.ts:69
↓ 4 callersMethoddequeue
()
data_structures/queue/queue.ts:3
↓ 4 callersMethodhas
(key: K)
data_structures/map/map.ts:11
↓ 4 callersMethodhash
* Hashes a key to an index. * This implementation uses the djb2 algorithm, which might not be the best. * Feel free to change it to something el
data_structures/map/hash_map.ts:198
↓ 4 callersMethodisEmpty
* Checks, if the list is empty. * * @returns Whether the list is empty or not.
data_structures/list/singly_linked_list.ts:47
↓ 4 callersFunctionkruskal
( edges: Edge[], num_vertices: number )
graph/kruskal.ts:14
↓ 4 callersFunctionprim
(graph: [number, number][][])
graph/prim.ts:12
↓ 4 callersFunctiontest_graph
( expected_tree_edges: Edge[], other_edges: Edge[], num_vertices: number, expected_cost: number )
graph/test/kruskal.test.ts:3
↓ 3 callersFunctionHeapSort
(arr: number[])
sorts/heap_sort.ts:15
↓ 3 callersFunctionHexagonalNumbers
(n: number)
maths/series/hexagonal_numbers.ts:17
↓ 3 callersFunctionQuickSort
( array: number[], left: number = 0, right: number = array.length - 1 )
sorts/quick_sort.ts:61
↓ 3 callersFunctionbinaryGCF
(a: number, b: number)
maths/greatest_common_factor.ts:12
↓ 3 callersFunctionbubbleSort
(arr: number[])
sorts/bubble_sort.ts:20
↓ 3 callersFunctioncalculateMedian
(numbers: number[])
maths/calculate_median.ts:11
↓ 3 callersFunctioncycleSort
(array: number[])
sorts/cycle_sort.ts:10
↓ 3 callersFunctiondegreesToRadians
(degrees: number)
maths/degrees_to_radians.ts:9
↓ 3 callersFunctiongaussianElimination
(matrix: number[][])
maths/gaussian_elimination.ts:7
↓ 3 callersMethodgetLength
()
data_structures/list/linked_list.ts:15
↓ 3 callersFunctiongreatestCommonFactor
(nums: number[])
maths/greatest_common_factor.ts:23
↓ 3 callersFunctioninit_graph
(N: number)
graph/test/dijkstra.test.ts:4
↓ 3 callersFunctioninsertionSort
(arr: number[])
sorts/insertion_sort.ts:10
↓ 3 callersFunctionisDivisible
(num1: number, num2: number)
maths/is_divisible.ts:11
↓ 3 callersMethodisEmpty
()
data_structures/list/linked_list.ts:5
↓ 3 callersFunctionisPrime
(num: number)
maths/primes.ts:70
↓ 3 callersMethodkeys
()
data_structures/map/map.ts:13
↓ 3 callersFunctionlowestCommonMultiple
(nums: number[])
maths/lowest_common_multiple.ts:46
↓ 3 callersFunctionmatrixMultiplication
( matA: number[][], b: any )
maths/matrix_multiplication.ts:16
↓ 3 callersFunctionnaiveLCM
(nums: number[])
maths/lowest_common_multiple.ts:16
↓ 3 callersFunctionradiansToDegrees
(radians: number)
maths/radians_to_degrees.ts:9
↓ 3 callersMethodreverse
* Reverses the list. * Time complexity: O(n) * * @returns The reversed list or null if the list is empty.
data_structures/list/doubly_linked_list.ts:219
↓ 3 callersFunctionshellSort
(arr: T[])
sorts/shell_sort.ts:16
↓ 3 callersMethodshift
* Shifts the elements from the enqueueStack to the dequeueStack * In the worst case, all the elements from the enqueue stack needs to shifted, whic
data_structures/queue/stack_queue.ts:50
↓ 3 callersFunctionshuffleArray
(arr: number[])
other/shuffle_array.ts:1
↓ 3 callersFunctionsquareRoot
(num: number, precision: number = 1e-15)
maths/square_root.ts:12
↓ 3 callersFunctiontestQueue
(Queue: QueueConstructor)
data_structures/queue/test/queue.ts:4
↓ 3 callersFunctiontreeSort
(arr: T[])
sorts/tree_sort.ts:12
↓ 3 callersMethodvalues
()
data_structures/map/map.ts:14
↓ 2 callersFunctionCountSmallerItems
( array: number[], startIndex: number, currentItem: number )
sorts/cycle_sort.ts:42
↓ 2 callersFunctionSkipDuplicates
( array: number[], currentPosition: number, currentItem: number )
sorts/cycle_sort.ts:58
↓ 2 callersFunctionXORCipher
(str: string, key: number)
ciphers/xor_cipher.ts:12
↓ 2 callersFunctionadd_children
( graph: [number, number][][], priorityQueue: PriorityQueue<Edge>, node: number )
graph/prim.ts:49
↓ 2 callersFunctionbinomialCoefficient
(n: number, k: number)
maths/binomial_coefficient.ts:14
↓ 2 callersMethoddelete
(key: K)
data_structures/map/map.ts:10
↓ 2 callersFunctiondigitSum
(num: number)
maths/digit_sum.ts:11
↓ 2 callersFunctionedge_equal
(x: Edge, y: Edge)
graph/test/prim.test.ts:3
↓ 2 callersMethodenqueue
* Adds an item to the queue. * We always add a new item to the enqueueStack. * @param item The item being added to the queue.
data_structures/queue/stack_queue.ts:40
↓ 2 callersFunctionfindFactors
(num: number)
maths/factors.ts:11
↓ 2 callersFunctionfindMin
(nums: number[])
maths/find_min.ts:12
↓ 2 callersMethodgetSize
()
data_structures/map/map.ts:7
↓ 2 callersMethodhas
(value: K)
data_structures/set/set.ts:8
↓ 2 callersFunctionheapify
(arr: number[], index: number, size: number)
sorts/heap_sort.ts:36
↓ 2 callersMethodinOrderTraversal
* Traverses to the binary search tree in in-order, i. e. it follow the schema of: * Left Node -> Root Node -> Right Node * * @param array The
data_structures/tree/binary_search_tree.ts:153
↓ 2 callersMethodinitializeBuckets
* Initializes the buckets. * * @param amount The amount of buckets to initialize.
data_structures/map/hash_map.ts:183
↓ 2 callersMethodisEmpty
* Checks if the queue is empty. * * @returns {boolean} Whether the queue is empty or not.
data_structures/queue/array_queue.ts:25
next →1–100 of 286, ranked by callers