Code Monkey home page Code Monkey logo

gustavo-depaula / stalin-sort Goto Github PK

View Code? Open in Web Editor NEW
1.5K 1.5K 174.0 1.06 MB

Add a stalin sort algorithm in any language you like ❣️ if you like give us a ⭐️

License: MIT License

JavaScript 2.29% C 10.42% Python 19.76% Go 3.54% Ruby 0.93% Kotlin 10.64% C# 9.99% Gnuplot 0.25% Haskell 1.25% Brainfuck 0.60% Java 6.01% Haxe 1.03% Perl 2.61% PHP 0.83% Swift 2.32% Erlang 0.60% Standard ML 1.42% C++ 22.61% Lua 1.52% Common Lisp 1.39%
hacktoberfest stalin-sort

stalin-sort's People

Contributors

89netram avatar alphya avatar antonrud avatar artoria2e5 avatar chunkybanana avatar deiuch avatar dxeoane avatar eboru avatar elliotwutingfeng avatar fsandhei avatar gabrielcarneiro97 avatar gaburielcasado avatar graudtv avatar gustavo-depaula avatar hy60koshk avatar julian-borbeck avatar kentarousuzuki avatar luksamuk avatar matteusan avatar mogron avatar nagataaaas avatar plokmijnuhby avatar robthree avatar seltyk avatar tmaxthomas avatar uhthomas avatar victorperin avatar vijiatjack avatar watosar avatar wpwoodjr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

stalin-sort's Issues

BogoStalinSort

I propose addition of a new sorting algorithm which combines the best features of both stalinsort and bogosort.

The algorithm is fairly simple:
Just randomly remove elements until the array is in order.

Complexity ranges from O(n) to O(n²)

Hope this will make the world a better place!

More precise algorithm definition

As this project gets larger and larger, lol, we may need a less vague algorithm definition than a tweet so that it is easier to know if a PR is wrong.

Proposal: LeninSort

Example

  1. (1 2 5 3 5 7) -> total = 23, avg = 3.8
  2. (1 2 5 3 5 7) -> low < 3.8
  3. (1 2 5 3 5 7) -> high > 3.8
  4. (1 2 5 3 5 7) -> (1 2 3) save low in source, (5 5 7) move high to other container

Additional steps:
5. Try sort other containers with LeninSort
6. Merge all first containers
7. You can sort merged container with StalinSort

Peer Review

It seems like you have implemented StalinSort in more than 30 languages. But have the source codes been peer reviewed enough so that they only contain generic template classes that permits the development of general programs, and do not depend on the underlying container.

I really like this idea because it avoids function overhead and pays strict attention to time complexity of algorithm (always O(N)). But I hope this repository actually provide a structured generic components that can actually be used in a seamless way.

Test folder

I belive that would be good to have a folder with some default inputs and outputs, so anyone that wants to add some solution in any given language must post with it the outputs of his code too, its kind important to have some sort of validation to the added codes.

My idea is to create a folder with numbered folders in it, related to the number of the test, so if exists 20 tests, the folder tests will contain 20 folders numbered from 1 to 20.

stalin-sort/tests/1...20

In each of this folders will exist 2 .txt files, one called input and other one called output. This files will contain numbers with pipes ( | ) between them.

EXAMPLE

stalin-sort/tests/1

input.txt

1|2|3|4|5|2

output.txt

1|2|3|4|5

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.