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 |
|---|---|---|---|---|---|---|
101 | Node.js | Sorting Algorithm | intermediate | Sort a 12-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', 12 elements. |
102 | Node.js | 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;
}
module.exports = { bubbleSort };
console.log(bubbleSort([-16.55, ... | Bubble sort on float data, variable named 'nums', 12 elements. |
103 | Node.js | 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;
}
module.exports = { b... | Bubble sort on float data, variable named 'input_arr', 15 elements. |
104 | Node.js | Sorting Algorithm | intermediate | Sort a 15-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;
}
module.exports = { bubbleSort };
conso... | Bubble sort on float data, variable named 'dataset', 15 elements. |
105 | Node.js | 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;
}
module.exports = { bubbleSort };
console.log(bubbleSort([10.41, 1... | Bubble sort on float data, variable named 'vals', 15 elements. |
106 | Node.js | Sorting Algorithm | intermediate | Sort a 20-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;
}
module.exports = { bubbleSort };
conso... | Bubble sort on float data, variable named 'records', 20 elements. |
107 | Node.js | 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;
}
module.exports = { bubbleSort };
console.log(bubbleSort([0.01, 40... | Bubble sort on float data, variable named 'vals', 20 elements. |
108 | Node.js | Sorting Algorithm | intermediate | Sort a 20-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;
}
module.exports = { bubbleSort };
conso... | Bubble sort on float data, variable named 'dataset', 20 elements. |
109 | Java | Sorting Algorithm | intermediate | Sort a 5-element array of ints in ascending order using bubble sort. | public class Main {
static void bubbleSort(int[] data) {
int n = data.length;
for (int i = 0; i < n; i++) {
for (int j = 0; j < n - i - 1; j++) {
if (data[j] > data[j + 1]) {
int temp = data[j];
data[j] = data[j + 1];
... | Bubble sort on int data, variable named 'data', 5 elements. |
110 | Java | Sorting Algorithm | intermediate | Sort a 5-element array of ints in ascending order using bubble sort. | public class Main {
static void bubbleSort(int[] vals) {
int n = vals.length;
for (int i = 0; i < n; i++) {
for (int j = 0; j < n - i - 1; j++) {
if (vals[j] > vals[j + 1]) {
int temp = vals[j];
vals[j] = vals[j + 1];
... | Bubble sort on int data, variable named 'vals', 5 elements. |
111 | Java | Sorting Algorithm | intermediate | Sort a 5-element array of ints in ascending order using bubble sort. | public class Main {
static void bubbleSort(int[] elements) {
int n = elements.length;
for (int i = 0; i < n; i++) {
for (int j = 0; j < n - i - 1; j++) {
if (elements[j] > elements[j + 1]) {
int temp = elements[j];
elements[j] = ele... | Bubble sort on int data, variable named 'elements', 5 elements. |
112 | Java | Sorting Algorithm | intermediate | Sort a 8-element array of ints in ascending order using bubble sort. | public class Main {
static void bubbleSort(int[] data) {
int n = data.length;
for (int i = 0; i < n; i++) {
for (int j = 0; j < n - i - 1; j++) {
if (data[j] > data[j + 1]) {
int temp = data[j];
data[j] = data[j + 1];
... | Bubble sort on int data, variable named 'data', 8 elements. |
113 | Java | Sorting Algorithm | intermediate | Sort a 8-element array of ints in ascending order using bubble sort. | public class Main {
static void bubbleSort(int[] input_arr) {
int n = input_arr.length;
for (int i = 0; i < n; i++) {
for (int j = 0; j < n - i - 1; j++) {
if (input_arr[j] > input_arr[j + 1]) {
int temp = input_arr[j];
input_arr[j]... | Bubble sort on int data, variable named 'input_arr', 8 elements. |
114 | Java | Sorting Algorithm | intermediate | Sort a 8-element array of ints in ascending order using bubble sort. | public class Main {
static void bubbleSort(int[] buffer) {
int n = buffer.length;
for (int i = 0; i < n; i++) {
for (int j = 0; j < n - i - 1; j++) {
if (buffer[j] > buffer[j + 1]) {
int temp = buffer[j];
buffer[j] = buffer[j + 1];
... | Bubble sort on int data, variable named 'buffer', 8 elements. |
115 | Java | Sorting Algorithm | intermediate | Sort a 10-element array of ints in ascending order using bubble sort. | public class Main {
static void bubbleSort(int[] nums) {
int n = nums.length;
for (int i = 0; i < n; i++) {
for (int j = 0; j < n - i - 1; j++) {
if (nums[j] > nums[j + 1]) {
int temp = nums[j];
nums[j] = nums[j + 1];
... | Bubble sort on int data, variable named 'nums', 10 elements. |
116 | Java | Sorting Algorithm | intermediate | Sort a 10-element array of ints in ascending order using bubble sort. | public class Main {
static void bubbleSort(int[] nums) {
int n = nums.length;
for (int i = 0; i < n; i++) {
for (int j = 0; j < n - i - 1; j++) {
if (nums[j] > nums[j + 1]) {
int temp = nums[j];
nums[j] = nums[j + 1];
... | Bubble sort on int data, variable named 'nums', 10 elements. |
117 | Java | Sorting Algorithm | intermediate | Sort a 10-element array of ints in ascending order using bubble sort. | public class Main {
static void bubbleSort(int[] list1) {
int n = list1.length;
for (int i = 0; i < n; i++) {
for (int j = 0; j < n - i - 1; j++) {
if (list1[j] > list1[j + 1]) {
int temp = list1[j];
list1[j] = list1[j + 1];
... | Bubble sort on int data, variable named 'list1', 10 elements. |
118 | Java | Sorting Algorithm | intermediate | Sort a 12-element array of ints in ascending order using bubble sort. | public class Main {
static void bubbleSort(int[] nums) {
int n = nums.length;
for (int i = 0; i < n; i++) {
for (int j = 0; j < n - i - 1; j++) {
if (nums[j] > nums[j + 1]) {
int temp = nums[j];
nums[j] = nums[j + 1];
... | Bubble sort on int data, variable named 'nums', 12 elements. |
119 | Java | Sorting Algorithm | intermediate | Sort a 12-element array of ints in ascending order using bubble sort. | public class Main {
static void bubbleSort(int[] seq) {
int n = seq.length;
for (int i = 0; i < n; i++) {
for (int j = 0; j < n - i - 1; j++) {
if (seq[j] > seq[j + 1]) {
int temp = seq[j];
seq[j] = seq[j + 1];
s... | Bubble sort on int data, variable named 'seq', 12 elements. |
120 | Java | Sorting Algorithm | intermediate | Sort a 12-element array of ints in ascending order using bubble sort. | public class Main {
static void bubbleSort(int[] vals) {
int n = vals.length;
for (int i = 0; i < n; i++) {
for (int j = 0; j < n - i - 1; j++) {
if (vals[j] > vals[j + 1]) {
int temp = vals[j];
vals[j] = vals[j + 1];
... | Bubble sort on int data, variable named 'vals', 12 elements. |
121 | Java | Sorting Algorithm | intermediate | Sort a 15-element array of ints in ascending order using bubble sort. | public class Main {
static void bubbleSort(int[] records) {
int n = records.length;
for (int i = 0; i < n; i++) {
for (int j = 0; j < n - i - 1; j++) {
if (records[j] > records[j + 1]) {
int temp = records[j];
records[j] = records[j... | Bubble sort on int data, variable named 'records', 15 elements. |
122 | Java | Sorting Algorithm | intermediate | Sort a 15-element array of ints in ascending order using bubble sort. | public class Main {
static void bubbleSort(int[] entries) {
int n = entries.length;
for (int i = 0; i < n; i++) {
for (int j = 0; j < n - i - 1; j++) {
if (entries[j] > entries[j + 1]) {
int temp = entries[j];
entries[j] = entries[j... | Bubble sort on int data, variable named 'entries', 15 elements. |
123 | Java | Sorting Algorithm | intermediate | Sort a 15-element array of ints in ascending order using bubble sort. | public class Main {
static void bubbleSort(int[] data) {
int n = data.length;
for (int i = 0; i < n; i++) {
for (int j = 0; j < n - i - 1; j++) {
if (data[j] > data[j + 1]) {
int temp = data[j];
data[j] = data[j + 1];
... | Bubble sort on int data, variable named 'data', 15 elements. |
124 | Java | Sorting Algorithm | intermediate | Sort a 20-element array of ints in ascending order using bubble sort. | public class Main {
static void bubbleSort(int[] entries) {
int n = entries.length;
for (int i = 0; i < n; i++) {
for (int j = 0; j < n - i - 1; j++) {
if (entries[j] > entries[j + 1]) {
int temp = entries[j];
entries[j] = entries[j... | Bubble sort on int data, variable named 'entries', 20 elements. |
125 | Java | Sorting Algorithm | intermediate | Sort a 20-element array of ints in ascending order using bubble sort. | public class Main {
static void bubbleSort(int[] elements) {
int n = elements.length;
for (int i = 0; i < n; i++) {
for (int j = 0; j < n - i - 1; j++) {
if (elements[j] > elements[j + 1]) {
int temp = elements[j];
elements[j] = ele... | Bubble sort on int data, variable named 'elements', 20 elements. |
126 | Java | Sorting Algorithm | intermediate | Sort a 20-element array of ints in ascending order using bubble sort. | public class Main {
static void bubbleSort(int[] input_arr) {
int n = input_arr.length;
for (int i = 0; i < n; i++) {
for (int j = 0; j < n - i - 1; j++) {
if (input_arr[j] > input_arr[j + 1]) {
int temp = input_arr[j];
input_arr[j]... | Bubble sort on int data, variable named 'input_arr', 20 elements. |
127 | Java | Sorting Algorithm | intermediate | Sort a 5-element array of floats in ascending order using bubble sort. | public class Main {
static void bubbleSort(double[] input_arr) {
int n = input_arr.length;
for (int i = 0; i < n; i++) {
for (int j = 0; j < n - i - 1; j++) {
if (input_arr[j] > input_arr[j + 1]) {
double temp = input_arr[j];
input_... | Bubble sort on float data, variable named 'input_arr', 5 elements. |
128 | Java | Sorting Algorithm | intermediate | Sort a 5-element array of floats in ascending order using bubble sort. | public class Main {
static void bubbleSort(double[] dataset) {
int n = dataset.length;
for (int i = 0; i < n; i++) {
for (int j = 0; j < n - i - 1; j++) {
if (dataset[j] > dataset[j + 1]) {
double temp = dataset[j];
dataset[j] = dat... | Bubble sort on float data, variable named 'dataset', 5 elements. |
129 | Java | Sorting Algorithm | intermediate | Sort a 5-element array of floats in ascending order using bubble sort. | public class Main {
static void bubbleSort(double[] nums) {
int n = nums.length;
for (int i = 0; i < n; i++) {
for (int j = 0; j < n - i - 1; j++) {
if (nums[j] > nums[j + 1]) {
double temp = nums[j];
nums[j] = nums[j + 1];
... | Bubble sort on float data, variable named 'nums', 5 elements. |
130 | Java | Sorting Algorithm | intermediate | Sort a 8-element array of floats in ascending order using bubble sort. | public class Main {
static void bubbleSort(double[] collection) {
int n = collection.length;
for (int i = 0; i < n; i++) {
for (int j = 0; j < n - i - 1; j++) {
if (collection[j] > collection[j + 1]) {
double temp = collection[j];
c... | Bubble sort on float data, variable named 'collection', 8 elements. |
131 | Java | Sorting Algorithm | intermediate | Sort a 8-element array of floats in ascending order using bubble sort. | public class Main {
static void bubbleSort(double[] list1) {
int n = list1.length;
for (int i = 0; i < n; i++) {
for (int j = 0; j < n - i - 1; j++) {
if (list1[j] > list1[j + 1]) {
double temp = list1[j];
list1[j] = list1[j + 1];
... | Bubble sort on float data, variable named 'list1', 8 elements. |
132 | Java | Sorting Algorithm | intermediate | Sort a 8-element array of floats in ascending order using bubble sort. | public class Main {
static void bubbleSort(double[] seq) {
int n = seq.length;
for (int i = 0; i < n; i++) {
for (int j = 0; j < n - i - 1; j++) {
if (seq[j] > seq[j + 1]) {
double temp = seq[j];
seq[j] = seq[j + 1];
... | Bubble sort on float data, variable named 'seq', 8 elements. |
133 | Java | Sorting Algorithm | intermediate | Sort a 10-element array of floats in ascending order using bubble sort. | public class Main {
static void bubbleSort(double[] input_arr) {
int n = input_arr.length;
for (int i = 0; i < n; i++) {
for (int j = 0; j < n - i - 1; j++) {
if (input_arr[j] > input_arr[j + 1]) {
double temp = input_arr[j];
input_... | Bubble sort on float data, variable named 'input_arr', 10 elements. |
134 | Java | Sorting Algorithm | intermediate | Sort a 10-element array of floats in ascending order using bubble sort. | public class Main {
static void bubbleSort(double[] entries) {
int n = entries.length;
for (int i = 0; i < n; i++) {
for (int j = 0; j < n - i - 1; j++) {
if (entries[j] > entries[j + 1]) {
double temp = entries[j];
entries[j] = ent... | Bubble sort on float data, variable named 'entries', 10 elements. |
135 | Java | Sorting Algorithm | intermediate | Sort a 10-element array of floats in ascending order using bubble sort. | public class Main {
static void bubbleSort(double[] arr) {
int n = arr.length;
for (int i = 0; i < n; i++) {
for (int j = 0; j < n - i - 1; j++) {
if (arr[j] > arr[j + 1]) {
double temp = arr[j];
arr[j] = arr[j + 1];
... | Bubble sort on float data, variable named 'arr', 10 elements. |
136 | Java | Sorting Algorithm | intermediate | Sort a 12-element array of floats in ascending order using bubble sort. | public class Main {
static void bubbleSort(double[] buffer) {
int n = buffer.length;
for (int i = 0; i < n; i++) {
for (int j = 0; j < n - i - 1; j++) {
if (buffer[j] > buffer[j + 1]) {
double temp = buffer[j];
buffer[j] = buffer[j ... | Bubble sort on float data, variable named 'buffer', 12 elements. |
137 | Java | Sorting Algorithm | intermediate | Sort a 12-element array of floats in ascending order using bubble sort. | public class Main {
static void bubbleSort(double[] entries) {
int n = entries.length;
for (int i = 0; i < n; i++) {
for (int j = 0; j < n - i - 1; j++) {
if (entries[j] > entries[j + 1]) {
double temp = entries[j];
entries[j] = ent... | Bubble sort on float data, variable named 'entries', 12 elements. |
138 | Java | Sorting Algorithm | intermediate | Sort a 12-element array of floats in ascending order using bubble sort. | public class Main {
static void bubbleSort(double[] dataset) {
int n = dataset.length;
for (int i = 0; i < n; i++) {
for (int j = 0; j < n - i - 1; j++) {
if (dataset[j] > dataset[j + 1]) {
double temp = dataset[j];
dataset[j] = dat... | Bubble sort on float data, variable named 'dataset', 12 elements. |
139 | Java | Sorting Algorithm | intermediate | Sort a 15-element array of floats in ascending order using bubble sort. | public class Main {
static void bubbleSort(double[] values) {
int n = values.length;
for (int i = 0; i < n; i++) {
for (int j = 0; j < n - i - 1; j++) {
if (values[j] > values[j + 1]) {
double temp = values[j];
values[j] = values[j ... | Bubble sort on float data, variable named 'values', 15 elements. |
140 | Java | Sorting Algorithm | intermediate | Sort a 15-element array of floats in ascending order using bubble sort. | public class Main {
static void bubbleSort(double[] seq) {
int n = seq.length;
for (int i = 0; i < n; i++) {
for (int j = 0; j < n - i - 1; j++) {
if (seq[j] > seq[j + 1]) {
double temp = seq[j];
seq[j] = seq[j + 1];
... | Bubble sort on float data, variable named 'seq', 15 elements. |
141 | Java | Sorting Algorithm | intermediate | Sort a 15-element array of floats in ascending order using bubble sort. | public class Main {
static void bubbleSort(double[] input_arr) {
int n = input_arr.length;
for (int i = 0; i < n; i++) {
for (int j = 0; j < n - i - 1; j++) {
if (input_arr[j] > input_arr[j + 1]) {
double temp = input_arr[j];
input_... | Bubble sort on float data, variable named 'input_arr', 15 elements. |
142 | Java | Sorting Algorithm | intermediate | Sort a 20-element array of floats in ascending order using bubble sort. | public class Main {
static void bubbleSort(double[] nums) {
int n = nums.length;
for (int i = 0; i < n; i++) {
for (int j = 0; j < n - i - 1; j++) {
if (nums[j] > nums[j + 1]) {
double temp = nums[j];
nums[j] = nums[j + 1];
... | Bubble sort on float data, variable named 'nums', 20 elements. |
143 | Java | Sorting Algorithm | intermediate | Sort a 20-element array of floats in ascending order using bubble sort. | public class Main {
static void bubbleSort(double[] entries) {
int n = entries.length;
for (int i = 0; i < n; i++) {
for (int j = 0; j < n - i - 1; j++) {
if (entries[j] > entries[j + 1]) {
double temp = entries[j];
entries[j] = ent... | Bubble sort on float data, variable named 'entries', 20 elements. |
144 | Java | Sorting Algorithm | intermediate | Sort a 20-element array of floats in ascending order using bubble sort. | public class Main {
static void bubbleSort(double[] input_arr) {
int n = input_arr.length;
for (int i = 0; i < n; i++) {
for (int j = 0; j < n - i - 1; j++) {
if (input_arr[j] > input_arr[j + 1]) {
double temp = input_arr[j];
input_... | Bubble sort on float data, variable named 'input_arr', 20 elements. |
145 | C | Sorting Algorithm | intermediate | Sort a 5-element array of ints in ascending order using bubble sort. | #include <stdio.h>
void bubble_sort(int data[], int n) {
for (int i = 0; i < n; i++) {
for (int j = 0; j < n - i - 1; j++) {
if (data[j] > data[j + 1]) {
int temp = data[j];
data[j] = data[j + 1];
data[j + 1] = temp;
}
}
}
... | Bubble sort on int data, variable named 'data', 5 elements. |
146 | C | Sorting Algorithm | intermediate | Sort a 5-element array of ints in ascending order using bubble sort. | #include <stdio.h>
void bubble_sort(int elements[], int n) {
for (int i = 0; i < n; i++) {
for (int j = 0; j < n - i - 1; j++) {
if (elements[j] > elements[j + 1]) {
int temp = elements[j];
elements[j] = elements[j + 1];
elements[j + 1] = temp;
... | Bubble sort on int data, variable named 'elements', 5 elements. |
147 | C | Sorting Algorithm | intermediate | Sort a 5-element array of ints in ascending order using bubble sort. | #include <stdio.h>
void bubble_sort(int elements[], int n) {
for (int i = 0; i < n; i++) {
for (int j = 0; j < n - i - 1; j++) {
if (elements[j] > elements[j + 1]) {
int temp = elements[j];
elements[j] = elements[j + 1];
elements[j + 1] = temp;
... | Bubble sort on int data, variable named 'elements', 5 elements. |
148 | C | Sorting Algorithm | intermediate | Sort a 8-element array of ints in ascending order using bubble sort. | #include <stdio.h>
void bubble_sort(int collection[], int n) {
for (int i = 0; i < n; i++) {
for (int j = 0; j < n - i - 1; j++) {
if (collection[j] > collection[j + 1]) {
int temp = collection[j];
collection[j] = collection[j + 1];
collection[j +... | Bubble sort on int data, variable named 'collection', 8 elements. |
149 | C | Sorting Algorithm | intermediate | Sort a 8-element array of ints in ascending order using bubble sort. | #include <stdio.h>
void bubble_sort(int elements[], int n) {
for (int i = 0; i < n; i++) {
for (int j = 0; j < n - i - 1; j++) {
if (elements[j] > elements[j + 1]) {
int temp = elements[j];
elements[j] = elements[j + 1];
elements[j + 1] = temp;
... | Bubble sort on int data, variable named 'elements', 8 elements. |
150 | C | Sorting Algorithm | intermediate | Sort a 8-element array of ints in ascending order using bubble sort. | #include <stdio.h>
void bubble_sort(int dataset[], int n) {
for (int i = 0; i < n; i++) {
for (int j = 0; j < n - i - 1; j++) {
if (dataset[j] > dataset[j + 1]) {
int temp = dataset[j];
dataset[j] = dataset[j + 1];
dataset[j + 1] = temp;
... | Bubble sort on int data, variable named 'dataset', 8 elements. |
151 | C | Sorting Algorithm | intermediate | Sort a 10-element array of ints in ascending order using bubble sort. | #include <stdio.h>
void bubble_sort(int input_arr[], int n) {
for (int i = 0; i < n; i++) {
for (int j = 0; j < n - i - 1; j++) {
if (input_arr[j] > input_arr[j + 1]) {
int temp = input_arr[j];
input_arr[j] = input_arr[j + 1];
input_arr[j + 1] = t... | Bubble sort on int data, variable named 'input_arr', 10 elements. |
152 | C | Sorting Algorithm | intermediate | Sort a 10-element array of ints in ascending order using bubble sort. | #include <stdio.h>
void bubble_sort(int seq[], int n) {
for (int i = 0; i < n; i++) {
for (int j = 0; j < n - i - 1; j++) {
if (seq[j] > seq[j + 1]) {
int temp = seq[j];
seq[j] = seq[j + 1];
seq[j + 1] = temp;
}
}
}
}
int ... | Bubble sort on int data, variable named 'seq', 10 elements. |
153 | C | Sorting Algorithm | intermediate | Sort a 10-element array of ints in ascending order using bubble sort. | #include <stdio.h>
void bubble_sort(int collection[], int n) {
for (int i = 0; i < n; i++) {
for (int j = 0; j < n - i - 1; j++) {
if (collection[j] > collection[j + 1]) {
int temp = collection[j];
collection[j] = collection[j + 1];
collection[j +... | Bubble sort on int data, variable named 'collection', 10 elements. |
154 | C | Sorting Algorithm | intermediate | Sort a 12-element array of ints in ascending order using bubble sort. | #include <stdio.h>
void bubble_sort(int list1[], int n) {
for (int i = 0; i < n; i++) {
for (int j = 0; j < n - i - 1; j++) {
if (list1[j] > list1[j + 1]) {
int temp = list1[j];
list1[j] = list1[j + 1];
list1[j + 1] = temp;
}
}... | Bubble sort on int data, variable named 'list1', 12 elements. |
155 | C | Sorting Algorithm | intermediate | Sort a 12-element array of ints in ascending order using bubble sort. | #include <stdio.h>
void bubble_sort(int elements[], int n) {
for (int i = 0; i < n; i++) {
for (int j = 0; j < n - i - 1; j++) {
if (elements[j] > elements[j + 1]) {
int temp = elements[j];
elements[j] = elements[j + 1];
elements[j + 1] = temp;
... | Bubble sort on int data, variable named 'elements', 12 elements. |
156 | C | Sorting Algorithm | intermediate | Sort a 12-element array of ints in ascending order using bubble sort. | #include <stdio.h>
void bubble_sort(int list1[], int n) {
for (int i = 0; i < n; i++) {
for (int j = 0; j < n - i - 1; j++) {
if (list1[j] > list1[j + 1]) {
int temp = list1[j];
list1[j] = list1[j + 1];
list1[j + 1] = temp;
}
}... | Bubble sort on int data, variable named 'list1', 12 elements. |
157 | C | Sorting Algorithm | intermediate | Sort a 15-element array of ints in ascending order using bubble sort. | #include <stdio.h>
void bubble_sort(int list1[], int n) {
for (int i = 0; i < n; i++) {
for (int j = 0; j < n - i - 1; j++) {
if (list1[j] > list1[j + 1]) {
int temp = list1[j];
list1[j] = list1[j + 1];
list1[j + 1] = temp;
}
}... | Bubble sort on int data, variable named 'list1', 15 elements. |
158 | C | Sorting Algorithm | intermediate | Sort a 15-element array of ints in ascending order using bubble sort. | #include <stdio.h>
void bubble_sort(int input_arr[], int n) {
for (int i = 0; i < n; i++) {
for (int j = 0; j < n - i - 1; j++) {
if (input_arr[j] > input_arr[j + 1]) {
int temp = input_arr[j];
input_arr[j] = input_arr[j + 1];
input_arr[j + 1] = t... | Bubble sort on int data, variable named 'input_arr', 15 elements. |
159 | C | Sorting Algorithm | intermediate | Sort a 15-element array of ints in ascending order using bubble sort. | #include <stdio.h>
void bubble_sort(int collection[], int n) {
for (int i = 0; i < n; i++) {
for (int j = 0; j < n - i - 1; j++) {
if (collection[j] > collection[j + 1]) {
int temp = collection[j];
collection[j] = collection[j + 1];
collection[j +... | Bubble sort on int data, variable named 'collection', 15 elements. |
160 | C | Sorting Algorithm | intermediate | Sort a 20-element array of ints in ascending order using bubble sort. | #include <stdio.h>
void bubble_sort(int entries[], int n) {
for (int i = 0; i < n; i++) {
for (int j = 0; j < n - i - 1; j++) {
if (entries[j] > entries[j + 1]) {
int temp = entries[j];
entries[j] = entries[j + 1];
entries[j + 1] = temp;
... | Bubble sort on int data, variable named 'entries', 20 elements. |
161 | C | Sorting Algorithm | intermediate | Sort a 20-element array of ints in ascending order using bubble sort. | #include <stdio.h>
void bubble_sort(int collection[], int n) {
for (int i = 0; i < n; i++) {
for (int j = 0; j < n - i - 1; j++) {
if (collection[j] > collection[j + 1]) {
int temp = collection[j];
collection[j] = collection[j + 1];
collection[j +... | Bubble sort on int data, variable named 'collection', 20 elements. |
162 | C | Sorting Algorithm | intermediate | Sort a 20-element array of ints in ascending order using bubble sort. | #include <stdio.h>
void bubble_sort(int entries[], int n) {
for (int i = 0; i < n; i++) {
for (int j = 0; j < n - i - 1; j++) {
if (entries[j] > entries[j + 1]) {
int temp = entries[j];
entries[j] = entries[j + 1];
entries[j + 1] = temp;
... | Bubble sort on int data, variable named 'entries', 20 elements. |
163 | C | Sorting Algorithm | intermediate | Sort a 5-element array of floats in ascending order using bubble sort. | #include <stdio.h>
void bubble_sort(double buffer[], int n) {
for (int i = 0; i < n; i++) {
for (int j = 0; j < n - i - 1; j++) {
if (buffer[j] > buffer[j + 1]) {
double temp = buffer[j];
buffer[j] = buffer[j + 1];
buffer[j + 1] = temp;
... | Bubble sort on float data, variable named 'buffer', 5 elements. |
164 | C | Sorting Algorithm | intermediate | Sort a 5-element array of floats in ascending order using bubble sort. | #include <stdio.h>
void bubble_sort(double vals[], int n) {
for (int i = 0; i < n; i++) {
for (int j = 0; j < n - i - 1; j++) {
if (vals[j] > vals[j + 1]) {
double temp = vals[j];
vals[j] = vals[j + 1];
vals[j + 1] = temp;
}
}
... | Bubble sort on float data, variable named 'vals', 5 elements. |
165 | C | Sorting Algorithm | intermediate | Sort a 5-element array of floats in ascending order using bubble sort. | #include <stdio.h>
void bubble_sort(double list1[], int n) {
for (int i = 0; i < n; i++) {
for (int j = 0; j < n - i - 1; j++) {
if (list1[j] > list1[j + 1]) {
double temp = list1[j];
list1[j] = list1[j + 1];
list1[j + 1] = temp;
}
... | Bubble sort on float data, variable named 'list1', 5 elements. |
166 | C | Sorting Algorithm | intermediate | Sort a 8-element array of floats in ascending order using bubble sort. | #include <stdio.h>
void bubble_sort(double items[], int n) {
for (int i = 0; i < n; i++) {
for (int j = 0; j < n - i - 1; j++) {
if (items[j] > items[j + 1]) {
double temp = items[j];
items[j] = items[j + 1];
items[j + 1] = temp;
}
... | Bubble sort on float data, variable named 'items', 8 elements. |
167 | C | Sorting Algorithm | intermediate | Sort a 8-element array of floats in ascending order using bubble sort. | #include <stdio.h>
void bubble_sort(double list1[], int n) {
for (int i = 0; i < n; i++) {
for (int j = 0; j < n - i - 1; j++) {
if (list1[j] > list1[j + 1]) {
double temp = list1[j];
list1[j] = list1[j + 1];
list1[j + 1] = temp;
}
... | Bubble sort on float data, variable named 'list1', 8 elements. |
168 | C | Sorting Algorithm | intermediate | Sort a 8-element array of floats in ascending order using bubble sort. | #include <stdio.h>
void bubble_sort(double nums[], int n) {
for (int i = 0; i < n; i++) {
for (int j = 0; j < n - i - 1; j++) {
if (nums[j] > nums[j + 1]) {
double temp = nums[j];
nums[j] = nums[j + 1];
nums[j + 1] = temp;
}
}
... | Bubble sort on float data, variable named 'nums', 8 elements. |
169 | C | Sorting Algorithm | intermediate | Sort a 10-element array of floats in ascending order using bubble sort. | #include <stdio.h>
void bubble_sort(double elements[], int n) {
for (int i = 0; i < n; i++) {
for (int j = 0; j < n - i - 1; j++) {
if (elements[j] > elements[j + 1]) {
double temp = elements[j];
elements[j] = elements[j + 1];
elements[j + 1] = te... | Bubble sort on float data, variable named 'elements', 10 elements. |
170 | C | Sorting Algorithm | intermediate | Sort a 10-element array of floats in ascending order using bubble sort. | #include <stdio.h>
void bubble_sort(double input_arr[], int n) {
for (int i = 0; i < n; i++) {
for (int j = 0; j < n - i - 1; j++) {
if (input_arr[j] > input_arr[j + 1]) {
double temp = input_arr[j];
input_arr[j] = input_arr[j + 1];
input_arr[j + ... | Bubble sort on float data, variable named 'input_arr', 10 elements. |
171 | C | Sorting Algorithm | intermediate | Sort a 10-element array of floats in ascending order using bubble sort. | #include <stdio.h>
void bubble_sort(double input_arr[], int n) {
for (int i = 0; i < n; i++) {
for (int j = 0; j < n - i - 1; j++) {
if (input_arr[j] > input_arr[j + 1]) {
double temp = input_arr[j];
input_arr[j] = input_arr[j + 1];
input_arr[j + ... | Bubble sort on float data, variable named 'input_arr', 10 elements. |
172 | C | Sorting Algorithm | intermediate | Sort a 12-element array of floats in ascending order using bubble sort. | #include <stdio.h>
void bubble_sort(double input_arr[], int n) {
for (int i = 0; i < n; i++) {
for (int j = 0; j < n - i - 1; j++) {
if (input_arr[j] > input_arr[j + 1]) {
double temp = input_arr[j];
input_arr[j] = input_arr[j + 1];
input_arr[j + ... | Bubble sort on float data, variable named 'input_arr', 12 elements. |
173 | C | Sorting Algorithm | intermediate | Sort a 12-element array of floats in ascending order using bubble sort. | #include <stdio.h>
void bubble_sort(double data[], int n) {
for (int i = 0; i < n; i++) {
for (int j = 0; j < n - i - 1; j++) {
if (data[j] > data[j + 1]) {
double temp = data[j];
data[j] = data[j + 1];
data[j + 1] = temp;
}
}
... | Bubble sort on float data, variable named 'data', 12 elements. |
174 | C | Sorting Algorithm | intermediate | Sort a 12-element array of floats in ascending order using bubble sort. | #include <stdio.h>
void bubble_sort(double collection[], int n) {
for (int i = 0; i < n; i++) {
for (int j = 0; j < n - i - 1; j++) {
if (collection[j] > collection[j + 1]) {
double temp = collection[j];
collection[j] = collection[j + 1];
collecti... | Bubble sort on float data, variable named 'collection', 12 elements. |
175 | C | Sorting Algorithm | intermediate | Sort a 15-element array of floats in ascending order using bubble sort. | #include <stdio.h>
void bubble_sort(double arr[], int n) {
for (int i = 0; i < n; i++) {
for (int j = 0; j < n - i - 1; j++) {
if (arr[j] > arr[j + 1]) {
double temp = arr[j];
arr[j] = arr[j + 1];
arr[j + 1] = temp;
}
}
}
}... | Bubble sort on float data, variable named 'arr', 15 elements. |
176 | C | Sorting Algorithm | intermediate | Sort a 15-element array of floats in ascending order using bubble sort. | #include <stdio.h>
void bubble_sort(double entries[], int n) {
for (int i = 0; i < n; i++) {
for (int j = 0; j < n - i - 1; j++) {
if (entries[j] > entries[j + 1]) {
double temp = entries[j];
entries[j] = entries[j + 1];
entries[j + 1] = temp;
... | Bubble sort on float data, variable named 'entries', 15 elements. |
177 | C | Sorting Algorithm | intermediate | Sort a 15-element array of floats in ascending order using bubble sort. | #include <stdio.h>
void bubble_sort(double records[], int n) {
for (int i = 0; i < n; i++) {
for (int j = 0; j < n - i - 1; j++) {
if (records[j] > records[j + 1]) {
double temp = records[j];
records[j] = records[j + 1];
records[j + 1] = temp;
... | Bubble sort on float data, variable named 'records', 15 elements. |
178 | C | Sorting Algorithm | intermediate | Sort a 20-element array of floats in ascending order using bubble sort. | #include <stdio.h>
void bubble_sort(double buffer[], int n) {
for (int i = 0; i < n; i++) {
for (int j = 0; j < n - i - 1; j++) {
if (buffer[j] > buffer[j + 1]) {
double temp = buffer[j];
buffer[j] = buffer[j + 1];
buffer[j + 1] = temp;
... | Bubble sort on float data, variable named 'buffer', 20 elements. |
179 | C | Sorting Algorithm | intermediate | Sort a 20-element array of floats in ascending order using bubble sort. | #include <stdio.h>
void bubble_sort(double values[], int n) {
for (int i = 0; i < n; i++) {
for (int j = 0; j < n - i - 1; j++) {
if (values[j] > values[j + 1]) {
double temp = values[j];
values[j] = values[j + 1];
values[j + 1] = temp;
... | Bubble sort on float data, variable named 'values', 20 elements. |
180 | C | Sorting Algorithm | intermediate | Sort a 20-element array of floats in ascending order using bubble sort. | #include <stdio.h>
void bubble_sort(double entries[], int n) {
for (int i = 0; i < n; i++) {
for (int j = 0; j < n - i - 1; j++) {
if (entries[j] > entries[j + 1]) {
double temp = entries[j];
entries[j] = entries[j + 1];
entries[j + 1] = temp;
... | Bubble sort on float data, variable named 'entries', 20 elements. |
181 | C++ | Sorting Algorithm | intermediate | Sort a 5-element array of ints in ascending order using bubble sort. | #include <iostream>
#include <vector>
void bubbleSort(std::vector<int>& dataset) {
int n = (int) dataset.size();
for (int i = 0; i < n; i++) {
for (int j = 0; j < n - i - 1; j++) {
if (dataset[j] > dataset[j + 1]) std::swap(dataset[j], dataset[j + 1]);
}
}
}
int main() {
st... | Bubble sort on int data, variable named 'dataset', 5 elements. |
182 | C++ | Sorting Algorithm | intermediate | Sort a 5-element array of ints in ascending order using bubble sort. | #include <iostream>
#include <vector>
void bubbleSort(std::vector<int>& arr) {
int n = (int) arr.size();
for (int i = 0; i < n; i++) {
for (int j = 0; j < n - i - 1; j++) {
if (arr[j] > arr[j + 1]) std::swap(arr[j], arr[j + 1]);
}
}
}
int main() {
std::vector<int> arr = {94... | Bubble sort on int data, variable named 'arr', 5 elements. |
183 | C++ | Sorting Algorithm | intermediate | Sort a 5-element array of ints in ascending order using bubble sort. | #include <iostream>
#include <vector>
void bubbleSort(std::vector<int>& input_arr) {
int n = (int) input_arr.size();
for (int i = 0; i < n; i++) {
for (int j = 0; j < n - i - 1; j++) {
if (input_arr[j] > input_arr[j + 1]) std::swap(input_arr[j], input_arr[j + 1]);
}
}
}
int mai... | Bubble sort on int data, variable named 'input_arr', 5 elements. |
184 | C++ | Sorting Algorithm | intermediate | Sort a 8-element array of ints in ascending order using bubble sort. | #include <iostream>
#include <vector>
void bubbleSort(std::vector<int>& items) {
int n = (int) items.size();
for (int i = 0; i < n; i++) {
for (int j = 0; j < n - i - 1; j++) {
if (items[j] > items[j + 1]) std::swap(items[j], items[j + 1]);
}
}
}
int main() {
std::vector<in... | Bubble sort on int data, variable named 'items', 8 elements. |
185 | C++ | Sorting Algorithm | intermediate | Sort a 8-element array of ints in ascending order using bubble sort. | #include <iostream>
#include <vector>
void bubbleSort(std::vector<int>& nums) {
int n = (int) nums.size();
for (int i = 0; i < n; i++) {
for (int j = 0; j < n - i - 1; j++) {
if (nums[j] > nums[j + 1]) std::swap(nums[j], nums[j + 1]);
}
}
}
int main() {
std::vector<int> num... | Bubble sort on int data, variable named 'nums', 8 elements. |
186 | C++ | Sorting Algorithm | intermediate | Sort a 8-element array of ints in ascending order using bubble sort. | #include <iostream>
#include <vector>
void bubbleSort(std::vector<int>& dataset) {
int n = (int) dataset.size();
for (int i = 0; i < n; i++) {
for (int j = 0; j < n - i - 1; j++) {
if (dataset[j] > dataset[j + 1]) std::swap(dataset[j], dataset[j + 1]);
}
}
}
int main() {
st... | Bubble sort on int data, variable named 'dataset', 8 elements. |
187 | C++ | Sorting Algorithm | intermediate | Sort a 10-element array of ints in ascending order using bubble sort. | #include <iostream>
#include <vector>
void bubbleSort(std::vector<int>& collection) {
int n = (int) collection.size();
for (int i = 0; i < n; i++) {
for (int j = 0; j < n - i - 1; j++) {
if (collection[j] > collection[j + 1]) std::swap(collection[j], collection[j + 1]);
}
}
}
i... | Bubble sort on int data, variable named 'collection', 10 elements. |
188 | C++ | Sorting Algorithm | intermediate | Sort a 10-element array of ints in ascending order using bubble sort. | #include <iostream>
#include <vector>
void bubbleSort(std::vector<int>& elements) {
int n = (int) elements.size();
for (int i = 0; i < n; i++) {
for (int j = 0; j < n - i - 1; j++) {
if (elements[j] > elements[j + 1]) std::swap(elements[j], elements[j + 1]);
}
}
}
int main() {
... | Bubble sort on int data, variable named 'elements', 10 elements. |
189 | C++ | Sorting Algorithm | intermediate | Sort a 10-element array of ints in ascending order using bubble sort. | #include <iostream>
#include <vector>
void bubbleSort(std::vector<int>& seq) {
int n = (int) seq.size();
for (int i = 0; i < n; i++) {
for (int j = 0; j < n - i - 1; j++) {
if (seq[j] > seq[j + 1]) std::swap(seq[j], seq[j + 1]);
}
}
}
int main() {
std::vector<int> seq = {20... | Bubble sort on int data, variable named 'seq', 10 elements. |
190 | C++ | Sorting Algorithm | intermediate | Sort a 12-element array of ints in ascending order using bubble sort. | #include <iostream>
#include <vector>
void bubbleSort(std::vector<int>& values) {
int n = (int) values.size();
for (int i = 0; i < n; i++) {
for (int j = 0; j < n - i - 1; j++) {
if (values[j] > values[j + 1]) std::swap(values[j], values[j + 1]);
}
}
}
int main() {
std::vec... | Bubble sort on int data, variable named 'values', 12 elements. |
191 | C++ | Sorting Algorithm | intermediate | Sort a 12-element array of ints in ascending order using bubble sort. | #include <iostream>
#include <vector>
void bubbleSort(std::vector<int>& items) {
int n = (int) items.size();
for (int i = 0; i < n; i++) {
for (int j = 0; j < n - i - 1; j++) {
if (items[j] > items[j + 1]) std::swap(items[j], items[j + 1]);
}
}
}
int main() {
std::vector<in... | Bubble sort on int data, variable named 'items', 12 elements. |
192 | C++ | Sorting Algorithm | intermediate | Sort a 12-element array of ints in ascending order using bubble sort. | #include <iostream>
#include <vector>
void bubbleSort(std::vector<int>& seq) {
int n = (int) seq.size();
for (int i = 0; i < n; i++) {
for (int j = 0; j < n - i - 1; j++) {
if (seq[j] > seq[j + 1]) std::swap(seq[j], seq[j + 1]);
}
}
}
int main() {
std::vector<int> seq = {-7... | Bubble sort on int data, variable named 'seq', 12 elements. |
193 | C++ | Sorting Algorithm | intermediate | Sort a 15-element array of ints in ascending order using bubble sort. | #include <iostream>
#include <vector>
void bubbleSort(std::vector<int>& dataset) {
int n = (int) dataset.size();
for (int i = 0; i < n; i++) {
for (int j = 0; j < n - i - 1; j++) {
if (dataset[j] > dataset[j + 1]) std::swap(dataset[j], dataset[j + 1]);
}
}
}
int main() {
st... | Bubble sort on int data, variable named 'dataset', 15 elements. |
194 | C++ | Sorting Algorithm | intermediate | Sort a 15-element array of ints in ascending order using bubble sort. | #include <iostream>
#include <vector>
void bubbleSort(std::vector<int>& values) {
int n = (int) values.size();
for (int i = 0; i < n; i++) {
for (int j = 0; j < n - i - 1; j++) {
if (values[j] > values[j + 1]) std::swap(values[j], values[j + 1]);
}
}
}
int main() {
std::vec... | Bubble sort on int data, variable named 'values', 15 elements. |
195 | C++ | Sorting Algorithm | intermediate | Sort a 15-element array of ints in ascending order using bubble sort. | #include <iostream>
#include <vector>
void bubbleSort(std::vector<int>& records) {
int n = (int) records.size();
for (int i = 0; i < n; i++) {
for (int j = 0; j < n - i - 1; j++) {
if (records[j] > records[j + 1]) std::swap(records[j], records[j + 1]);
}
}
}
int main() {
st... | Bubble sort on int data, variable named 'records', 15 elements. |
196 | C++ | Sorting Algorithm | intermediate | Sort a 20-element array of ints in ascending order using bubble sort. | #include <iostream>
#include <vector>
void bubbleSort(std::vector<int>& buffer) {
int n = (int) buffer.size();
for (int i = 0; i < n; i++) {
for (int j = 0; j < n - i - 1; j++) {
if (buffer[j] > buffer[j + 1]) std::swap(buffer[j], buffer[j + 1]);
}
}
}
int main() {
std::vec... | Bubble sort on int data, variable named 'buffer', 20 elements. |
197 | C++ | Sorting Algorithm | intermediate | Sort a 20-element array of ints in ascending order using bubble sort. | #include <iostream>
#include <vector>
void bubbleSort(std::vector<int>& data) {
int n = (int) data.size();
for (int i = 0; i < n; i++) {
for (int j = 0; j < n - i - 1; j++) {
if (data[j] > data[j + 1]) std::swap(data[j], data[j + 1]);
}
}
}
int main() {
std::vector<int> dat... | Bubble sort on int data, variable named 'data', 20 elements. |
198 | C++ | Sorting Algorithm | intermediate | Sort a 20-element array of ints in ascending order using bubble sort. | #include <iostream>
#include <vector>
void bubbleSort(std::vector<int>& collection) {
int n = (int) collection.size();
for (int i = 0; i < n; i++) {
for (int j = 0; j < n - i - 1; j++) {
if (collection[j] > collection[j + 1]) std::swap(collection[j], collection[j + 1]);
}
}
}
i... | Bubble sort on int data, variable named 'collection', 20 elements. |
199 | C++ | Sorting Algorithm | intermediate | Sort a 5-element array of floats in ascending order using bubble sort. | #include <iostream>
#include <vector>
void bubbleSort(std::vector<double>& dataset) {
int n = (int) dataset.size();
for (int i = 0; i < n; i++) {
for (int j = 0; j < n - i - 1; j++) {
if (dataset[j] > dataset[j + 1]) std::swap(dataset[j], dataset[j + 1]);
}
}
}
int main() {
... | Bubble sort on float data, variable named 'dataset', 5 elements. |
200 | C++ | Sorting Algorithm | intermediate | Sort a 5-element array of floats in ascending order using bubble sort. | #include <iostream>
#include <vector>
void bubbleSort(std::vector<double>& elements) {
int n = (int) elements.size();
for (int i = 0; i < n; i++) {
for (int j = 0; j < n - i - 1; j++) {
if (elements[j] > elements[j + 1]) std::swap(elements[j], elements[j + 1]);
}
}
}
int main()... | Bubble sort on float data, variable named 'elements', 5 elements. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.