[ home / board list / faq / random / create / bans / search / manage / irc ] [ ]

/prog/ - Programming

Programming board

Catalog

8chan Bitcoin address: 1NpQaXqmCBji6gfX8UgaQEmEstvVY7U32C
The next generation of Infinity is here (discussion) (contribute)
A message from @CodeMonkeyZ, 2ch lead developer: "How Hiroyuki Nishimura will sell 4chan data"
Name
Email
Subject
Comment *
File
* = required field[▶ Show post options & limits]
Confused? See the FAQ.
Embed
(replaces files and can be used instead)
Options
Password (For file and post deletion.)

Allowed file types:jpg, jpeg, gif, png, webm, mp4, pdf
Max filesize is 8 MB.
Max image dimensions are 10000 x 10000.
You may upload 1 per post.


File: 1429151612824.jpg (51.96 KB, 476x476, 1:1, bill-gates-nerd-stud.jpg)

988e5c No.2080

Just came up with this new sorting algorithm
I'm pretty sure this beats anything out there.

import sys
def arraySort(unsorted):
largestVar = 0
for i in unsorted:
if float(i) > float(largestVar): largestVar = float(i)+1
sortedArray = [None]*int(largestVar)
for i in unsorted:
sortedArray[(int(float(i))-1)] = i
for i in sortedArray:
if i != None:
print(i)

arraySort(sys.argv[1:])

250f04 No.2104

>I'm pretty sure this beats anything out there.

Why don't you test it and find out for sure? Do you expect us to waste our time doing it?

1a7429 No.2108

YouTube embed. Click thumbnail to play.
>>2080
write it in C you hippie

f2c995 No.2113

>>2104
>>2108
>implying OP isn't a troll

If we did something like this:

arraySort([5, 4, 3, 2, 1, pow(2, 653)])


OP's code would try to allocate a second array with 2^653 + 1 elements in it (seriously).

Though technically, OP's algorithm has something like O(n) time complexity, so it might actually run faster than real algorithms if all of the members of the array are very small.

ce23d0 No.2196

It's no sleep sort




[Return][Go to top][Catalog][Post a Reply]
Delete Post [ ]
[]
[ home / board list / faq / random / create / bans / search / manage / irc ] [ ]