quickselect - A fast selection algorithm in JavaScript.

  •        8

A tiny and fast selection algorithm in JavaScript (specifically, Floyd-Rivest selection). Rearranges items so that all items in the [left, k] are the smallest. The k-th element will have the (k - left + 1)-th smallest value in [left, right].

https://github.com/mourner/quickselect

Tags
Implementation
License
Platform

   




Related Projects

Floyd

  •    C

Floyd is a collection of 3D libraries, mathematics and scene libraries and utilities. The main parts of it are geometry library Elea, OpenGL scene graph library Miletos and posing application Khayyam.

RC5 Crypto Engine Generator

  •    

RC5 is a block cipher invented by Ron Rivest at MIT. This is a Perl script that generates VHDL code for RC5 crypto engine.

CLRS - :notebook:Solutions to Introduction to Algorithms

  •    C++

Solutions to Introduction to Algorithms by Charles E. Leiserson, Clifford Stein, Ronald Rivest, and Thomas H. Cormen (CLRS). If I miss your name here, please pull a request to me to fix.

Sorting Algorithm Visualization

  •    

Sorting Algorithm Visualization Displays Bead Sort, Binary Tree Sort, Bubble Sort, Bucket Sort, Cocktail Sort, Counting Sort, Gnome Sort, In Place Merge Sort, Insertion Sort, Merge Sort and more...


WikiSort - Fast and stable sort algorithm that uses O(1) memory. Public domain.

  •    C++

Update (04/28/14): Check out the GrailSort project on GitHub for a similar algorithm based on a paper by Huang and Langston. It's actually faster than WikiSort for the Random and RandomFew tests when you remove the 512-item cache! It goes to show that this is still an open area of research that could use your expertise. WikiSort is an implementation of "block merge sort", or "block sort" for short, which is a stable merge sort based on the work described in "Ratio based stable in-place merging", by Pok-Son Kim and Arne Kutzner [PDF].

SwiftGraph - A Graph Data Structure in Pure Swift

  •    Swift

SwiftGraph is a pure Swift (no Cocoa) implementation of a graph data structure, appropriate for use on all platforms Swift supports (iOS, macOS, Linux, etc.). It includes support for weighted, unweighted, directed, and undirected graphs. It uses generics to abstract away both the type of the vertices, and the type of the weights. It includes copious in-source documentation, unit tests, as well as search functions for doing things like breadth-first search, depth-first search, and Dijkstra's algorithm. Further, it includes utility functions for topological sort, Jarnik's algorithm to find a minimum-spanning tree, detecting a DAG (directed-acyclic-graph), and enumerating all cycles.

Python - All Algorithms implemented in Python

  •    Python

These are for demonstration purposes only. There are many implementations of sorts in the Python standard library that are much better for performance reasons. From Wikipedia: Bubble sort, sometimes referred to as sinking sort, is a simple sorting algorithm that repeatedly steps through the list to be sorted, compares each pair of adjacent items and swaps them if they are in the wrong order. The pass through the list is repeated until no swaps are needed, which indicates that the list is sorted.

interview - Data Structures and Algorithms in Java (useful in interview process)

  •    Java

Very useful in interview process for Java Software Development Engineer (SDE). The loop executes N times, so the sequence of statements also executes N times. If we assume the statements are O(1), the total time for the for loop is N * O(1), which is O(N) overall.

ai-resources - Selection of resources to learn Artificial Intelligence / Machine Learning / Statistical Inference / Deep Learning / Reinforcement Learning

  •    

Update April 2017: It’s been almost a year since I posted this list of resources, and over the year there’s been an explosion of articles, videos, books, tutorials etc on the subject — even an explosion of ‘lists of resources’ such as this one. It’s impossible for me to keep this up to date. However, the one resource I would like to add is https://ml4a.github.io/ (https://github.com/ml4a) led by Gene Kogan. It’s specifically aimed at artists and the creative coding community. This is a very incomplete and subjective selection of resources to learn about the algorithms and maths of Artificial Intelligence (AI) / Machine Learning (ML) / Statistical Inference (SI) / Deep Learning (DL) / Reinforcement Learning (RL). It is aimed at beginners (those without Computer Science background and not knowing anything about these subjects) and hopes to take them to quite advanced levels (able to read and understand DL papers). It is not an exhaustive list and only contains some of the learning materials that I have personally completed so that I can include brief personal comments on them. It is also by no means the best path to follow (nowadays most MOOCs have full paths all the way from basic statistics and linear algebra to ML/DL). But this is the path I took and in a sense it's a partial documentation of my personal journey into DL (actually I bounced around all of these back and forth like crazy). As someone who has no formal background in Computer Science (but has been programming for many years), the language, notation and concepts of ML/SI/DL and even CS was completely alien to me, and the learning curve was not only steep, but vertical, treacherous and slippery like ice.

match-sorter - Simple, expected, and deterministic best-match sorting of an array in JavaScript

  •    Javascript

This follows a simple and sensible (user friendly) algorithm that makes it easy for you to filter and sort a list of items based on given input. Items are ranked based on sensible criteria that result in a better user experience.

FGA - Fast Genetic Algorithm

  •    C++

FGA (Fast Genetic Algorithm) is a simple yet powerful implementation of genetic algorithms. The library provides many variants of crossover and selection procedures, and a parallel version of the algorithm is included.

pdqsort - Pattern-defeating quicksort.

  •    C++

Pattern-defeating quicksort (pdqsort) is a novel sorting algorithm that combines the fast average case of randomized quicksort with the fast worst case of heapsort, while achieving linear time on inputs with certain patterns. pdqsort is an extension and improvement of David Mussers introsort. All code is available for free under the zlib license. pdqsort is a drop-in replacement for std::sort. Just replace a call to std::sort with pdqsort to start using pattern-defeating quicksort. If your comparison function is branchless, you can call pdqsort_branchless for a potential big speedup. If you are using C++11, the type you're sorting is arithmetic and your comparison function is not given or is std::less/std::greater, pdqsort automatically delegates to pdqsort_branchless.

DataStructureAndAlgorithms - Write code that run faster, use less memory and prepare for your Job Interview

  •    Java

In this course you will learn how to Analysis algorithms like Sorting, Searching, and Graph algorithms. And how to reduce the code complexity from one Big-O level to another level. Furthermore, you will learn different type of Data Structure for your code. Also you will learn how to find Big-O for every data structure, and how to apply correct Data Structure to your problem in Java. By the end you will be able to write code that run faster and use low memory. You Also will learn how to analysis problems using Dynamic programming.

Steam Group Players

  •    

This tool is meant to allow access to Steam community groups with the ability to sort group members according to hours spent playing specific games (as well as overall play time). The reason for starting this project was to allow a "player of the week"-selection that is sligh...

hawk - HTTP Holder-Of-Key Authentication Scheme

  •    Javascript

Hawk is an HTTP authentication scheme using a message authentication code (MAC) algorithm to provide partial HTTP request cryptographic verification. For more complex use cases such as access delegation, see Oz.Note: the protocol has not changed since version 1.1. The version increments reflect changes in the node API.

LWPR

  •    Python

Locally Weighted Projection Regression (LWPR)

fuzzysearch - :pig: Tiny and fast fuzzy search in Go

  •    Go

Inspired by bevacqua/fuzzysearch, a fuzzy matching library written in JavaScript. But contains some extras like ranking using Levenshtein distance (see RankMatch()) and finding matches in a list of words (see Find()). Fuzzy searching allows for flexibly matching a string with partial input, useful for filtering data very quickly based on lightweight user input.

fuzzysearch - :pig: Tiny and fast fuzzy search in Go

  •    Go

Inspired by bevacqua/fuzzysearch, a fuzzy matching library written in JavaScript. But contains some extras like ranking using Levenshtein distance (see RankMatch()) and finding matches in a list of words (see Find()). Fuzzy searching allows for flexibly matching a string with partial input, useful for filtering data very quickly based on lightweight user input.

interpret - Fit interpretable models. Explain blackbox machine learning.

  •    C++

Historically, the most intelligible models were not very accurate, and the most accurate models were not intelligible. Microsoft Research has developed an algorithm called the Explainable Boosting Machine (EBM)* which has both high accuracy and intelligibility. EBM uses modern machine learning techniques like bagging and boosting to breathe new life into traditional GAMs (Generalized Additive Models). This makes them as accurate as random forests and gradient boosted trees, and also enhances their intelligibility and editability. In addition to EBM, InterpretML also supports methods like LIME, SHAP, linear models, partial dependence, decision trees and rule lists. The package makes it easy to compare and contrast models to find the best one for your needs.