Login Password

snippets

Last 10 active snippets

0
favorites
4
comments
Avatar Image

Super fast sort algorithm

How my algorithm works (collapse sort), is to think how human normally arrange object. Lets say we have: 3, 8, 5, 9 ,10, 2, 8, 6, 1, 7 First you find the highest value in the array which is 10 Second you create integer array the length of highest value you found This then give us a list of index for the data to be store So far the only comparison we done is finding high number Now we loop all data and place it in the new array 3, 8, 5, 9 ,10, 2, 8, 6, 1, 7 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 _ | 1 | 1 | 1 | _ | 1 | 1 | 1 | 2 | 1 | 1 If you notice Array[8] has value of 2 because there is a repeat After all arrange number have been store in a list we can do a loop to place all those data back in array As you see the is no comparison to slow the process down 1 | 2 | 3 | 5 | 6 | 7 | 8 | 8 | 9 | 10 If this sort algorithm has already been done i am going to be well gutted because so far i know that none of the sort works like my one. I only know 2 disadvantages to this algorithm is that: 1. If value in array is really big then the sort will slow down due unnecessary looping time 2. No matter what is the data is already sorted the time different from mostly ordered data and un-ordered data is the same So far this could be the best sorting algorithm because is faster than any other tested sort Here is my results: For 300000 elements, the times are: Type: Bubble Sort time: 6:42:875 Type: Insertion Sort time: 1:55:843 Type: Selection Sort time: 3:29:032 Type: Heap Sort time: 0:00:125 Type: Quicksort time: 0:00:046 Type: Collapse Sort time: 0:00:016 ...
posted by T Chai 3 years ago
0
favorites
4
comments
Avatar Image

PHP Keyword Cloud Generator

PHP Keyword Cloud Generator - Scans the given text for the most common words - This example also generates a sample of how to use the output ...
posted by Jeremy Simkins 3 years, 1 month ago
0
favorites
3
comments
Avatar Image

HTML Mail Form

Form to send POST data to a php file and send its data to a email. ...
posted by Geraldo Andrade 2 years, 3 months ago
0
favorites
3
comments
Avatar Image

C# Text to Speech (and Speech to Text) in a few lines of code

this is always fun to play with... create a new form, 2 buttons (btnSpeak and btnListen) and a text box (textBox1)... add the following code and start converting Text to Speech and Speech to Text... comes standard with Visual Studio... ...
posted by Conrad Programmer 3 years ago
64
favorites
3
comments
Avatar Image

Submit a form by hitting the enter button inside an input field with jQuery

Users a used to submit a form without clicking the submit button of a form. They expect to get to the next step or page just by hitting the enter button. The code snippets binds the keypress action to all form with the specific CSS-class "enter-submit". In order to bind the action also for ajax-loaded elements we use the binding function "live". ...
posted by Bjoern Gottowik 3 years, 1 month ago
0
favorites
2
comments
Avatar Image

REDIMENCIONAR IMAGENES

ES PARA REDIMCNEIONAR ...
posted by uh-perez 2 years, 4 months ago
0
favorites
2
comments
Avatar Image

PHP String Crop

Useful little function that finds and returns a chunk of a string between point A and point B.. ...
posted by Rainner Lins 2 years, 5 months ago
0
favorites
2
comments
Avatar Image

Exporting a QTableWidget to a CSV File

This little piece of code exports a QTableWidget to a CSV File. The filename is stored in the QLineEdit, and the QTableWidget is passed as a parameter. No error checking, just quick and dirty. ...
posted by Alejandro Martinis 2 years, 6 months ago
0
favorites
2
comments
Avatar Image

Counts the frequency of a word in a file.

Reads a file from the command line, asks the user to input a word. Counts the frequency of the word in the defined file. (just part of an assignment in college.) ...
posted by Ciaran McNally 2 years, 6 months ago
0
favorites
2
comments
Avatar Image

Unique string generator

Generates a unique string. Cool if you need generate file names or stuff like that. ...
posted by 2 years, 6 months ago
1 2 ... 7
bettercodes.org is released as free software without warranties under GNU Affero GPL v3