I Haz Codes

Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors
Menu
Bubble sort
The code below will generate a list of 2000 numbers randomly. Your task is to sort them into ascending order using bubble sort.
import random
randomNumbers = []
count = 0
while count < 2000:
    randomNumbers.append(random.randint(0,10000))
    count += 1

In order to do this task you must first research bubble sort to find out how it works.

NOTE – You must not use any inbuilt sorting methods of python. The solution should contain a nested while loop! (or a nested for in loop)
You need to log in or create an account to submit code!

Leave a Reply

Your email address will not be published. Required fields are marked *

Information