gustavo-depaula/stalin-sort
소개
원하는 언어로 Stalin sort 알고리즘을 추가하세요 ❣️ 마음에 들면 ⭐️를 남겨 주세요
기타 프로젝트측정된 스타 증가
- in 24h
- 0
- in 7 days
- 0
- in 15 days
- 0
- in 1 month
- -2
서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.
README.md
OriginalWelcome to the Stalin Sort Repo :clipboard:

What is Stalin Sort? :question:
Introduction
Stalin Sort is an efficient sorting algorithm, serving as a systematic method for placing the elements of a random access file or an array in order. Stalin Sort is also know as the best sorting algorithm of all times because of its AMAZING capacity of always ordering an array with an O(n) performance.
How it works?
It's simple, all you need to do is iterate through the array, checking if its elements are in order. Any element that isn't in order you pull out, in other words, you send it to Gulag.
Step-by-step example
- (1 2 5 3 5 7) -> (1 2 5 3 5 7) Here the algorithm stores the first of element of the array
- (1 2 5 3 5 7) -> (1 2 5 3 5 7) Now it will compare the stored element with the second one, if this is bigger than the stored, it replaces the stored element by this
- (1 2 5 3 5 7) -> (1 2 5 3 5 7) Repeats step 2
- (1 2 5 3 5 7) -> (1 2 5 5 7) Since the 4th element is smaller than the 3rd one, the 4th element will be eliminated.
- (1 2 5 5 7) -> (1 2 5 5 7) Equal elements are preserved
- (1 2 5 5 7) Ordered array!
Pseudocode implementation
Keep in mind that this is pseudocode, and is just an example. We strongly encourage you to code a different approach.
FUNCTION stalinSort(A : list OF sortable items)
n := length(A)
bigger := 0
B SET empty list
FOR i := 0 TO n NOT inclusive DO
IF A[i] >= bigger THEN
bigger := A[i]
B.push(A[i])
END IF
END FOR
RETURN B
END FUNCTION
Want to help? :raised_hands:
Please check the CONTRIBUTING.md
Give this Project a Star! :star:
About
Stalin sort began first as a Hacktoberfest 2018 repo
Hacktoberfest is a program organised by Digital Ocean and Github, where you can easily win a T-Shirt just by making 5 pull requests in the month of October to any open source projects on Github.
관련 프로젝트 살펴보기
불러오는 중…