JavaScript Algorithm - 30 seconds of code
source link: https://www.30secondsofcode.org/js/t/algorithm/p/1
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
JavaScript
kMeans
JavaScript, Algorithm
Groups the given data into
k
clusters, using the k-means clustering algorithm.kNearestNeighbors
JavaScript, Algorithm
Classifies a data point relative to a labelled data set, using the k-nearest neighbors algorithm.
bucketSort
JavaScript, Algorithm
Sorts an array of numbers, using the bucket sort algorithm.
heapsort
JavaScript, Algorithm
Sorts an array of numbers, using the heapsort algorithm.
quickSort
JavaScript, Algorithm
Sorts an array of numbers, using the quicksort algorithm.
Like 30 seconds of code?
Follow on TwittercaesarCipher
JavaScript, Algorithm
Encrypts or decrypts a given string using the Caesar cipher.
selectionSort
JavaScript, Algorithm
Sorts an array of numbers, using the selection sort algorithm.
euclideanDistance
JavaScript, Math
Calculates the distance between two points in any number of dimensions.
insertionSort
JavaScript, Algorithm
Sorts an array of numbers, using the insertion sort algorithm.
mergeSort
JavaScript, Algorithm
Sorts an array of numbers, using the merge sort algorithm.
binarySearch
JavaScript, Algorithm
Finds the index of a given element in a sorted array using the binary search algorithm.
bubbleSort
JavaScript, Algorithm
Sorts an array of numbers, using the bubble sort algorithm.
levenshteinDistance
JavaScript, String
Calculates the difference between two strings, using the Levenshtein distance algorithm.
linearSearch
JavaScript, Algorithm
Finds the first index of a given element in an array using the linear search algorithm.
primeFactors
JavaScript, Math
Finds the prime factors of a given number using the trial division algorithm.
Website, name & logo © 2017-2020 30-seconds
Individual snippets licensed under CC0-1.0
Powered by Netlify, Gatsby, Travis CI & GitHub
30 seconds of code uses cookies to provide a high quality user experience and gather anonymized data for statistical analysis of the website's traffic.You can learn more by reading our cookie policy.
By clicking "Accept" you accept their installation.
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK