Click here to Skip to main content
15,887,676 members

The Weird and The Wonderful

   

The Weird and The Wonderful forum is a place to post Coding Horrors, Worst Practices, and the occasional flash of brilliance.

We all come across code that simply boggles the mind. Lazy kludges, embarrassing mistakes, horrid workarounds and developers just not quite getting it. And then somedays we come across - or write - the truly sublime.

Post your Best, your worst, and your most interesting. But please - no programming questions . This forum is purely for amusement and discussions on code snippets. All actual programming questions will be removed.

 
GeneralRe: Bubble Sort, O(N^2) aka Quadratic time Pin
raddevus28-Jan-20 1:41
mvaraddevus28-Jan-20 1:41 
GeneralRe: Bubble Sort, O(N^2) aka Quadratic time Pin
maze328-Jan-20 22:34
professionalmaze328-Jan-20 22:34 
GeneralRe: Bubble Sort, O(N^2) aka Quadratic time Pin
raddevus29-Jan-20 2:14
mvaraddevus29-Jan-20 2:14 
GeneralRe: Bubble Sort, O(N^2) aka Quadratic time Pin
RugbyLeague29-Jan-20 21:17
RugbyLeague29-Jan-20 21:17 
GeneralRe: Bubble Sort, O(N^2) aka Quadratic time Pin
englebart29-Jan-20 3:23
professionalenglebart29-Jan-20 3:23 
GeneralRe: Bubble Sort, O(N^2) aka Quadratic time Pin
Jon McKee30-Jan-20 9:16
professionalJon McKee30-Jan-20 9:16 
GeneralRe: Bubble Sort, O(N^2) aka Quadratic time Pin
englebart30-Jan-20 9:28
professionalenglebart30-Jan-20 9:28 
GeneralRe: Bubble Sort, O(N^2) aka Quadratic time Pin
Kirk 103898212-Feb-20 16:37
Kirk 103898212-Feb-20 16:37 
Let me suggest that this was a VERY VERY important lesson to understand.
It is the basis for comparing algorithms for appropriate speed (to the problem and data at hand).
I chastised someone implementing a quicksort for < 100 items... (it was about 30 items, and would not be much larger, ever).

It helped me to discover Hash Indexing. I Created one that was 70% waste (only 30% of the values ever matched, and had ZERO duplicates). But it was 2 bytes. Another programmer challenged it with a binary tree, because he did NOT understand the nature of the lookup speed.

Finally, other algorithms that show you the importance of this: Calculate the Determinant of a square matrix. Write the code. It will look like a bubble sort. A 6x6 took 1 minute on my old computer, how long did the 7x7 take? 7 Minutes, I believe, the 8x8 was like 56 minutes (30yrs ago).

Converting to an upper/lower triangular reduces the time so amazingly you laugh. I wrote this to test my homework answers in my theory of matrices class. Quickly reviewing the algorithm told the entire story. I stuck with that FOREVER.

One lesson learned well...

BTW, I LOVED the videos of the various sorts... It is a beautiful explanation of what is going on.

GeneralRe: Bubble Sort, O(N^2) aka Quadratic time Pin
John R. Shaw26-Mar-20 20:55
John R. Shaw26-Mar-20 20:55 
GeneralMy very own accidental DoS program Pin
kmoorevs15-Jan-20 10:34
kmoorevs15-Jan-20 10:34 
GeneralRe: My very own accidental DoS program Pin
Ron Anders15-Jan-20 15:46
Ron Anders15-Jan-20 15:46 
GeneralRe: My very own accidental DoS program Pin
John R. Shaw26-Mar-20 21:25
John R. Shaw26-Mar-20 21:25 
Generalpurchased code from who knows where Pin
rnbergren10-Jan-20 6:47
rnbergren10-Jan-20 6:47 
GeneralRe: purchased code from who knows where Pin
ZurdoDev10-Jan-20 7:06
professionalZurdoDev10-Jan-20 7:06 
GeneralRe: purchased code from who knows where Pin
John R. Shaw26-Mar-20 21:30
John R. Shaw26-Mar-20 21:30 
GeneralRe: purchased code from who knows where Pin
phil.o10-Jan-20 7:29
professionalphil.o10-Jan-20 7:29 
GeneralRe: purchased code from who knows where Pin
RickZeeland10-Jan-20 7:30
mveRickZeeland10-Jan-20 7:30 
GeneralRe: purchased code from who knows where Pin
Eddy Vluggen15-Jan-20 12:01
professionalEddy Vluggen15-Jan-20 12:01 
GeneralCross-Platform: dotnet core web api QR Codes Pin
raddevus30-Dec-19 10:00
mvaraddevus30-Dec-19 10:00 
PraiseRe: Cross-Platform: dotnet core web api QR Codes Pin
RickZeeland30-Dec-19 10:23
mveRickZeeland30-Dec-19 10:23 
GeneralRe: Cross-Platform: dotnet core web api QR Codes Pin
Brisingr Aerowing10-Jan-20 10:34
professionalBrisingr Aerowing10-Jan-20 10:34 
GeneralRe: Cross-Platform: dotnet core web api QR Codes Pin
raddevus10-Jan-20 11:04
mvaraddevus10-Jan-20 11:04 
GeneralHead, meet desk Pin
Richard Deeming20-Dec-19 3:25
mveRichard Deeming20-Dec-19 3:25 
GeneralRe: Head, meet desk Pin
Greg Utas20-Dec-19 4:47
professionalGreg Utas20-Dec-19 4:47 
GeneralRe: Head, meet desk Pin
ZurdoDev20-Dec-19 8:29
professionalZurdoDev20-Dec-19 8:29 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.