All ▲lgorithms

All ▲lgorithms

  • Algorithms
  • Categories
  • Libraries
  • Blog

›Sorting

Artificial Intelligence

  • Dbscan
  • Isodata
  • Linear regression
  • Logistic regression
  • Neutral style transfer
  • Sat
  • Tsp
  • A star
  • Artificial neutral network
  • Convolutional neutral network
  • Decision tree
  • Factorization machines
  • Gaussian mixtrue model
  • Gradient boostring trees
  • Hierachical clustering
  • Image processing
  • K nearest neighbors
  • K means
  • Minimax
  • Native bayes
  • Nearest sequence memory
  • Neutral network
  • Perceptron
  • Principal component analysis
  • Q learning
  • Random forest
  • Restricted boltzman machine

Backtracking

  • Algorithm x
  • Crossword Puzzle
  • Knight tour
  • M coloring problem
  • N queen
  • Number of ways in maze
  • Partitions of set
  • Permutation of strings
  • Powerset
  • Rat in maze
  • Subset sum
  • Sudoku solve

Bit manipulation

  • Adding using bits
  • Bit divisor
  • Byte swapper
  • Convert numbers to binary
  • Count set bits
  • Flip bits
  • Hamming distace
  • Invert bit
  • Lonely integer
  • Magic number
  • Maximun xor value
  • Power of 2
  • Subset generation
  • Sum binary numbers
  • Sum equals xor
  • Thrice unique number
  • Twice unique number
  • Xor swap

Cellular automaton

  • Brians brain
  • Conways game of life
  • Elementary cellular automata
  • Generic algorithm
  • Langtons ant
  • Nobili cellular automata
  • Von neoumann cellular automata

Computational geometry

  • 2d line intersection
  • 2d separating axis test
  • Area of polygon
  • Area of triangle
  • Axis aligned bounding box collision
  • Bresenham line
  • Chans algorithm
  • Cohen sutherland lineclip
  • Distance between points
  • Graham scan
  • Halfplane intersection
  • Jarvis march
  • Quickull
  • Sphere tetrahedron intersection
  • Sutherland hodgeman clipping

Cryptography

  • Affine cipher
  • Atbash cipher
  • Autokey cipher
  • Baconian cipher
  • Caesar cipher
  • Colummnar cipher
  • Vigenere cipher

Data structures

  • Bag
  • Hashes
  • Linked list
  • List
  • Queue
  • Stack
  • Tree

Divide and conquer

  • Strassen matrix manipulation
  • Closest pair of point
  • Inversion count
  • Karatsuba multiplication
  • Maximum contiguous subsequence sum
  • Merge sort using divide and conquer
  • Quick sort using divide and conquer
  • Tournament method to find min max
  • Warnock algorithm
  • X power y

Dynamic programming

  • Array median
  • Optima binary search tree

Gaming theory

  • Nim next best move game
  • Nim win loss game
  • Grundy numbers kayle game

Graphs

  • Bipartite check
  • Adjacency lists graphs representation

Greedy algorithms

  • Activity selection
  • Dijkstra shortest path
  • Egyptian fraction

Math

  • 2 sum
  • Add polynomials
  • Amicable numbers
  • Armstrong numbers
  • Automorphic numbers
  • Average stream numbers
  • Babylonian method
  • Binomial coefficient
  • Catalan number
  • Check is square
  • Convolution
  • Coprime numbers
  • Count digits
  • Count trailing zeroes
  • Decoding of string
  • Delannoy number
  • Derangements
  • Dfa division
  • Diophantine
  • Divided differences
  • Euler totient
  • Exponentiation power
  • Factorial
  • Fast fourier transform
  • Fast inverse square root

Networking

  • Packet sniffer
  • Determine endianess
  • Validate ip

Numerical analysis

  • Integral
  • Monte carlo
  • Runge kutt

Randomized algorithms

  • Birthday paradox
  • Karger minimum cut algorithm
  • Kth smallest element algorithm
  • Random from stream
  • Random node linked list
  • Randomized quicksort
  • Reservoir sampling
  • Shuffle an array

Searches

  • Binary search
  • Exponential search
  • Fibonacci search
  • Fuzzy search
  • Interpolation search
  • Jump search
  • Linear search
  • Ternay search

Selections algorithms

  • Median of medians
  • Quick select

Sorting

  • Bead sort
  • Bogo sort
  • Bubble sort
  • Bucket sort
  • Circle sort
  • Comb sort
  • Counting sort
  • Cycle sort
  • Flash sort
  • Gnome sort
  • Heap sort
  • Insertion sort
  • Intro sort
  • Merge sort
  • Pipeonhole sort
  • Quick sort
  • Radix sort
  • Selection sort
  • Shaker sort
  • Shell sort
  • Sleep sort
  • Stooge sort
  • Topological sort
  • Tree sort

Strings

  • Aho corasick algorithm
  • Anagram search
  • Arithmetic on large numbers
  • Boyer moore algorithm
  • Finite automata
  • Kasai algorithm
  • Kmp algorithm
  • Levenshteing distance
  • Lipogram checker

Online challenges

  • Coderbyte
  • Code chef
  • Code eval
  • Hackerearth
  • Hackerrank
  • Leetcode
  • Project euler
  • Rosalind
  • Spoj
  • Top coder

No category

  • Average
  • Biggest of n numbers
  • Biggest suffix
  • Fifteen puzzle
  • Jaccard similarity
  • Jose phus problem
  • Lapindrom checker
  • Leap year
  • Magic square
  • Majority element
  • Minimum subarray size with degree
  • No operator addition
  • Paint fill
  • Split list
  • Tokenizer
  • Unique number

Counting sort

Counting sort is an algorithm for sorting a collection of objects according to keys that are small integers; that is, it is an integer sorting algorithm. It operates by counting the number of objects that have each distinct key value, and using arithmetic on those counts to determine the positions of each key value in the output sequence. Its running time is linear in the number of items and the difference between the maximum and minimum key values, so it is only suitable for direct use in situations where the variation in keys is not significantly greater than the number of items.

Performance

Complexity
Worst-case performanceO(n + k)
Best-case performanceO(n + k)
Average performanceO(n + k)
Worst-case space complexityO(n + k)

Where n is the number of elements in input array and k is the range of input

img

Implementations

LanguageLink
Pythoncounting_sort.py
C++counting_sort.py

Helpful Links

  • GeeksForGeeks
  • Wikipedia

Videos

  • Youtube
Last updated on 2019-10-1 by Simon Faillace Mullen
← Comb sortCycle sort →
  • Performance
  • Helpful Links
  • Videos
All ▲lgorithms
Implementations
C++JavaJavascriptRubyGoMore ...
Libraries Docs
PythonJavaJavascriptMore ...
Community
GithubGitterTwitterInstagramFacebook
More
BlogStickers & T-ShirtsContributingCategories
Powered by Tryhtml
Copyright © 2021 The All ▲lgorithms Project.