Share your repls and programming experiences

← Back to all posts
Java Bubble Sort
DigitalRipple (30)

It took me a while but I finally got the hang of it. Comment for ideas!

Commentshotnewtop
AdCharity (1261)

javascript be like

let numbers = [1, 5, 3, 100, 27, 368];
numbers.sort(function(x, y){return x - y});
Andi_Chin (158)

@AdCharity javascript also be like: "1,6"==[1,6]

Andi_Chin (158)

java script also be like:
let numbers = [1, 5, 3, 100, 27, 368};
numbers.sort() --- oh wait I'm not gonna sort these numbers by their numerical value, lemme force them into strings and sort by the first digit xD get trolled xD lolol

DigitalRipple (30)

@Andi_Chin That's what bubble sort is tho...

AdCharity (1261)

@Andi_Chin huh? js is good that way - for instance, I couldn't do "string " + 5 in other languages and expect a valid return.

Andi_Chin (158)

@AdCharity of course, that's just great because it's exactly what comes to my mind when I think of sorting NUMBERS. Plus I really really like programs that run without errors and instead exhibit unexpected behaviors.

AdCharity (1261)

@Andi_Chin :/ what ever floats your boat

Andi_Chin (158)

now implement sleep sort (where you go through the array and print the value after sleeping for a time length proportional to the value)

[deleted]

@Andi_Chin are you trolling? this isn't even a real thing. Not sure why you were flexing your programming knowledge on the other post.

Andi_Chin (158)

@sanjaykdragon it's a joke sorting algorithm xD. Also I'm not flexing my knowlege, I was just stating simple facts that most people already know.

DigitalRipple (30)

@Andi_Chin I'm sorry but, can you speak English, please??

DigitalRipple (30)

@Andi_Chin what is this proportional to the vale thing

DigitalRipple (30)

@niorg2606 I see you're a man of culture as well

ChezCoder (1456)

i think this would work better in python maybe?

DigitalRipple (30)

@ChezCoder what would u mean by work better?

SixBeeps (2318)

@ChezCoder Nothing "works better" in one language to another besides compilation time and execution. Factually, this would work best in Assembly.

SixBeeps (2318)

Neat. Now implement bogo sort.

DigitalRipple (30)

@niorg2606 What in tarnation is bogo sort??

SixBeeps (2318)

@DigitalRipple Here's how bogo sort works:
1.) Randomize the positions of every element
2.) Is it sorted? If not, go back to step 1. Else, you're done.