id int64 1 2.26k | language stringclasses 7
values | category stringclasses 3
values | difficulty stringclasses 2
values | task_description stringclasses 132
values | code stringlengths 68 753 | explanation stringclasses 449
values |
|---|---|---|---|---|---|---|
1 | Python | Sorting Algorithm | intermediate | Sort a 5-element array of ints in ascending order using bubble sort. | def bubble_sort(buffer):
n = len(buffer)
for i in range(n):
for j in range(0, n - i - 1):
if buffer[j] > buffer[j + 1]:
buffer[j], buffer[j + 1] = buffer[j + 1], buffer[j]
return buffer
print(bubble_sort([-22, -44, 20, 12, 7])) | Bubble sort on int data, variable named 'buffer', 5 elements. |
2 | Python | Sorting Algorithm | intermediate | Sort a 5-element array of ints in ascending order using bubble sort. | def bubble_sort(values):
n = len(values)
for i in range(n):
for j in range(0, n - i - 1):
if values[j] > values[j + 1]:
values[j], values[j + 1] = values[j + 1], values[j]
return values
print(bubble_sort([-24, 89, -28, 58, -42])) | Bubble sort on int data, variable named 'values', 5 elements. |
3 | Python | Sorting Algorithm | intermediate | Sort a 5-element array of ints in ascending order using bubble sort. | def bubble_sort(arr):
n = len(arr)
for i in range(n):
for j in range(0, n - i - 1):
if arr[j] > arr[j + 1]:
arr[j], arr[j + 1] = arr[j + 1], arr[j]
return arr
print(bubble_sort([-27, 5, 9, 79, -44])) | Bubble sort on int data, variable named 'arr', 5 elements. |
4 | Python | Sorting Algorithm | intermediate | Sort a 8-element array of ints in ascending order using bubble sort. | def bubble_sort(input_arr):
n = len(input_arr)
for i in range(n):
for j in range(0, n - i - 1):
if input_arr[j] > input_arr[j + 1]:
input_arr[j], input_arr[j + 1] = input_arr[j + 1], input_arr[j]
return input_arr
print(bubble_sort([0, 89, 57, 6, 64, 21, -49, -10])) | Bubble sort on int data, variable named 'input_arr', 8 elements. |
5 | Python | Sorting Algorithm | intermediate | Sort a 8-element array of ints in ascending order using bubble sort. | def bubble_sort(seq):
n = len(seq)
for i in range(n):
for j in range(0, n - i - 1):
if seq[j] > seq[j + 1]:
seq[j], seq[j + 1] = seq[j + 1], seq[j]
return seq
print(bubble_sort([58, 37, 21, -11, 5, 36, -24, -27])) | Bubble sort on int data, variable named 'seq', 8 elements. |
6 | Python | Sorting Algorithm | intermediate | Sort a 8-element array of ints in ascending order using bubble sort. | def bubble_sort(collection):
n = len(collection)
for i in range(n):
for j in range(0, n - i - 1):
if collection[j] > collection[j + 1]:
collection[j], collection[j + 1] = collection[j + 1], collection[j]
return collection
print(bubble_sort([-26, 41, 38, 17, -39, 67, 87, ... | Bubble sort on int data, variable named 'collection', 8 elements. |
7 | Python | Sorting Algorithm | intermediate | Sort a 10-element array of ints in ascending order using bubble sort. | def bubble_sort(entries):
n = len(entries)
for i in range(n):
for j in range(0, n - i - 1):
if entries[j] > entries[j + 1]:
entries[j], entries[j + 1] = entries[j + 1], entries[j]
return entries
print(bubble_sort([46, -30, 91, 25, 42, 97, -1, -33, -39, 8])) | Bubble sort on int data, variable named 'entries', 10 elements. |
8 | Python | Sorting Algorithm | intermediate | Sort a 10-element array of ints in ascending order using bubble sort. | def bubble_sort(vals):
n = len(vals)
for i in range(n):
for j in range(0, n - i - 1):
if vals[j] > vals[j + 1]:
vals[j], vals[j + 1] = vals[j + 1], vals[j]
return vals
print(bubble_sort([24, -30, 9, -25, 47, 21, 66, 43, -9, 44])) | Bubble sort on int data, variable named 'vals', 10 elements. |
9 | Python | Sorting Algorithm | intermediate | Sort a 10-element array of ints in ascending order using bubble sort. | def bubble_sort(list1):
n = len(list1)
for i in range(n):
for j in range(0, n - i - 1):
if list1[j] > list1[j + 1]:
list1[j], list1[j + 1] = list1[j + 1], list1[j]
return list1
print(bubble_sort([3, 18, -32, -7, 86, 12, -9, 68, 47, 19])) | Bubble sort on int data, variable named 'list1', 10 elements. |
10 | Python | Sorting Algorithm | intermediate | Sort a 12-element array of ints in ascending order using bubble sort. | def bubble_sort(entries):
n = len(entries)
for i in range(n):
for j in range(0, n - i - 1):
if entries[j] > entries[j + 1]:
entries[j], entries[j + 1] = entries[j + 1], entries[j]
return entries
print(bubble_sort([92, 6, 33, -36, 8, -42, 30, 52, 18, -34, 4, 95])) | Bubble sort on int data, variable named 'entries', 12 elements. |
11 | Python | Sorting Algorithm | intermediate | Sort a 12-element array of ints in ascending order using bubble sort. | def bubble_sort(entries):
n = len(entries)
for i in range(n):
for j in range(0, n - i - 1):
if entries[j] > entries[j + 1]:
entries[j], entries[j + 1] = entries[j + 1], entries[j]
return entries
print(bubble_sort([30, 4, 77, 51, 67, -14, 17, -15, 13, 93, 87, 17])) | Bubble sort on int data, variable named 'entries', 12 elements. |
12 | Python | Sorting Algorithm | intermediate | Sort a 12-element array of ints in ascending order using bubble sort. | def bubble_sort(seq):
n = len(seq)
for i in range(n):
for j in range(0, n - i - 1):
if seq[j] > seq[j + 1]:
seq[j], seq[j + 1] = seq[j + 1], seq[j]
return seq
print(bubble_sort([99, 59, 99, 52, 42, 6, -15, 80, 76, -27, -38, -22])) | Bubble sort on int data, variable named 'seq', 12 elements. |
13 | Python | Sorting Algorithm | intermediate | Sort a 15-element array of ints in ascending order using bubble sort. | def bubble_sort(values):
n = len(values)
for i in range(n):
for j in range(0, n - i - 1):
if values[j] > values[j + 1]:
values[j], values[j + 1] = values[j + 1], values[j]
return values
print(bubble_sort([-10, 58, -34, 48, 47, 69, 85, 14, 91, -48, -21, 87, 18, 37, -22])) | Bubble sort on int data, variable named 'values', 15 elements. |
14 | Python | Sorting Algorithm | intermediate | Sort a 15-element array of ints in ascending order using bubble sort. | def bubble_sort(nums):
n = len(nums)
for i in range(n):
for j in range(0, n - i - 1):
if nums[j] > nums[j + 1]:
nums[j], nums[j + 1] = nums[j + 1], nums[j]
return nums
print(bubble_sort([61, -10, 66, -50, 17, 78, -5, 79, -23, 26, 79, 0, -11, 45, -9])) | Bubble sort on int data, variable named 'nums', 15 elements. |
15 | Python | Sorting Algorithm | intermediate | Sort a 15-element array of ints in ascending order using bubble sort. | def bubble_sort(input_arr):
n = len(input_arr)
for i in range(n):
for j in range(0, n - i - 1):
if input_arr[j] > input_arr[j + 1]:
input_arr[j], input_arr[j + 1] = input_arr[j + 1], input_arr[j]
return input_arr
print(bubble_sort([85, -50, 32, 75, -46, -22, 42, 28, 11, ... | Bubble sort on int data, variable named 'input_arr', 15 elements. |
16 | Python | Sorting Algorithm | intermediate | Sort a 20-element array of ints in ascending order using bubble sort. | def bubble_sort(records):
n = len(records)
for i in range(n):
for j in range(0, n - i - 1):
if records[j] > records[j + 1]:
records[j], records[j + 1] = records[j + 1], records[j]
return records
print(bubble_sort([-33, 86, -18, -18, 71, 90, -8, 17, 85, 58, 4, 88, 1, 29, ... | Bubble sort on int data, variable named 'records', 20 elements. |
17 | Python | Sorting Algorithm | intermediate | Sort a 20-element array of ints in ascending order using bubble sort. | def bubble_sort(items):
n = len(items)
for i in range(n):
for j in range(0, n - i - 1):
if items[j] > items[j + 1]:
items[j], items[j + 1] = items[j + 1], items[j]
return items
print(bubble_sort([7, -34, 36, -45, 91, 8, 6, -49, -32, -35, 8, -33, -42, 34, -32, 81, 10, 21,... | Bubble sort on int data, variable named 'items', 20 elements. |
18 | Python | Sorting Algorithm | intermediate | Sort a 20-element array of ints in ascending order using bubble sort. | def bubble_sort(input_arr):
n = len(input_arr)
for i in range(n):
for j in range(0, n - i - 1):
if input_arr[j] > input_arr[j + 1]:
input_arr[j], input_arr[j + 1] = input_arr[j + 1], input_arr[j]
return input_arr
print(bubble_sort([-17, 96, 97, 71, 12, 71, 54, -2, -26, -... | Bubble sort on int data, variable named 'input_arr', 20 elements. |
19 | Python | Sorting Algorithm | intermediate | Sort a 5-element array of floats in ascending order using bubble sort. | def bubble_sort(vals):
n = len(vals)
for i in range(n):
for j in range(0, n - i - 1):
if vals[j] > vals[j + 1]:
vals[j], vals[j + 1] = vals[j + 1], vals[j]
return vals
print(bubble_sort([82.54, 9.59, 2.63, 33.39, 30.2])) | Bubble sort on float data, variable named 'vals', 5 elements. |
20 | Python | Sorting Algorithm | intermediate | Sort a 5-element array of floats in ascending order using bubble sort. | def bubble_sort(nums):
n = len(nums)
for i in range(n):
for j in range(0, n - i - 1):
if nums[j] > nums[j + 1]:
nums[j], nums[j + 1] = nums[j + 1], nums[j]
return nums
print(bubble_sort([35.05, 84.06, -11.03, 76.15, 81.86])) | Bubble sort on float data, variable named 'nums', 5 elements. |
21 | Python | Sorting Algorithm | intermediate | Sort a 5-element array of floats in ascending order using bubble sort. | def bubble_sort(data):
n = len(data)
for i in range(n):
for j in range(0, n - i - 1):
if data[j] > data[j + 1]:
data[j], data[j + 1] = data[j + 1], data[j]
return data
print(bubble_sort([-13.98, 98.91, 79.49, 95.31, 90.24])) | Bubble sort on float data, variable named 'data', 5 elements. |
22 | Python | Sorting Algorithm | intermediate | Sort a 8-element array of floats in ascending order using bubble sort. | def bubble_sort(records):
n = len(records)
for i in range(n):
for j in range(0, n - i - 1):
if records[j] > records[j + 1]:
records[j], records[j + 1] = records[j + 1], records[j]
return records
print(bubble_sort([8.13, 28.36, 37.28, 82.89, 87.39, -0.41, -19.74, 26.46])) | Bubble sort on float data, variable named 'records', 8 elements. |
23 | Python | Sorting Algorithm | intermediate | Sort a 8-element array of floats in ascending order using bubble sort. | def bubble_sort(entries):
n = len(entries)
for i in range(n):
for j in range(0, n - i - 1):
if entries[j] > entries[j + 1]:
entries[j], entries[j + 1] = entries[j + 1], entries[j]
return entries
print(bubble_sort([73.3, 34.15, 30.34, 93.92, 98.46, 46.14, 65.49, -1.58])) | Bubble sort on float data, variable named 'entries', 8 elements. |
24 | Python | Sorting Algorithm | intermediate | Sort a 8-element array of floats in ascending order using bubble sort. | def bubble_sort(nums):
n = len(nums)
for i in range(n):
for j in range(0, n - i - 1):
if nums[j] > nums[j + 1]:
nums[j], nums[j + 1] = nums[j + 1], nums[j]
return nums
print(bubble_sort([5.91, -13.04, 67.55, -12.75, 17.32, -14.03, 36.74, 89.41])) | Bubble sort on float data, variable named 'nums', 8 elements. |
25 | Python | Sorting Algorithm | intermediate | Sort a 10-element array of floats in ascending order using bubble sort. | def bubble_sort(input_arr):
n = len(input_arr)
for i in range(n):
for j in range(0, n - i - 1):
if input_arr[j] > input_arr[j + 1]:
input_arr[j], input_arr[j + 1] = input_arr[j + 1], input_arr[j]
return input_arr
print(bubble_sort([-1.27, 94.33, -10.47, 2.11, 50.81, 60.3... | Bubble sort on float data, variable named 'input_arr', 10 elements. |
26 | Python | Sorting Algorithm | intermediate | Sort a 10-element array of floats in ascending order using bubble sort. | def bubble_sort(elements):
n = len(elements)
for i in range(n):
for j in range(0, n - i - 1):
if elements[j] > elements[j + 1]:
elements[j], elements[j + 1] = elements[j + 1], elements[j]
return elements
print(bubble_sort([-15.27, -10.24, 58.23, 47.26, 17.65, 11.03, 59.7... | Bubble sort on float data, variable named 'elements', 10 elements. |
27 | Python | Sorting Algorithm | intermediate | Sort a 10-element array of floats in ascending order using bubble sort. | def bubble_sort(buffer):
n = len(buffer)
for i in range(n):
for j in range(0, n - i - 1):
if buffer[j] > buffer[j + 1]:
buffer[j], buffer[j + 1] = buffer[j + 1], buffer[j]
return buffer
print(bubble_sort([15.7, 17.63, 69.47, -11.37, 34.54, 98.82, 98.54, -11.28, 5.37, 11.... | Bubble sort on float data, variable named 'buffer', 10 elements. |
28 | Python | Sorting Algorithm | intermediate | Sort a 12-element array of floats in ascending order using bubble sort. | def bubble_sort(entries):
n = len(entries)
for i in range(n):
for j in range(0, n - i - 1):
if entries[j] > entries[j + 1]:
entries[j], entries[j + 1] = entries[j + 1], entries[j]
return entries
print(bubble_sort([21.53, -11.81, 9.07, 13.91, 32.14, 44.64, 16.0, 97.08, 76... | Bubble sort on float data, variable named 'entries', 12 elements. |
29 | Python | Sorting Algorithm | intermediate | Sort a 12-element array of floats in ascending order using bubble sort. | def bubble_sort(entries):
n = len(entries)
for i in range(n):
for j in range(0, n - i - 1):
if entries[j] > entries[j + 1]:
entries[j], entries[j + 1] = entries[j + 1], entries[j]
return entries
print(bubble_sort([58.94, 91.73, -4.02, -6.26, -7.26, 45.83, 12.41, 51.97, 6... | Bubble sort on float data, variable named 'entries', 12 elements. |
30 | Python | Sorting Algorithm | intermediate | Sort a 12-element array of floats in ascending order using bubble sort. | def bubble_sort(dataset):
n = len(dataset)
for i in range(n):
for j in range(0, n - i - 1):
if dataset[j] > dataset[j + 1]:
dataset[j], dataset[j + 1] = dataset[j + 1], dataset[j]
return dataset
print(bubble_sort([9.88, 88.07, -13.95, 55.48, 78.69, -14.75, 19.69, -4.43, ... | Bubble sort on float data, variable named 'dataset', 12 elements. |
31 | Python | Sorting Algorithm | intermediate | Sort a 15-element array of floats in ascending order using bubble sort. | def bubble_sort(input_arr):
n = len(input_arr)
for i in range(n):
for j in range(0, n - i - 1):
if input_arr[j] > input_arr[j + 1]:
input_arr[j], input_arr[j + 1] = input_arr[j + 1], input_arr[j]
return input_arr
print(bubble_sort([-18.85, -11.05, 85.09, 87.57, 44.93, 79... | Bubble sort on float data, variable named 'input_arr', 15 elements. |
32 | Python | Sorting Algorithm | intermediate | Sort a 15-element array of floats in ascending order using bubble sort. | def bubble_sort(items):
n = len(items)
for i in range(n):
for j in range(0, n - i - 1):
if items[j] > items[j + 1]:
items[j], items[j + 1] = items[j + 1], items[j]
return items
print(bubble_sort([59.37, 22.09, 46.63, 84.09, 95.89, 69.19, 90.17, 8.17, -0.66, 75.19, 1.07, ... | Bubble sort on float data, variable named 'items', 15 elements. |
33 | Python | Sorting Algorithm | intermediate | Sort a 15-element array of floats in ascending order using bubble sort. | def bubble_sort(collection):
n = len(collection)
for i in range(n):
for j in range(0, n - i - 1):
if collection[j] > collection[j + 1]:
collection[j], collection[j + 1] = collection[j + 1], collection[j]
return collection
print(bubble_sort([75.47, 82.82, 76.48, 11.75, 73... | Bubble sort on float data, variable named 'collection', 15 elements. |
34 | Python | Sorting Algorithm | intermediate | Sort a 20-element array of floats in ascending order using bubble sort. | def bubble_sort(items):
n = len(items)
for i in range(n):
for j in range(0, n - i - 1):
if items[j] > items[j + 1]:
items[j], items[j + 1] = items[j + 1], items[j]
return items
print(bubble_sort([27.42, 13.15, -11.74, 72.03, 21.79, 40.62, 60.86, 80.4, 19.41, -16.72, 84.3... | Bubble sort on float data, variable named 'items', 20 elements. |
35 | Python | Sorting Algorithm | intermediate | Sort a 20-element array of floats in ascending order using bubble sort. | def bubble_sort(data):
n = len(data)
for i in range(n):
for j in range(0, n - i - 1):
if data[j] > data[j + 1]:
data[j], data[j + 1] = data[j + 1], data[j]
return data
print(bubble_sort([25.84, 48.61, 10.31, 64.35, -19.8, 90.14, 44.08, 65.61, 68.29, 59.8, 23.34, -11.67, ... | Bubble sort on float data, variable named 'data', 20 elements. |
36 | Python | Sorting Algorithm | intermediate | Sort a 20-element array of floats in ascending order using bubble sort. | def bubble_sort(collection):
n = len(collection)
for i in range(n):
for j in range(0, n - i - 1):
if collection[j] > collection[j + 1]:
collection[j], collection[j + 1] = collection[j + 1], collection[j]
return collection
print(bubble_sort([62.97, 45.98, 2.83, 59.13, 25.... | Bubble sort on float data, variable named 'collection', 20 elements. |
37 | JavaScript | Sorting Algorithm | intermediate | Sort a 5-element array of ints in ascending order using bubble sort. | function bubbleSort(seq) {
const n = seq.length;
for (let i = 0; i < n; i++) {
for (let j = 0; j < n - i - 1; j++) {
if (seq[j] > seq[j + 1]) {
[seq[j], seq[j + 1]] = [seq[j + 1], seq[j]];
}
}
}
return seq;
}
console.log(bubbleSort([-7, -29, 22, 81, 35])); | Bubble sort on int data, variable named 'seq', 5 elements. |
38 | JavaScript | Sorting Algorithm | intermediate | Sort a 5-element array of ints in ascending order using bubble sort. | function bubbleSort(data) {
const n = data.length;
for (let i = 0; i < n; i++) {
for (let j = 0; j < n - i - 1; j++) {
if (data[j] > data[j + 1]) {
[data[j], data[j + 1]] = [data[j + 1], data[j]];
}
}
}
return data;
}
console.log(bubbleSort([10, 29, 7, 0, -13])); | Bubble sort on int data, variable named 'data', 5 elements. |
39 | JavaScript | Sorting Algorithm | intermediate | Sort a 5-element array of ints in ascending order using bubble sort. | function bubbleSort(arr) {
const n = arr.length;
for (let i = 0; i < n; i++) {
for (let j = 0; j < n - i - 1; j++) {
if (arr[j] > arr[j + 1]) {
[arr[j], arr[j + 1]] = [arr[j + 1], arr[j]];
}
}
}
return arr;
}
console.log(bubbleSort([-39, 12, 71, -32, 66])); | Bubble sort on int data, variable named 'arr', 5 elements. |
40 | JavaScript | Sorting Algorithm | intermediate | Sort a 8-element array of ints in ascending order using bubble sort. | function bubbleSort(collection) {
const n = collection.length;
for (let i = 0; i < n; i++) {
for (let j = 0; j < n - i - 1; j++) {
if (collection[j] > collection[j + 1]) {
[collection[j], collection[j + 1]] = [collection[j + 1], collection[j]];
}
}
}
return collection;
}
console.log... | Bubble sort on int data, variable named 'collection', 8 elements. |
41 | JavaScript | Sorting Algorithm | intermediate | Sort a 8-element array of ints in ascending order using bubble sort. | function bubbleSort(entries) {
const n = entries.length;
for (let i = 0; i < n; i++) {
for (let j = 0; j < n - i - 1; j++) {
if (entries[j] > entries[j + 1]) {
[entries[j], entries[j + 1]] = [entries[j + 1], entries[j]];
}
}
}
return entries;
}
console.log(bubbleSort([-23, 58, 6, -5... | Bubble sort on int data, variable named 'entries', 8 elements. |
42 | JavaScript | Sorting Algorithm | intermediate | Sort a 8-element array of ints in ascending order using bubble sort. | function bubbleSort(items) {
const n = items.length;
for (let i = 0; i < n; i++) {
for (let j = 0; j < n - i - 1; j++) {
if (items[j] > items[j + 1]) {
[items[j], items[j + 1]] = [items[j + 1], items[j]];
}
}
}
return items;
}
console.log(bubbleSort([-19, 66, -16, 68, 85, 93, 31, 63... | Bubble sort on int data, variable named 'items', 8 elements. |
43 | JavaScript | Sorting Algorithm | intermediate | Sort a 10-element array of ints in ascending order using bubble sort. | function bubbleSort(elements) {
const n = elements.length;
for (let i = 0; i < n; i++) {
for (let j = 0; j < n - i - 1; j++) {
if (elements[j] > elements[j + 1]) {
[elements[j], elements[j + 1]] = [elements[j + 1], elements[j]];
}
}
}
return elements;
}
console.log(bubbleSort([79, 5... | Bubble sort on int data, variable named 'elements', 10 elements. |
44 | JavaScript | Sorting Algorithm | intermediate | Sort a 10-element array of ints in ascending order using bubble sort. | function bubbleSort(vals) {
const n = vals.length;
for (let i = 0; i < n; i++) {
for (let j = 0; j < n - i - 1; j++) {
if (vals[j] > vals[j + 1]) {
[vals[j], vals[j + 1]] = [vals[j + 1], vals[j]];
}
}
}
return vals;
}
console.log(bubbleSort([83, 74, 11, 20, 62, -31, 23, 10, 19, 35])... | Bubble sort on int data, variable named 'vals', 10 elements. |
45 | JavaScript | Sorting Algorithm | intermediate | Sort a 10-element array of ints in ascending order using bubble sort. | function bubbleSort(list1) {
const n = list1.length;
for (let i = 0; i < n; i++) {
for (let j = 0; j < n - i - 1; j++) {
if (list1[j] > list1[j + 1]) {
[list1[j], list1[j + 1]] = [list1[j + 1], list1[j]];
}
}
}
return list1;
}
console.log(bubbleSort([88, -30, -15, -12, 9, 48, -11, 4... | Bubble sort on int data, variable named 'list1', 10 elements. |
46 | JavaScript | Sorting Algorithm | intermediate | Sort a 12-element array of ints in ascending order using bubble sort. | function bubbleSort(collection) {
const n = collection.length;
for (let i = 0; i < n; i++) {
for (let j = 0; j < n - i - 1; j++) {
if (collection[j] > collection[j + 1]) {
[collection[j], collection[j + 1]] = [collection[j + 1], collection[j]];
}
}
}
return collection;
}
console.log... | Bubble sort on int data, variable named 'collection', 12 elements. |
47 | JavaScript | Sorting Algorithm | intermediate | Sort a 12-element array of ints in ascending order using bubble sort. | function bubbleSort(dataset) {
const n = dataset.length;
for (let i = 0; i < n; i++) {
for (let j = 0; j < n - i - 1; j++) {
if (dataset[j] > dataset[j + 1]) {
[dataset[j], dataset[j + 1]] = [dataset[j + 1], dataset[j]];
}
}
}
return dataset;
}
console.log(bubbleSort([-49, 40, 26, 4... | Bubble sort on int data, variable named 'dataset', 12 elements. |
48 | JavaScript | Sorting Algorithm | intermediate | Sort a 12-element array of ints in ascending order using bubble sort. | function bubbleSort(dataset) {
const n = dataset.length;
for (let i = 0; i < n; i++) {
for (let j = 0; j < n - i - 1; j++) {
if (dataset[j] > dataset[j + 1]) {
[dataset[j], dataset[j + 1]] = [dataset[j + 1], dataset[j]];
}
}
}
return dataset;
}
console.log(bubbleSort([-43, 49, 36, 5... | Bubble sort on int data, variable named 'dataset', 12 elements. |
49 | JavaScript | Sorting Algorithm | intermediate | Sort a 15-element array of ints in ascending order using bubble sort. | function bubbleSort(data) {
const n = data.length;
for (let i = 0; i < n; i++) {
for (let j = 0; j < n - i - 1; j++) {
if (data[j] > data[j + 1]) {
[data[j], data[j + 1]] = [data[j + 1], data[j]];
}
}
}
return data;
}
console.log(bubbleSort([59, -16, 68, -4, -38, 16, 47, 33, 4, 66, ... | Bubble sort on int data, variable named 'data', 15 elements. |
50 | JavaScript | Sorting Algorithm | intermediate | Sort a 15-element array of ints in ascending order using bubble sort. | function bubbleSort(nums) {
const n = nums.length;
for (let i = 0; i < n; i++) {
for (let j = 0; j < n - i - 1; j++) {
if (nums[j] > nums[j + 1]) {
[nums[j], nums[j + 1]] = [nums[j + 1], nums[j]];
}
}
}
return nums;
}
console.log(bubbleSort([-30, 70, -46, 88, -37, 39, 7, -33, -40, -... | Bubble sort on int data, variable named 'nums', 15 elements. |
51 | JavaScript | Sorting Algorithm | intermediate | Sort a 15-element array of ints in ascending order using bubble sort. | function bubbleSort(values) {
const n = values.length;
for (let i = 0; i < n; i++) {
for (let j = 0; j < n - i - 1; j++) {
if (values[j] > values[j + 1]) {
[values[j], values[j + 1]] = [values[j + 1], values[j]];
}
}
}
return values;
}
console.log(bubbleSort([71, -21, 94, 5, 69, 15,... | Bubble sort on int data, variable named 'values', 15 elements. |
52 | JavaScript | Sorting Algorithm | intermediate | Sort a 20-element array of ints in ascending order using bubble sort. | function bubbleSort(elements) {
const n = elements.length;
for (let i = 0; i < n; i++) {
for (let j = 0; j < n - i - 1; j++) {
if (elements[j] > elements[j + 1]) {
[elements[j], elements[j + 1]] = [elements[j + 1], elements[j]];
}
}
}
return elements;
}
console.log(bubbleSort([46, 5... | Bubble sort on int data, variable named 'elements', 20 elements. |
53 | JavaScript | Sorting Algorithm | intermediate | Sort a 20-element array of ints in ascending order using bubble sort. | function bubbleSort(data) {
const n = data.length;
for (let i = 0; i < n; i++) {
for (let j = 0; j < n - i - 1; j++) {
if (data[j] > data[j + 1]) {
[data[j], data[j + 1]] = [data[j + 1], data[j]];
}
}
}
return data;
}
console.log(bubbleSort([60, 42, 67, -11, 61, -5, 83, 19, 87, 73, ... | Bubble sort on int data, variable named 'data', 20 elements. |
54 | JavaScript | Sorting Algorithm | intermediate | Sort a 20-element array of ints in ascending order using bubble sort. | function bubbleSort(elements) {
const n = elements.length;
for (let i = 0; i < n; i++) {
for (let j = 0; j < n - i - 1; j++) {
if (elements[j] > elements[j + 1]) {
[elements[j], elements[j + 1]] = [elements[j + 1], elements[j]];
}
}
}
return elements;
}
console.log(bubbleSort([47, 3... | Bubble sort on int data, variable named 'elements', 20 elements. |
55 | JavaScript | Sorting Algorithm | intermediate | Sort a 5-element array of floats in ascending order using bubble sort. | function bubbleSort(dataset) {
const n = dataset.length;
for (let i = 0; i < n; i++) {
for (let j = 0; j < n - i - 1; j++) {
if (dataset[j] > dataset[j + 1]) {
[dataset[j], dataset[j + 1]] = [dataset[j + 1], dataset[j]];
}
}
}
return dataset;
}
console.log(bubbleSort([46.07, 8.6, 36... | Bubble sort on float data, variable named 'dataset', 5 elements. |
56 | JavaScript | Sorting Algorithm | intermediate | Sort a 5-element array of floats in ascending order using bubble sort. | function bubbleSort(arr) {
const n = arr.length;
for (let i = 0; i < n; i++) {
for (let j = 0; j < n - i - 1; j++) {
if (arr[j] > arr[j + 1]) {
[arr[j], arr[j + 1]] = [arr[j + 1], arr[j]];
}
}
}
return arr;
}
console.log(bubbleSort([-8.93, 6.37, 62.32, 16.44, 49.21])); | Bubble sort on float data, variable named 'arr', 5 elements. |
57 | JavaScript | Sorting Algorithm | intermediate | Sort a 5-element array of floats in ascending order using bubble sort. | function bubbleSort(dataset) {
const n = dataset.length;
for (let i = 0; i < n; i++) {
for (let j = 0; j < n - i - 1; j++) {
if (dataset[j] > dataset[j + 1]) {
[dataset[j], dataset[j + 1]] = [dataset[j + 1], dataset[j]];
}
}
}
return dataset;
}
console.log(bubbleSort([45.86, 20.91, ... | Bubble sort on float data, variable named 'dataset', 5 elements. |
58 | JavaScript | Sorting Algorithm | intermediate | Sort a 8-element array of floats in ascending order using bubble sort. | function bubbleSort(dataset) {
const n = dataset.length;
for (let i = 0; i < n; i++) {
for (let j = 0; j < n - i - 1; j++) {
if (dataset[j] > dataset[j + 1]) {
[dataset[j], dataset[j + 1]] = [dataset[j + 1], dataset[j]];
}
}
}
return dataset;
}
console.log(bubbleSort([12.24, 9.92, -... | Bubble sort on float data, variable named 'dataset', 8 elements. |
59 | JavaScript | Sorting Algorithm | intermediate | Sort a 8-element array of floats in ascending order using bubble sort. | function bubbleSort(items) {
const n = items.length;
for (let i = 0; i < n; i++) {
for (let j = 0; j < n - i - 1; j++) {
if (items[j] > items[j + 1]) {
[items[j], items[j + 1]] = [items[j + 1], items[j]];
}
}
}
return items;
}
console.log(bubbleSort([67.89, 12.9, 50.16, 70.46, 51.02... | Bubble sort on float data, variable named 'items', 8 elements. |
60 | JavaScript | Sorting Algorithm | intermediate | Sort a 8-element array of floats in ascending order using bubble sort. | function bubbleSort(list1) {
const n = list1.length;
for (let i = 0; i < n; i++) {
for (let j = 0; j < n - i - 1; j++) {
if (list1[j] > list1[j + 1]) {
[list1[j], list1[j + 1]] = [list1[j + 1], list1[j]];
}
}
}
return list1;
}
console.log(bubbleSort([1.35, -18.32, 43.56, 12.64, 95.9... | Bubble sort on float data, variable named 'list1', 8 elements. |
61 | JavaScript | Sorting Algorithm | intermediate | Sort a 10-element array of floats in ascending order using bubble sort. | function bubbleSort(records) {
const n = records.length;
for (let i = 0; i < n; i++) {
for (let j = 0; j < n - i - 1; j++) {
if (records[j] > records[j + 1]) {
[records[j], records[j + 1]] = [records[j + 1], records[j]];
}
}
}
return records;
}
console.log(bubbleSort([69.58, -7.79, ... | Bubble sort on float data, variable named 'records', 10 elements. |
62 | JavaScript | Sorting Algorithm | intermediate | Sort a 10-element array of floats in ascending order using bubble sort. | function bubbleSort(data) {
const n = data.length;
for (let i = 0; i < n; i++) {
for (let j = 0; j < n - i - 1; j++) {
if (data[j] > data[j + 1]) {
[data[j], data[j + 1]] = [data[j + 1], data[j]];
}
}
}
return data;
}
console.log(bubbleSort([27.68, -11.18, 54.9, -13.62, -2.25, 46.98... | Bubble sort on float data, variable named 'data', 10 elements. |
63 | JavaScript | Sorting Algorithm | intermediate | Sort a 10-element array of floats in ascending order using bubble sort. | function bubbleSort(elements) {
const n = elements.length;
for (let i = 0; i < n; i++) {
for (let j = 0; j < n - i - 1; j++) {
if (elements[j] > elements[j + 1]) {
[elements[j], elements[j + 1]] = [elements[j + 1], elements[j]];
}
}
}
return elements;
}
console.log(bubbleSort([50.94... | Bubble sort on float data, variable named 'elements', 10 elements. |
64 | JavaScript | Sorting Algorithm | intermediate | Sort a 12-element array of floats in ascending order using bubble sort. | function bubbleSort(seq) {
const n = seq.length;
for (let i = 0; i < n; i++) {
for (let j = 0; j < n - i - 1; j++) {
if (seq[j] > seq[j + 1]) {
[seq[j], seq[j + 1]] = [seq[j + 1], seq[j]];
}
}
}
return seq;
}
console.log(bubbleSort([-8.19, 70.77, 54.44, 11.49, -10.34, 8.54, 45.69, -... | Bubble sort on float data, variable named 'seq', 12 elements. |
65 | JavaScript | Sorting Algorithm | intermediate | Sort a 12-element array of floats in ascending order using bubble sort. | function bubbleSort(nums) {
const n = nums.length;
for (let i = 0; i < n; i++) {
for (let j = 0; j < n - i - 1; j++) {
if (nums[j] > nums[j + 1]) {
[nums[j], nums[j + 1]] = [nums[j + 1], nums[j]];
}
}
}
return nums;
}
console.log(bubbleSort([64.13, 63.66, 34.03, 61.8, 89.95, 73.75, ... | Bubble sort on float data, variable named 'nums', 12 elements. |
66 | JavaScript | Sorting Algorithm | intermediate | Sort a 12-element array of floats in ascending order using bubble sort. | function bubbleSort(entries) {
const n = entries.length;
for (let i = 0; i < n; i++) {
for (let j = 0; j < n - i - 1; j++) {
if (entries[j] > entries[j + 1]) {
[entries[j], entries[j + 1]] = [entries[j + 1], entries[j]];
}
}
}
return entries;
}
console.log(bubbleSort([11.61, -3.07, ... | Bubble sort on float data, variable named 'entries', 12 elements. |
67 | JavaScript | Sorting Algorithm | intermediate | Sort a 15-element array of floats in ascending order using bubble sort. | function bubbleSort(input_arr) {
const n = input_arr.length;
for (let i = 0; i < n; i++) {
for (let j = 0; j < n - i - 1; j++) {
if (input_arr[j] > input_arr[j + 1]) {
[input_arr[j], input_arr[j + 1]] = [input_arr[j + 1], input_arr[j]];
}
}
}
return input_arr;
}
console.log(bubbleSo... | Bubble sort on float data, variable named 'input_arr', 15 elements. |
68 | JavaScript | Sorting Algorithm | intermediate | Sort a 15-element array of floats in ascending order using bubble sort. | function bubbleSort(vals) {
const n = vals.length;
for (let i = 0; i < n; i++) {
for (let j = 0; j < n - i - 1; j++) {
if (vals[j] > vals[j + 1]) {
[vals[j], vals[j + 1]] = [vals[j + 1], vals[j]];
}
}
}
return vals;
}
console.log(bubbleSort([0.85, 41.76, 32.63, 13.1, 98.64, 31.87, 7... | Bubble sort on float data, variable named 'vals', 15 elements. |
69 | JavaScript | Sorting Algorithm | intermediate | Sort a 15-element array of floats in ascending order using bubble sort. | function bubbleSort(buffer) {
const n = buffer.length;
for (let i = 0; i < n; i++) {
for (let j = 0; j < n - i - 1; j++) {
if (buffer[j] > buffer[j + 1]) {
[buffer[j], buffer[j + 1]] = [buffer[j + 1], buffer[j]];
}
}
}
return buffer;
}
console.log(bubbleSort([92.48, 76.81, 45.46, 34... | Bubble sort on float data, variable named 'buffer', 15 elements. |
70 | JavaScript | Sorting Algorithm | intermediate | Sort a 20-element array of floats in ascending order using bubble sort. | function bubbleSort(vals) {
const n = vals.length;
for (let i = 0; i < n; i++) {
for (let j = 0; j < n - i - 1; j++) {
if (vals[j] > vals[j + 1]) {
[vals[j], vals[j + 1]] = [vals[j + 1], vals[j]];
}
}
}
return vals;
}
console.log(bubbleSort([39.32, 32.6, -13.86, 11.78, -4.41, 14.28,... | Bubble sort on float data, variable named 'vals', 20 elements. |
71 | JavaScript | Sorting Algorithm | intermediate | Sort a 20-element array of floats in ascending order using bubble sort. | function bubbleSort(values) {
const n = values.length;
for (let i = 0; i < n; i++) {
for (let j = 0; j < n - i - 1; j++) {
if (values[j] > values[j + 1]) {
[values[j], values[j + 1]] = [values[j + 1], values[j]];
}
}
}
return values;
}
console.log(bubbleSort([39.31, 65.28, 40.56, 12... | Bubble sort on float data, variable named 'values', 20 elements. |
72 | JavaScript | Sorting Algorithm | intermediate | Sort a 20-element array of floats in ascending order using bubble sort. | function bubbleSort(nums) {
const n = nums.length;
for (let i = 0; i < n; i++) {
for (let j = 0; j < n - i - 1; j++) {
if (nums[j] > nums[j + 1]) {
[nums[j], nums[j + 1]] = [nums[j + 1], nums[j]];
}
}
}
return nums;
}
console.log(bubbleSort([79.66, 49.01, 58.53, 82.97, 33.14, 37.64,... | Bubble sort on float data, variable named 'nums', 20 elements. |
73 | Node.js | Sorting Algorithm | intermediate | Sort a 5-element array of ints in ascending order using bubble sort. | function bubbleSort(buffer) {
const n = buffer.length;
for (let i = 0; i < n; i++) {
for (let j = 0; j < n - i - 1; j++) {
if (buffer[j] > buffer[j + 1]) {
[buffer[j], buffer[j + 1]] = [buffer[j + 1], buffer[j]];
}
}
}
return buffer;
}
module.exports = { bubbleSort };
console.log(bu... | Bubble sort on int data, variable named 'buffer', 5 elements. |
74 | Node.js | Sorting Algorithm | intermediate | Sort a 5-element array of ints in ascending order using bubble sort. | function bubbleSort(elements) {
const n = elements.length;
for (let i = 0; i < n; i++) {
for (let j = 0; j < n - i - 1; j++) {
if (elements[j] > elements[j + 1]) {
[elements[j], elements[j + 1]] = [elements[j + 1], elements[j]];
}
}
}
return elements;
}
module.exports = { bubbleSort... | Bubble sort on int data, variable named 'elements', 5 elements. |
75 | Node.js | Sorting Algorithm | intermediate | Sort a 5-element array of ints in ascending order using bubble sort. | function bubbleSort(entries) {
const n = entries.length;
for (let i = 0; i < n; i++) {
for (let j = 0; j < n - i - 1; j++) {
if (entries[j] > entries[j + 1]) {
[entries[j], entries[j + 1]] = [entries[j + 1], entries[j]];
}
}
}
return entries;
}
module.exports = { bubbleSort };
conso... | Bubble sort on int data, variable named 'entries', 5 elements. |
76 | Node.js | Sorting Algorithm | intermediate | Sort a 8-element array of ints in ascending order using bubble sort. | function bubbleSort(data) {
const n = data.length;
for (let i = 0; i < n; i++) {
for (let j = 0; j < n - i - 1; j++) {
if (data[j] > data[j + 1]) {
[data[j], data[j + 1]] = [data[j + 1], data[j]];
}
}
}
return data;
}
module.exports = { bubbleSort };
console.log(bubbleSort([70, 17, ... | Bubble sort on int data, variable named 'data', 8 elements. |
77 | Node.js | Sorting Algorithm | intermediate | Sort a 8-element array of ints in ascending order using bubble sort. | function bubbleSort(list1) {
const n = list1.length;
for (let i = 0; i < n; i++) {
for (let j = 0; j < n - i - 1; j++) {
if (list1[j] > list1[j + 1]) {
[list1[j], list1[j + 1]] = [list1[j + 1], list1[j]];
}
}
}
return list1;
}
module.exports = { bubbleSort };
console.log(bubbleSort(... | Bubble sort on int data, variable named 'list1', 8 elements. |
78 | Node.js | Sorting Algorithm | intermediate | Sort a 8-element array of ints in ascending order using bubble sort. | function bubbleSort(collection) {
const n = collection.length;
for (let i = 0; i < n; i++) {
for (let j = 0; j < n - i - 1; j++) {
if (collection[j] > collection[j + 1]) {
[collection[j], collection[j + 1]] = [collection[j + 1], collection[j]];
}
}
}
return collection;
}
module.expo... | Bubble sort on int data, variable named 'collection', 8 elements. |
79 | Node.js | Sorting Algorithm | intermediate | Sort a 10-element array of ints in ascending order using bubble sort. | function bubbleSort(vals) {
const n = vals.length;
for (let i = 0; i < n; i++) {
for (let j = 0; j < n - i - 1; j++) {
if (vals[j] > vals[j + 1]) {
[vals[j], vals[j + 1]] = [vals[j + 1], vals[j]];
}
}
}
return vals;
}
module.exports = { bubbleSort };
console.log(bubbleSort([-36, 25,... | Bubble sort on int data, variable named 'vals', 10 elements. |
80 | Node.js | Sorting Algorithm | intermediate | Sort a 10-element array of ints in ascending order using bubble sort. | function bubbleSort(buffer) {
const n = buffer.length;
for (let i = 0; i < n; i++) {
for (let j = 0; j < n - i - 1; j++) {
if (buffer[j] > buffer[j + 1]) {
[buffer[j], buffer[j + 1]] = [buffer[j + 1], buffer[j]];
}
}
}
return buffer;
}
module.exports = { bubbleSort };
console.log(bu... | Bubble sort on int data, variable named 'buffer', 10 elements. |
81 | Node.js | Sorting Algorithm | intermediate | Sort a 10-element array of ints in ascending order using bubble sort. | function bubbleSort(dataset) {
const n = dataset.length;
for (let i = 0; i < n; i++) {
for (let j = 0; j < n - i - 1; j++) {
if (dataset[j] > dataset[j + 1]) {
[dataset[j], dataset[j + 1]] = [dataset[j + 1], dataset[j]];
}
}
}
return dataset;
}
module.exports = { bubbleSort };
conso... | Bubble sort on int data, variable named 'dataset', 10 elements. |
82 | Node.js | Sorting Algorithm | intermediate | Sort a 12-element array of ints in ascending order using bubble sort. | function bubbleSort(list1) {
const n = list1.length;
for (let i = 0; i < n; i++) {
for (let j = 0; j < n - i - 1; j++) {
if (list1[j] > list1[j + 1]) {
[list1[j], list1[j + 1]] = [list1[j + 1], list1[j]];
}
}
}
return list1;
}
module.exports = { bubbleSort };
console.log(bubbleSort(... | Bubble sort on int data, variable named 'list1', 12 elements. |
83 | Node.js | Sorting Algorithm | intermediate | Sort a 12-element array of ints in ascending order using bubble sort. | function bubbleSort(list1) {
const n = list1.length;
for (let i = 0; i < n; i++) {
for (let j = 0; j < n - i - 1; j++) {
if (list1[j] > list1[j + 1]) {
[list1[j], list1[j + 1]] = [list1[j + 1], list1[j]];
}
}
}
return list1;
}
module.exports = { bubbleSort };
console.log(bubbleSort(... | Bubble sort on int data, variable named 'list1', 12 elements. |
84 | Node.js | Sorting Algorithm | intermediate | Sort a 12-element array of ints in ascending order using bubble sort. | function bubbleSort(elements) {
const n = elements.length;
for (let i = 0; i < n; i++) {
for (let j = 0; j < n - i - 1; j++) {
if (elements[j] > elements[j + 1]) {
[elements[j], elements[j + 1]] = [elements[j + 1], elements[j]];
}
}
}
return elements;
}
module.exports = { bubbleSort... | Bubble sort on int data, variable named 'elements', 12 elements. |
85 | Node.js | Sorting Algorithm | intermediate | Sort a 15-element array of ints in ascending order using bubble sort. | function bubbleSort(seq) {
const n = seq.length;
for (let i = 0; i < n; i++) {
for (let j = 0; j < n - i - 1; j++) {
if (seq[j] > seq[j + 1]) {
[seq[j], seq[j + 1]] = [seq[j + 1], seq[j]];
}
}
}
return seq;
}
module.exports = { bubbleSort };
console.log(bubbleSort([-17, -27, 25, 33,... | Bubble sort on int data, variable named 'seq', 15 elements. |
86 | Node.js | Sorting Algorithm | intermediate | Sort a 15-element array of ints in ascending order using bubble sort. | function bubbleSort(entries) {
const n = entries.length;
for (let i = 0; i < n; i++) {
for (let j = 0; j < n - i - 1; j++) {
if (entries[j] > entries[j + 1]) {
[entries[j], entries[j + 1]] = [entries[j + 1], entries[j]];
}
}
}
return entries;
}
module.exports = { bubbleSort };
conso... | Bubble sort on int data, variable named 'entries', 15 elements. |
87 | Node.js | Sorting Algorithm | intermediate | Sort a 15-element array of ints in ascending order using bubble sort. | function bubbleSort(input_arr) {
const n = input_arr.length;
for (let i = 0; i < n; i++) {
for (let j = 0; j < n - i - 1; j++) {
if (input_arr[j] > input_arr[j + 1]) {
[input_arr[j], input_arr[j + 1]] = [input_arr[j + 1], input_arr[j]];
}
}
}
return input_arr;
}
module.exports = { b... | Bubble sort on int data, variable named 'input_arr', 15 elements. |
88 | Node.js | Sorting Algorithm | intermediate | Sort a 20-element array of ints in ascending order using bubble sort. | function bubbleSort(buffer) {
const n = buffer.length;
for (let i = 0; i < n; i++) {
for (let j = 0; j < n - i - 1; j++) {
if (buffer[j] > buffer[j + 1]) {
[buffer[j], buffer[j + 1]] = [buffer[j + 1], buffer[j]];
}
}
}
return buffer;
}
module.exports = { bubbleSort };
console.log(bu... | Bubble sort on int data, variable named 'buffer', 20 elements. |
89 | Node.js | Sorting Algorithm | intermediate | Sort a 20-element array of ints in ascending order using bubble sort. | function bubbleSort(entries) {
const n = entries.length;
for (let i = 0; i < n; i++) {
for (let j = 0; j < n - i - 1; j++) {
if (entries[j] > entries[j + 1]) {
[entries[j], entries[j + 1]] = [entries[j + 1], entries[j]];
}
}
}
return entries;
}
module.exports = { bubbleSort };
conso... | Bubble sort on int data, variable named 'entries', 20 elements. |
90 | Node.js | Sorting Algorithm | intermediate | Sort a 20-element array of ints in ascending order using bubble sort. | function bubbleSort(data) {
const n = data.length;
for (let i = 0; i < n; i++) {
for (let j = 0; j < n - i - 1; j++) {
if (data[j] > data[j + 1]) {
[data[j], data[j + 1]] = [data[j + 1], data[j]];
}
}
}
return data;
}
module.exports = { bubbleSort };
console.log(bubbleSort([66, -27,... | Bubble sort on int data, variable named 'data', 20 elements. |
91 | Node.js | Sorting Algorithm | intermediate | Sort a 5-element array of floats in ascending order using bubble sort. | function bubbleSort(values) {
const n = values.length;
for (let i = 0; i < n; i++) {
for (let j = 0; j < n - i - 1; j++) {
if (values[j] > values[j + 1]) {
[values[j], values[j + 1]] = [values[j + 1], values[j]];
}
}
}
return values;
}
module.exports = { bubbleSort };
console.log(bu... | Bubble sort on float data, variable named 'values', 5 elements. |
92 | Node.js | Sorting Algorithm | intermediate | Sort a 5-element array of floats in ascending order using bubble sort. | function bubbleSort(list1) {
const n = list1.length;
for (let i = 0; i < n; i++) {
for (let j = 0; j < n - i - 1; j++) {
if (list1[j] > list1[j + 1]) {
[list1[j], list1[j + 1]] = [list1[j + 1], list1[j]];
}
}
}
return list1;
}
module.exports = { bubbleSort };
console.log(bubbleSort(... | Bubble sort on float data, variable named 'list1', 5 elements. |
93 | Node.js | Sorting Algorithm | intermediate | Sort a 5-element array of floats in ascending order using bubble sort. | function bubbleSort(seq) {
const n = seq.length;
for (let i = 0; i < n; i++) {
for (let j = 0; j < n - i - 1; j++) {
if (seq[j] > seq[j + 1]) {
[seq[j], seq[j + 1]] = [seq[j + 1], seq[j]];
}
}
}
return seq;
}
module.exports = { bubbleSort };
console.log(bubbleSort([30.09, -6.48, -12... | Bubble sort on float data, variable named 'seq', 5 elements. |
94 | Node.js | Sorting Algorithm | intermediate | Sort a 8-element array of floats in ascending order using bubble sort. | function bubbleSort(elements) {
const n = elements.length;
for (let i = 0; i < n; i++) {
for (let j = 0; j < n - i - 1; j++) {
if (elements[j] > elements[j + 1]) {
[elements[j], elements[j + 1]] = [elements[j + 1], elements[j]];
}
}
}
return elements;
}
module.exports = { bubbleSort... | Bubble sort on float data, variable named 'elements', 8 elements. |
95 | Node.js | Sorting Algorithm | intermediate | Sort a 8-element array of floats in ascending order using bubble sort. | function bubbleSort(arr) {
const n = arr.length;
for (let i = 0; i < n; i++) {
for (let j = 0; j < n - i - 1; j++) {
if (arr[j] > arr[j + 1]) {
[arr[j], arr[j + 1]] = [arr[j + 1], arr[j]];
}
}
}
return arr;
}
module.exports = { bubbleSort };
console.log(bubbleSort([-12.76, 37.0, 27.... | Bubble sort on float data, variable named 'arr', 8 elements. |
96 | Node.js | Sorting Algorithm | intermediate | Sort a 8-element array of floats in ascending order using bubble sort. | function bubbleSort(elements) {
const n = elements.length;
for (let i = 0; i < n; i++) {
for (let j = 0; j < n - i - 1; j++) {
if (elements[j] > elements[j + 1]) {
[elements[j], elements[j + 1]] = [elements[j + 1], elements[j]];
}
}
}
return elements;
}
module.exports = { bubbleSort... | Bubble sort on float data, variable named 'elements', 8 elements. |
97 | Node.js | Sorting Algorithm | intermediate | Sort a 10-element array of floats in ascending order using bubble sort. | function bubbleSort(input_arr) {
const n = input_arr.length;
for (let i = 0; i < n; i++) {
for (let j = 0; j < n - i - 1; j++) {
if (input_arr[j] > input_arr[j + 1]) {
[input_arr[j], input_arr[j + 1]] = [input_arr[j + 1], input_arr[j]];
}
}
}
return input_arr;
}
module.exports = { b... | Bubble sort on float data, variable named 'input_arr', 10 elements. |
98 | Node.js | Sorting Algorithm | intermediate | Sort a 10-element array of floats in ascending order using bubble sort. | function bubbleSort(list1) {
const n = list1.length;
for (let i = 0; i < n; i++) {
for (let j = 0; j < n - i - 1; j++) {
if (list1[j] > list1[j + 1]) {
[list1[j], list1[j + 1]] = [list1[j + 1], list1[j]];
}
}
}
return list1;
}
module.exports = { bubbleSort };
console.log(bubbleSort(... | Bubble sort on float data, variable named 'list1', 10 elements. |
99 | Node.js | Sorting Algorithm | intermediate | Sort a 10-element array of floats in ascending order using bubble sort. | function bubbleSort(data) {
const n = data.length;
for (let i = 0; i < n; i++) {
for (let j = 0; j < n - i - 1; j++) {
if (data[j] > data[j + 1]) {
[data[j], data[j + 1]] = [data[j + 1], data[j]];
}
}
}
return data;
}
module.exports = { bubbleSort };
console.log(bubbleSort([-8.91, -... | Bubble sort on float data, variable named 'data', 10 elements. |
100 | Node.js | Sorting Algorithm | intermediate | Sort a 12-element array of floats in ascending order using bubble sort. | function bubbleSort(buffer) {
const n = buffer.length;
for (let i = 0; i < n; i++) {
for (let j = 0; j < n - i - 1; j++) {
if (buffer[j] > buffer[j + 1]) {
[buffer[j], buffer[j + 1]] = [buffer[j + 1], buffer[j]];
}
}
}
return buffer;
}
module.exports = { bubbleSort };
console.log(bu... | Bubble sort on float data, variable named 'buffer', 12 elements. |
YAML Metadata Warning:The task_categories "text2text-generation" is not in the official list: text-classification, token-classification, table-question-answering, question-answering, zero-shot-classification, translation, summarization, feature-extraction, text-generation, fill-mask, sentence-similarity, text-to-speech, text-to-audio, automatic-speech-recognition, audio-to-audio, audio-classification, audio-text-to-text, voice-activity-detection, depth-estimation, image-classification, object-detection, image-segmentation, text-to-image, image-to-text, image-to-image, image-to-video, unconditional-image-generation, video-classification, reinforcement-learning, robotics, tabular-classification, tabular-regression, tabular-to-text, table-to-text, multiple-choice, text-ranking, text-retrieval, time-series-forecasting, text-to-video, image-text-to-text, image-text-to-image, image-text-to-video, visual-question-answering, document-question-answering, zero-shot-image-classification, graph-ml, mask-generation, zero-shot-object-detection, text-to-3d, image-to-3d, image-feature-extraction, video-text-to-text, keypoint-detection, visual-document-retrieval, any-to-any, video-to-video, other
NOTICE
This was done by me, someone with a learning Disability. So please do bare with me when updating this with more working data.
Multi-Language Programming Code Dataset
A curated dataset of original, non-scraped code examples across 7 programming environments: Python, JavaScript, Node.js, Java, C, C++, and Rust.
The dataset ships in two parts that can be used separately or combined:
| File | Rows | Description |
|---|---|---|
code_dataset.jsonl / .csv |
105 | Hand-written "core concepts" set — one clean example per language per concept (Hello World, OOP, error handling, recursion, async, etc.) |
code_dataset_large.jsonl / .csv |
2,255 | Template-generated, parameter-varied set covering sorting algorithms, data structures, and string manipulation in depth |
Note on Node.js: Node.js is a JavaScript runtime, not a separate language. It's included as its own split because it exposes different APIs (filesystem,
Buffer,process,http, CommonJS modules) than browser-context JavaScript — which is usually what people actually mean by "Node.js code."
Dataset Structure
Both files share the same schema:
| Column | Description |
|---|---|
id |
Unique row identifier (per file) |
language |
One of: Python, JavaScript, Node.js, Java, C, C++, Rust |
category |
Concept/topic covered |
difficulty |
beginner, intermediate, or advanced |
task_description |
Natural-language description of the coding task |
code |
The code snippet solving the task |
explanation |
A short note on the key language feature/idiom used |
code_dataset (105 rows) — Core Concepts
15 categories × 7 languages, one example each: Hello World · Variables and Data Types · Control Flow · Loops · Functions · Arrays and Lists · Dictionaries and Maps · Classes and OOP · Error Handling · File I/O · String Manipulation · Recursion · Sorting Algorithm · Async and Concurrency · Data Structures
code_dataset_large (2,255 rows) — Deep Coverage on 3 Categories
Generated by varying real parameters — algorithm choice, data type, sample values, operation sequences, and identifier names — not by duplicating templates with find-and-replace. Breakdown:
| Category | Rows | What varies |
|---|---|---|
| Sorting Algorithm | 756 | Algorithm (bubble/selection/insertion), data type (int/float), array size (5–20 elements), 3 random samples per config |
| Data Structures | 448 | Stack vs. Queue, data type (int/float), 4 distinct push/pop operation sequences, random values |
| String Manipulation | 1,051 | Operation (palindrome check, reverse, word count, vowel count), 20 distinct test strings, varied function names |
Distribution is balanced across languages (320–326 rows each) and skews
3% collision
rate from small-integer arrays landing on the same random sample).intermediate (1,727) over beginner (528), reflecting the algorithmic focus
of this batch. Exact-duplicate rows were checked and removed (
Files
code_dataset.jsonl/code_dataset_large.jsonl— one JSON object per line (recommended fordatasets.load_dataset("json", ...))code_dataset.csv/code_dataset_large.csv— same data, spreadsheet-friendlygenerate_dataset.py— generator for the 105-row core set (add more languages/categories by addingadd(...)calls)generate_batch.py— generator for the 2,255-row deep-coverage set (add more categories/algorithms by extending the template dicts)
Provenance & License
All code was written from scratch (hand-authored for the core set; programmatically templated with varied real parameters for the large set) — nothing was scraped from GitHub or any other source, so there are no third-party license conflicts. Released under MIT — free to use, modify, and redistribute, including for model training.
Known Limitations
- The 2,255-row set currently covers only 3 categories in depth (sorting, data structures, strings). Categories like "Hello World" or "Variables" don't have enough genuine variation to scale the same way — padding them would mean shallow repetition rather than useful diversity.
- For large-scale pretraining, pair this with an established corpus like The Stack or CodeSearchNet.
- Snippets favor clarity/idiom over production hardening (minimal input validation) — they teach the pattern, not production-ready code.
Example Rows
Core set:
{
"id": 1,
"language": "Python",
"category": "Hello World",
"difficulty": "beginner",
"task_description": "Print 'Hello, World!' to the console.",
"code": "print(\"Hello, World!\")",
"explanation": "Python's print() function writes text to standard output."
}
Large set:
{
"id": 11,
"language": "Python",
"category": "Sorting Algorithm",
"difficulty": "intermediate",
"task_description": "Sort a 12-element array of ints in ascending order using bubble sort.",
"code": "def bubble_sort(entries):\n n = len(entries)\n ...",
"explanation": "Bubble sort on int data, variable named 'entries', 12 elements."
}
Loading
Hugging Face datasets:
from datasets import load_dataset
core = load_dataset("json", data_files="code_dataset.jsonl")
large = load_dataset("json", data_files="code_dataset_large.jsonl")
Pandas / Kaggle:
import pandas as pd
core = pd.read_csv("code_dataset.csv")
large = pd.read_csv("code_dataset_large.csv")
combined = pd.concat([core, large], ignore_index=True)
Suggested Uses
- Fine-tuning a code-explanation or code-generation model
- Few-shot prompting examples for a coding assistant
- Cross-language idiom comparison (e.g., "how does error handling differ between Python and Rust?")
- Algorithm-variant training data (many sorting/data-structure/string examples with controlled, labeled variation)
- A regression-test seed set for code-generation model evals
Roadmap
The large set can be extended the same way to more categories (recursion,
OOP, error handling, file I/O, async) by adding template functions to
generate_batch.py — happy to keep scaling this up on request.
- Downloads last month
- 36