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 |
|---|---|---|---|---|---|---|
701 | C++ | Sorting Algorithm | intermediate | Sort a 20-element array of ints in ascending order using insertion sort. | #include <iostream>
#include <vector>
void insertionSort(std::vector<int>& input_arr) {
for (size_t i = 1; i < input_arr.size(); i++) {
int key = input_arr[i];
int j = (int) i - 1;
while (j >= 0 && input_arr[j] > key) {
input_arr[j + 1] = input_arr[j];
j--;
}... | Insertion sort on int data, variable named 'input_arr', 20 elements. |
702 | C++ | Sorting Algorithm | intermediate | Sort a 20-element array of ints in ascending order using insertion sort. | #include <iostream>
#include <vector>
void insertionSort(std::vector<int>& buffer) {
for (size_t i = 1; i < buffer.size(); i++) {
int key = buffer[i];
int j = (int) i - 1;
while (j >= 0 && buffer[j] > key) {
buffer[j + 1] = buffer[j];
j--;
}
buffer[j ... | Insertion sort on int data, variable named 'buffer', 20 elements. |
703 | C++ | Sorting Algorithm | intermediate | Sort a 5-element array of floats in ascending order using insertion sort. | #include <iostream>
#include <vector>
void insertionSort(std::vector<double>& arr) {
for (size_t i = 1; i < arr.size(); i++) {
double key = arr[i];
int j = (int) i - 1;
while (j >= 0 && arr[j] > key) {
arr[j + 1] = arr[j];
j--;
}
arr[j + 1] = key;
... | Insertion sort on float data, variable named 'arr', 5 elements. |
704 | C++ | Sorting Algorithm | intermediate | Sort a 5-element array of floats in ascending order using insertion sort. | #include <iostream>
#include <vector>
void insertionSort(std::vector<double>& values) {
for (size_t i = 1; i < values.size(); i++) {
double key = values[i];
int j = (int) i - 1;
while (j >= 0 && values[j] > key) {
values[j + 1] = values[j];
j--;
}
val... | Insertion sort on float data, variable named 'values', 5 elements. |
705 | C++ | Sorting Algorithm | intermediate | Sort a 5-element array of floats in ascending order using insertion sort. | #include <iostream>
#include <vector>
void insertionSort(std::vector<double>& buffer) {
for (size_t i = 1; i < buffer.size(); i++) {
double key = buffer[i];
int j = (int) i - 1;
while (j >= 0 && buffer[j] > key) {
buffer[j + 1] = buffer[j];
j--;
}
buf... | Insertion sort on float data, variable named 'buffer', 5 elements. |
706 | C++ | Sorting Algorithm | intermediate | Sort a 8-element array of floats in ascending order using insertion sort. | #include <iostream>
#include <vector>
void insertionSort(std::vector<double>& collection) {
for (size_t i = 1; i < collection.size(); i++) {
double key = collection[i];
int j = (int) i - 1;
while (j >= 0 && collection[j] > key) {
collection[j + 1] = collection[j];
j-... | Insertion sort on float data, variable named 'collection', 8 elements. |
707 | C++ | Sorting Algorithm | intermediate | Sort a 8-element array of floats in ascending order using insertion sort. | #include <iostream>
#include <vector>
void insertionSort(std::vector<double>& input_arr) {
for (size_t i = 1; i < input_arr.size(); i++) {
double key = input_arr[i];
int j = (int) i - 1;
while (j >= 0 && input_arr[j] > key) {
input_arr[j + 1] = input_arr[j];
j--;
... | Insertion sort on float data, variable named 'input_arr', 8 elements. |
708 | C++ | Sorting Algorithm | intermediate | Sort a 8-element array of floats in ascending order using insertion sort. | #include <iostream>
#include <vector>
void insertionSort(std::vector<double>& buffer) {
for (size_t i = 1; i < buffer.size(); i++) {
double key = buffer[i];
int j = (int) i - 1;
while (j >= 0 && buffer[j] > key) {
buffer[j + 1] = buffer[j];
j--;
}
buf... | Insertion sort on float data, variable named 'buffer', 8 elements. |
709 | C++ | Sorting Algorithm | intermediate | Sort a 10-element array of floats in ascending order using insertion sort. | #include <iostream>
#include <vector>
void insertionSort(std::vector<double>& values) {
for (size_t i = 1; i < values.size(); i++) {
double key = values[i];
int j = (int) i - 1;
while (j >= 0 && values[j] > key) {
values[j + 1] = values[j];
j--;
}
val... | Insertion sort on float data, variable named 'values', 10 elements. |
710 | C++ | Sorting Algorithm | intermediate | Sort a 10-element array of floats in ascending order using insertion sort. | #include <iostream>
#include <vector>
void insertionSort(std::vector<double>& items) {
for (size_t i = 1; i < items.size(); i++) {
double key = items[i];
int j = (int) i - 1;
while (j >= 0 && items[j] > key) {
items[j + 1] = items[j];
j--;
}
items[j +... | Insertion sort on float data, variable named 'items', 10 elements. |
711 | C++ | Sorting Algorithm | intermediate | Sort a 10-element array of floats in ascending order using insertion sort. | #include <iostream>
#include <vector>
void insertionSort(std::vector<double>& records) {
for (size_t i = 1; i < records.size(); i++) {
double key = records[i];
int j = (int) i - 1;
while (j >= 0 && records[j] > key) {
records[j + 1] = records[j];
j--;
}
... | Insertion sort on float data, variable named 'records', 10 elements. |
712 | C++ | Sorting Algorithm | intermediate | Sort a 12-element array of floats in ascending order using insertion sort. | #include <iostream>
#include <vector>
void insertionSort(std::vector<double>& dataset) {
for (size_t i = 1; i < dataset.size(); i++) {
double key = dataset[i];
int j = (int) i - 1;
while (j >= 0 && dataset[j] > key) {
dataset[j + 1] = dataset[j];
j--;
}
... | Insertion sort on float data, variable named 'dataset', 12 elements. |
713 | C++ | Sorting Algorithm | intermediate | Sort a 12-element array of floats in ascending order using insertion sort. | #include <iostream>
#include <vector>
void insertionSort(std::vector<double>& vals) {
for (size_t i = 1; i < vals.size(); i++) {
double key = vals[i];
int j = (int) i - 1;
while (j >= 0 && vals[j] > key) {
vals[j + 1] = vals[j];
j--;
}
vals[j + 1] = k... | Insertion sort on float data, variable named 'vals', 12 elements. |
714 | C++ | Sorting Algorithm | intermediate | Sort a 12-element array of floats in ascending order using insertion sort. | #include <iostream>
#include <vector>
void insertionSort(std::vector<double>& list1) {
for (size_t i = 1; i < list1.size(); i++) {
double key = list1[i];
int j = (int) i - 1;
while (j >= 0 && list1[j] > key) {
list1[j + 1] = list1[j];
j--;
}
list1[j +... | Insertion sort on float data, variable named 'list1', 12 elements. |
715 | C++ | Sorting Algorithm | intermediate | Sort a 15-element array of floats in ascending order using insertion sort. | #include <iostream>
#include <vector>
void insertionSort(std::vector<double>& items) {
for (size_t i = 1; i < items.size(); i++) {
double key = items[i];
int j = (int) i - 1;
while (j >= 0 && items[j] > key) {
items[j + 1] = items[j];
j--;
}
items[j +... | Insertion sort on float data, variable named 'items', 15 elements. |
716 | C++ | Sorting Algorithm | intermediate | Sort a 15-element array of floats in ascending order using insertion sort. | #include <iostream>
#include <vector>
void insertionSort(std::vector<double>& elements) {
for (size_t i = 1; i < elements.size(); i++) {
double key = elements[i];
int j = (int) i - 1;
while (j >= 0 && elements[j] > key) {
elements[j + 1] = elements[j];
j--;
}... | Insertion sort on float data, variable named 'elements', 15 elements. |
717 | C++ | Sorting Algorithm | intermediate | Sort a 15-element array of floats in ascending order using insertion sort. | #include <iostream>
#include <vector>
void insertionSort(std::vector<double>& vals) {
for (size_t i = 1; i < vals.size(); i++) {
double key = vals[i];
int j = (int) i - 1;
while (j >= 0 && vals[j] > key) {
vals[j + 1] = vals[j];
j--;
}
vals[j + 1] = k... | Insertion sort on float data, variable named 'vals', 15 elements. |
718 | C++ | Sorting Algorithm | intermediate | Sort a 20-element array of floats in ascending order using insertion sort. | #include <iostream>
#include <vector>
void insertionSort(std::vector<double>& buffer) {
for (size_t i = 1; i < buffer.size(); i++) {
double key = buffer[i];
int j = (int) i - 1;
while (j >= 0 && buffer[j] > key) {
buffer[j + 1] = buffer[j];
j--;
}
buf... | Insertion sort on float data, variable named 'buffer', 20 elements. |
719 | C++ | Sorting Algorithm | intermediate | Sort a 20-element array of floats in ascending order using insertion sort. | #include <iostream>
#include <vector>
void insertionSort(std::vector<double>& entries) {
for (size_t i = 1; i < entries.size(); i++) {
double key = entries[i];
int j = (int) i - 1;
while (j >= 0 && entries[j] > key) {
entries[j + 1] = entries[j];
j--;
}
... | Insertion sort on float data, variable named 'entries', 20 elements. |
720 | C++ | Sorting Algorithm | intermediate | Sort a 20-element array of floats in ascending order using insertion sort. | #include <iostream>
#include <vector>
void insertionSort(std::vector<double>& collection) {
for (size_t i = 1; i < collection.size(); i++) {
double key = collection[i];
int j = (int) i - 1;
while (j >= 0 && collection[j] > key) {
collection[j + 1] = collection[j];
j-... | Insertion sort on float data, variable named 'collection', 20 elements. |
721 | Rust | Sorting Algorithm | intermediate | Sort a 5-element array of ints in ascending order using insertion sort. | fn insertion_sort(dataset: &mut Vec<i32>) {
for i in 1..dataset.len() {
let key = dataset[i];
let mut j = i as i32 - 1;
while j >= 0 && dataset[j as usize] > key {
dataset[(j + 1) as usize] = dataset[j as usize];
j -= 1;
}
dataset[(j + 1) as usize] = k... | Insertion sort on int data, variable named 'dataset', 5 elements. |
722 | Rust | Sorting Algorithm | intermediate | Sort a 5-element array of ints in ascending order using insertion sort. | fn insertion_sort(nums: &mut Vec<i32>) {
for i in 1..nums.len() {
let key = nums[i];
let mut j = i as i32 - 1;
while j >= 0 && nums[j as usize] > key {
nums[(j + 1) as usize] = nums[j as usize];
j -= 1;
}
nums[(j + 1) as usize] = key;
}
}
fn main(... | Insertion sort on int data, variable named 'nums', 5 elements. |
723 | Rust | Sorting Algorithm | intermediate | Sort a 5-element array of ints in ascending order using insertion sort. | fn insertion_sort(buffer: &mut Vec<i32>) {
for i in 1..buffer.len() {
let key = buffer[i];
let mut j = i as i32 - 1;
while j >= 0 && buffer[j as usize] > key {
buffer[(j + 1) as usize] = buffer[j as usize];
j -= 1;
}
buffer[(j + 1) as usize] = key;
... | Insertion sort on int data, variable named 'buffer', 5 elements. |
724 | Rust | Sorting Algorithm | intermediate | Sort a 8-element array of ints in ascending order using insertion sort. | fn insertion_sort(vals: &mut Vec<i32>) {
for i in 1..vals.len() {
let key = vals[i];
let mut j = i as i32 - 1;
while j >= 0 && vals[j as usize] > key {
vals[(j + 1) as usize] = vals[j as usize];
j -= 1;
}
vals[(j + 1) as usize] = key;
}
}
fn main(... | Insertion sort on int data, variable named 'vals', 8 elements. |
725 | Rust | Sorting Algorithm | intermediate | Sort a 8-element array of ints in ascending order using insertion sort. | fn insertion_sort(nums: &mut Vec<i32>) {
for i in 1..nums.len() {
let key = nums[i];
let mut j = i as i32 - 1;
while j >= 0 && nums[j as usize] > key {
nums[(j + 1) as usize] = nums[j as usize];
j -= 1;
}
nums[(j + 1) as usize] = key;
}
}
fn main(... | Insertion sort on int data, variable named 'nums', 8 elements. |
726 | Rust | Sorting Algorithm | intermediate | Sort a 8-element array of ints in ascending order using insertion sort. | fn insertion_sort(vals: &mut Vec<i32>) {
for i in 1..vals.len() {
let key = vals[i];
let mut j = i as i32 - 1;
while j >= 0 && vals[j as usize] > key {
vals[(j + 1) as usize] = vals[j as usize];
j -= 1;
}
vals[(j + 1) as usize] = key;
}
}
fn main(... | Insertion sort on int data, variable named 'vals', 8 elements. |
727 | Rust | Sorting Algorithm | intermediate | Sort a 10-element array of ints in ascending order using insertion sort. | fn insertion_sort(collection: &mut Vec<i32>) {
for i in 1..collection.len() {
let key = collection[i];
let mut j = i as i32 - 1;
while j >= 0 && collection[j as usize] > key {
collection[(j + 1) as usize] = collection[j as usize];
j -= 1;
}
collection[... | Insertion sort on int data, variable named 'collection', 10 elements. |
728 | Rust | Sorting Algorithm | intermediate | Sort a 10-element array of ints in ascending order using insertion sort. | fn insertion_sort(dataset: &mut Vec<i32>) {
for i in 1..dataset.len() {
let key = dataset[i];
let mut j = i as i32 - 1;
while j >= 0 && dataset[j as usize] > key {
dataset[(j + 1) as usize] = dataset[j as usize];
j -= 1;
}
dataset[(j + 1) as usize] = k... | Insertion sort on int data, variable named 'dataset', 10 elements. |
729 | Rust | Sorting Algorithm | intermediate | Sort a 10-element array of ints in ascending order using insertion sort. | fn insertion_sort(buffer: &mut Vec<i32>) {
for i in 1..buffer.len() {
let key = buffer[i];
let mut j = i as i32 - 1;
while j >= 0 && buffer[j as usize] > key {
buffer[(j + 1) as usize] = buffer[j as usize];
j -= 1;
}
buffer[(j + 1) as usize] = key;
... | Insertion sort on int data, variable named 'buffer', 10 elements. |
730 | Rust | Sorting Algorithm | intermediate | Sort a 12-element array of ints in ascending order using insertion sort. | fn insertion_sort(data: &mut Vec<i32>) {
for i in 1..data.len() {
let key = data[i];
let mut j = i as i32 - 1;
while j >= 0 && data[j as usize] > key {
data[(j + 1) as usize] = data[j as usize];
j -= 1;
}
data[(j + 1) as usize] = key;
}
}
fn main(... | Insertion sort on int data, variable named 'data', 12 elements. |
731 | Rust | Sorting Algorithm | intermediate | Sort a 12-element array of ints in ascending order using insertion sort. | fn insertion_sort(seq: &mut Vec<i32>) {
for i in 1..seq.len() {
let key = seq[i];
let mut j = i as i32 - 1;
while j >= 0 && seq[j as usize] > key {
seq[(j + 1) as usize] = seq[j as usize];
j -= 1;
}
seq[(j + 1) as usize] = key;
}
}
fn main() {
... | Insertion sort on int data, variable named 'seq', 12 elements. |
732 | Rust | Sorting Algorithm | intermediate | Sort a 12-element array of ints in ascending order using insertion sort. | fn insertion_sort(data: &mut Vec<i32>) {
for i in 1..data.len() {
let key = data[i];
let mut j = i as i32 - 1;
while j >= 0 && data[j as usize] > key {
data[(j + 1) as usize] = data[j as usize];
j -= 1;
}
data[(j + 1) as usize] = key;
}
}
fn main(... | Insertion sort on int data, variable named 'data', 12 elements. |
733 | Rust | Sorting Algorithm | intermediate | Sort a 15-element array of ints in ascending order using insertion sort. | fn insertion_sort(buffer: &mut Vec<i32>) {
for i in 1..buffer.len() {
let key = buffer[i];
let mut j = i as i32 - 1;
while j >= 0 && buffer[j as usize] > key {
buffer[(j + 1) as usize] = buffer[j as usize];
j -= 1;
}
buffer[(j + 1) as usize] = key;
... | Insertion sort on int data, variable named 'buffer', 15 elements. |
734 | Rust | Sorting Algorithm | intermediate | Sort a 15-element array of ints in ascending order using insertion sort. | fn insertion_sort(dataset: &mut Vec<i32>) {
for i in 1..dataset.len() {
let key = dataset[i];
let mut j = i as i32 - 1;
while j >= 0 && dataset[j as usize] > key {
dataset[(j + 1) as usize] = dataset[j as usize];
j -= 1;
}
dataset[(j + 1) as usize] = k... | Insertion sort on int data, variable named 'dataset', 15 elements. |
735 | Rust | Sorting Algorithm | intermediate | Sort a 15-element array of ints in ascending order using insertion sort. | fn insertion_sort(values: &mut Vec<i32>) {
for i in 1..values.len() {
let key = values[i];
let mut j = i as i32 - 1;
while j >= 0 && values[j as usize] > key {
values[(j + 1) as usize] = values[j as usize];
j -= 1;
}
values[(j + 1) as usize] = key;
... | Insertion sort on int data, variable named 'values', 15 elements. |
736 | Rust | Sorting Algorithm | intermediate | Sort a 20-element array of ints in ascending order using insertion sort. | fn insertion_sort(buffer: &mut Vec<i32>) {
for i in 1..buffer.len() {
let key = buffer[i];
let mut j = i as i32 - 1;
while j >= 0 && buffer[j as usize] > key {
buffer[(j + 1) as usize] = buffer[j as usize];
j -= 1;
}
buffer[(j + 1) as usize] = key;
... | Insertion sort on int data, variable named 'buffer', 20 elements. |
737 | Rust | Sorting Algorithm | intermediate | Sort a 20-element array of ints in ascending order using insertion sort. | fn insertion_sort(arr: &mut Vec<i32>) {
for i in 1..arr.len() {
let key = arr[i];
let mut j = i as i32 - 1;
while j >= 0 && arr[j as usize] > key {
arr[(j + 1) as usize] = arr[j as usize];
j -= 1;
}
arr[(j + 1) as usize] = key;
}
}
fn main() {
... | Insertion sort on int data, variable named 'arr', 20 elements. |
738 | Rust | Sorting Algorithm | intermediate | Sort a 20-element array of ints in ascending order using insertion sort. | fn insertion_sort(nums: &mut Vec<i32>) {
for i in 1..nums.len() {
let key = nums[i];
let mut j = i as i32 - 1;
while j >= 0 && nums[j as usize] > key {
nums[(j + 1) as usize] = nums[j as usize];
j -= 1;
}
nums[(j + 1) as usize] = key;
}
}
fn main(... | Insertion sort on int data, variable named 'nums', 20 elements. |
739 | Rust | Sorting Algorithm | intermediate | Sort a 5-element array of floats in ascending order using insertion sort. | fn insertion_sort(data: &mut Vec<f64>) {
for i in 1..data.len() {
let key = data[i];
let mut j = i as i32 - 1;
while j >= 0 && data[j as usize] > key {
data[(j + 1) as usize] = data[j as usize];
j -= 1;
}
data[(j + 1) as usize] = key;
}
}
fn main(... | Insertion sort on float data, variable named 'data', 5 elements. |
740 | Rust | Sorting Algorithm | intermediate | Sort a 5-element array of floats in ascending order using insertion sort. | fn insertion_sort(entries: &mut Vec<f64>) {
for i in 1..entries.len() {
let key = entries[i];
let mut j = i as i32 - 1;
while j >= 0 && entries[j as usize] > key {
entries[(j + 1) as usize] = entries[j as usize];
j -= 1;
}
entries[(j + 1) as usize] = k... | Insertion sort on float data, variable named 'entries', 5 elements. |
741 | Rust | Sorting Algorithm | intermediate | Sort a 5-element array of floats in ascending order using insertion sort. | fn insertion_sort(collection: &mut Vec<f64>) {
for i in 1..collection.len() {
let key = collection[i];
let mut j = i as i32 - 1;
while j >= 0 && collection[j as usize] > key {
collection[(j + 1) as usize] = collection[j as usize];
j -= 1;
}
collection[... | Insertion sort on float data, variable named 'collection', 5 elements. |
742 | Rust | Sorting Algorithm | intermediate | Sort a 8-element array of floats in ascending order using insertion sort. | fn insertion_sort(input_arr: &mut Vec<f64>) {
for i in 1..input_arr.len() {
let key = input_arr[i];
let mut j = i as i32 - 1;
while j >= 0 && input_arr[j as usize] > key {
input_arr[(j + 1) as usize] = input_arr[j as usize];
j -= 1;
}
input_arr[(j + 1)... | Insertion sort on float data, variable named 'input_arr', 8 elements. |
743 | Rust | Sorting Algorithm | intermediate | Sort a 8-element array of floats in ascending order using insertion sort. | fn insertion_sort(elements: &mut Vec<f64>) {
for i in 1..elements.len() {
let key = elements[i];
let mut j = i as i32 - 1;
while j >= 0 && elements[j as usize] > key {
elements[(j + 1) as usize] = elements[j as usize];
j -= 1;
}
elements[(j + 1) as usi... | Insertion sort on float data, variable named 'elements', 8 elements. |
744 | Rust | Sorting Algorithm | intermediate | Sort a 8-element array of floats in ascending order using insertion sort. | fn insertion_sort(input_arr: &mut Vec<f64>) {
for i in 1..input_arr.len() {
let key = input_arr[i];
let mut j = i as i32 - 1;
while j >= 0 && input_arr[j as usize] > key {
input_arr[(j + 1) as usize] = input_arr[j as usize];
j -= 1;
}
input_arr[(j + 1)... | Insertion sort on float data, variable named 'input_arr', 8 elements. |
745 | Rust | Sorting Algorithm | intermediate | Sort a 10-element array of floats in ascending order using insertion sort. | fn insertion_sort(collection: &mut Vec<f64>) {
for i in 1..collection.len() {
let key = collection[i];
let mut j = i as i32 - 1;
while j >= 0 && collection[j as usize] > key {
collection[(j + 1) as usize] = collection[j as usize];
j -= 1;
}
collection[... | Insertion sort on float data, variable named 'collection', 10 elements. |
746 | Rust | Sorting Algorithm | intermediate | Sort a 10-element array of floats in ascending order using insertion sort. | fn insertion_sort(list1: &mut Vec<f64>) {
for i in 1..list1.len() {
let key = list1[i];
let mut j = i as i32 - 1;
while j >= 0 && list1[j as usize] > key {
list1[(j + 1) as usize] = list1[j as usize];
j -= 1;
}
list1[(j + 1) as usize] = key;
}
}
f... | Insertion sort on float data, variable named 'list1', 10 elements. |
747 | Rust | Sorting Algorithm | intermediate | Sort a 10-element array of floats in ascending order using insertion sort. | fn insertion_sort(collection: &mut Vec<f64>) {
for i in 1..collection.len() {
let key = collection[i];
let mut j = i as i32 - 1;
while j >= 0 && collection[j as usize] > key {
collection[(j + 1) as usize] = collection[j as usize];
j -= 1;
}
collection[... | Insertion sort on float data, variable named 'collection', 10 elements. |
748 | Rust | Sorting Algorithm | intermediate | Sort a 12-element array of floats in ascending order using insertion sort. | fn insertion_sort(vals: &mut Vec<f64>) {
for i in 1..vals.len() {
let key = vals[i];
let mut j = i as i32 - 1;
while j >= 0 && vals[j as usize] > key {
vals[(j + 1) as usize] = vals[j as usize];
j -= 1;
}
vals[(j + 1) as usize] = key;
}
}
fn main(... | Insertion sort on float data, variable named 'vals', 12 elements. |
749 | Rust | Sorting Algorithm | intermediate | Sort a 12-element array of floats in ascending order using insertion sort. | fn insertion_sort(entries: &mut Vec<f64>) {
for i in 1..entries.len() {
let key = entries[i];
let mut j = i as i32 - 1;
while j >= 0 && entries[j as usize] > key {
entries[(j + 1) as usize] = entries[j as usize];
j -= 1;
}
entries[(j + 1) as usize] = k... | Insertion sort on float data, variable named 'entries', 12 elements. |
750 | Rust | Sorting Algorithm | intermediate | Sort a 12-element array of floats in ascending order using insertion sort. | fn insertion_sort(dataset: &mut Vec<f64>) {
for i in 1..dataset.len() {
let key = dataset[i];
let mut j = i as i32 - 1;
while j >= 0 && dataset[j as usize] > key {
dataset[(j + 1) as usize] = dataset[j as usize];
j -= 1;
}
dataset[(j + 1) as usize] = k... | Insertion sort on float data, variable named 'dataset', 12 elements. |
751 | Rust | Sorting Algorithm | intermediate | Sort a 15-element array of floats in ascending order using insertion sort. | fn insertion_sort(data: &mut Vec<f64>) {
for i in 1..data.len() {
let key = data[i];
let mut j = i as i32 - 1;
while j >= 0 && data[j as usize] > key {
data[(j + 1) as usize] = data[j as usize];
j -= 1;
}
data[(j + 1) as usize] = key;
}
}
fn main(... | Insertion sort on float data, variable named 'data', 15 elements. |
752 | Rust | Sorting Algorithm | intermediate | Sort a 15-element array of floats in ascending order using insertion sort. | fn insertion_sort(entries: &mut Vec<f64>) {
for i in 1..entries.len() {
let key = entries[i];
let mut j = i as i32 - 1;
while j >= 0 && entries[j as usize] > key {
entries[(j + 1) as usize] = entries[j as usize];
j -= 1;
}
entries[(j + 1) as usize] = k... | Insertion sort on float data, variable named 'entries', 15 elements. |
753 | Rust | Sorting Algorithm | intermediate | Sort a 15-element array of floats in ascending order using insertion sort. | fn insertion_sort(input_arr: &mut Vec<f64>) {
for i in 1..input_arr.len() {
let key = input_arr[i];
let mut j = i as i32 - 1;
while j >= 0 && input_arr[j as usize] > key {
input_arr[(j + 1) as usize] = input_arr[j as usize];
j -= 1;
}
input_arr[(j + 1)... | Insertion sort on float data, variable named 'input_arr', 15 elements. |
754 | Rust | Sorting Algorithm | intermediate | Sort a 20-element array of floats in ascending order using insertion sort. | fn insertion_sort(values: &mut Vec<f64>) {
for i in 1..values.len() {
let key = values[i];
let mut j = i as i32 - 1;
while j >= 0 && values[j as usize] > key {
values[(j + 1) as usize] = values[j as usize];
j -= 1;
}
values[(j + 1) as usize] = key;
... | Insertion sort on float data, variable named 'values', 20 elements. |
755 | Rust | Sorting Algorithm | intermediate | Sort a 20-element array of floats in ascending order using insertion sort. | fn insertion_sort(vals: &mut Vec<f64>) {
for i in 1..vals.len() {
let key = vals[i];
let mut j = i as i32 - 1;
while j >= 0 && vals[j as usize] > key {
vals[(j + 1) as usize] = vals[j as usize];
j -= 1;
}
vals[(j + 1) as usize] = key;
}
}
fn main(... | Insertion sort on float data, variable named 'vals', 20 elements. |
756 | Rust | Sorting Algorithm | intermediate | Sort a 20-element array of floats in ascending order using insertion sort. | fn insertion_sort(collection: &mut Vec<f64>) {
for i in 1..collection.len() {
let key = collection[i];
let mut j = i as i32 - 1;
while j >= 0 && collection[j as usize] > key {
collection[(j + 1) as usize] = collection[j as usize];
j -= 1;
}
collection[... | Insertion sort on float data, variable named 'collection', 20 elements. |
757 | Python | Data Structures | intermediate | Implement a stack of ints and run the operation sequence: push, push, push, pop. | class QStack:
def __init__(self):
self._items = []
def push(self, item):
self._items.append(item)
def pop(self):
return self._items.pop()
def peek(self):
return self._items[-1]
s = QStack()
s.push(36)
s.push(25)
s.push(19)
print(s.pop()) | Stack with int elements, ops=['push', 'push', 'push', 'pop']. |
758 | Python | Data Structures | intermediate | Implement a stack of ints and run the operation sequence: push, push, push, pop. | class QStack:
def __init__(self):
self._items = []
def push(self, item):
self._items.append(item)
def pop(self):
return self._items.pop()
def peek(self):
return self._items[-1]
s = QStack()
s.push(79)
s.push(26)
s.push(12)
print(s.pop()) | Stack with int elements, ops=['push', 'push', 'push', 'pop']. |
759 | Python | Data Structures | intermediate | Implement a stack of ints and run the operation sequence: push, push, push, pop. | class Box_Stack:
def __init__(self):
self._items = []
def push(self, item):
self._items.append(item)
def pop(self):
return self._items.pop()
def peek(self):
return self._items[-1]
s = Box_Stack()
s.push(53)
s.push(68)
s.push(40)
print(s.pop()) | Stack with int elements, ops=['push', 'push', 'push', 'pop']. |
760 | Python | Data Structures | intermediate | Implement a stack of ints and run the operation sequence: push, push, push, pop. | class CollStack:
def __init__(self):
self._items = []
def push(self, item):
self._items.append(item)
def pop(self):
return self._items.pop()
def peek(self):
return self._items[-1]
s = CollStack()
s.push(30)
s.push(29)
s.push(44)
print(s.pop()) | Stack with int elements, ops=['push', 'push', 'push', 'pop']. |
761 | Python | Data Structures | intermediate | Implement a stack of ints and run the operation sequence: push, push, pop, push, pop. | class Box_Stack:
def __init__(self):
self._items = []
def push(self, item):
self._items.append(item)
def pop(self):
return self._items.pop()
def peek(self):
return self._items[-1]
s = Box_Stack()
s.push(8)
s.push(66)
print(s.pop())
s.push(83)
print(s.pop()) | Stack with int elements, ops=['push', 'push', 'pop', 'push', 'pop']. |
762 | Python | Data Structures | intermediate | Implement a stack of ints and run the operation sequence: push, push, pop, push, pop. | class BufStack:
def __init__(self):
self._items = []
def push(self, item):
self._items.append(item)
def pop(self):
return self._items.pop()
def peek(self):
return self._items[-1]
s = BufStack()
s.push(15)
s.push(35)
print(s.pop())
s.push(36)
print(s.pop()) | Stack with int elements, ops=['push', 'push', 'pop', 'push', 'pop']. |
763 | Python | Data Structures | intermediate | Implement a stack of ints and run the operation sequence: push, push, pop, push, pop. | class CollStack:
def __init__(self):
self._items = []
def push(self, item):
self._items.append(item)
def pop(self):
return self._items.pop()
def peek(self):
return self._items[-1]
s = CollStack()
s.push(54)
s.push(32)
print(s.pop())
s.push(7)
print(s.pop()) | Stack with int elements, ops=['push', 'push', 'pop', 'push', 'pop']. |
764 | Python | Data Structures | intermediate | Implement a stack of ints and run the operation sequence: push, push, pop, push, pop. | class QStack:
def __init__(self):
self._items = []
def push(self, item):
self._items.append(item)
def pop(self):
return self._items.pop()
def peek(self):
return self._items[-1]
s = QStack()
s.push(1)
s.push(7)
print(s.pop())
s.push(96)
print(s.pop()) | Stack with int elements, ops=['push', 'push', 'pop', 'push', 'pop']. |
765 | Python | Data Structures | intermediate | Implement a stack of ints and run the operation sequence: push, push, push, push, pop, pop. | class SStack:
def __init__(self):
self._items = []
def push(self, item):
self._items.append(item)
def pop(self):
return self._items.pop()
def peek(self):
return self._items[-1]
s = SStack()
s.push(37)
s.push(61)
s.push(36)
s.push(78)
print(s.pop())
print(s.pop()) | Stack with int elements, ops=['push', 'push', 'push', 'push', 'pop', 'pop']. |
766 | Python | Data Structures | intermediate | Implement a stack of ints and run the operation sequence: push, push, push, push, pop, pop. | class SStack:
def __init__(self):
self._items = []
def push(self, item):
self._items.append(item)
def pop(self):
return self._items.pop()
def peek(self):
return self._items[-1]
s = SStack()
s.push(33)
s.push(63)
s.push(47)
s.push(43)
print(s.pop())
print(s.pop()) | Stack with int elements, ops=['push', 'push', 'push', 'push', 'pop', 'pop']. |
767 | Python | Data Structures | intermediate | Implement a stack of ints and run the operation sequence: push, push, push, push, pop, pop. | class QStack:
def __init__(self):
self._items = []
def push(self, item):
self._items.append(item)
def pop(self):
return self._items.pop()
def peek(self):
return self._items[-1]
s = QStack()
s.push(86)
s.push(2)
s.push(88)
s.push(71)
print(s.pop())
print(s.pop()) | Stack with int elements, ops=['push', 'push', 'push', 'push', 'pop', 'pop']. |
768 | Python | Data Structures | intermediate | Implement a stack of ints and run the operation sequence: push, push, push, push, pop, pop. | class BufStack:
def __init__(self):
self._items = []
def push(self, item):
self._items.append(item)
def pop(self):
return self._items.pop()
def peek(self):
return self._items[-1]
s = BufStack()
s.push(47)
s.push(95)
s.push(47)
s.push(96)
print(s.pop())
print(s.pop()) | Stack with int elements, ops=['push', 'push', 'push', 'push', 'pop', 'pop']. |
769 | Python | Data Structures | intermediate | Implement a stack of ints and run the operation sequence: push, pop, push, push. | class ContainerStack:
def __init__(self):
self._items = []
def push(self, item):
self._items.append(item)
def pop(self):
return self._items.pop()
def peek(self):
return self._items[-1]
s = ContainerStack()
s.push(78)
print(s.pop())
s.push(31)
s.push(84) | Stack with int elements, ops=['push', 'pop', 'push', 'push']. |
770 | Python | Data Structures | intermediate | Implement a stack of ints and run the operation sequence: push, pop, push, push. | class BufStack:
def __init__(self):
self._items = []
def push(self, item):
self._items.append(item)
def pop(self):
return self._items.pop()
def peek(self):
return self._items[-1]
s = BufStack()
s.push(27)
print(s.pop())
s.push(50)
s.push(12) | Stack with int elements, ops=['push', 'pop', 'push', 'push']. |
771 | Python | Data Structures | intermediate | Implement a stack of ints and run the operation sequence: push, pop, push, push. | class QStack:
def __init__(self):
self._items = []
def push(self, item):
self._items.append(item)
def pop(self):
return self._items.pop()
def peek(self):
return self._items[-1]
s = QStack()
s.push(17)
print(s.pop())
s.push(96)
s.push(78) | Stack with int elements, ops=['push', 'pop', 'push', 'push']. |
772 | Python | Data Structures | intermediate | Implement a stack of ints and run the operation sequence: push, pop, push, push. | class QStack:
def __init__(self):
self._items = []
def push(self, item):
self._items.append(item)
def pop(self):
return self._items.pop()
def peek(self):
return self._items[-1]
s = QStack()
s.push(6)
print(s.pop())
s.push(84)
s.push(25) | Stack with int elements, ops=['push', 'pop', 'push', 'push']. |
773 | Python | Data Structures | intermediate | Implement a stack of floats and run the operation sequence: push, push, push, pop. | class SStack:
def __init__(self):
self._items = []
def push(self, item):
self._items.append(item)
def pop(self):
return self._items.pop()
def peek(self):
return self._items[-1]
s = SStack()
s.push(70.76)
s.push(92.62)
s.push(8.41)
print(s.pop()) | Stack with float elements, ops=['push', 'push', 'push', 'pop']. |
774 | Python | Data Structures | intermediate | Implement a stack of floats and run the operation sequence: push, push, push, pop. | class BufStack:
def __init__(self):
self._items = []
def push(self, item):
self._items.append(item)
def pop(self):
return self._items.pop()
def peek(self):
return self._items[-1]
s = BufStack()
s.push(30.85)
s.push(47.95)
s.push(76.34)
print(s.pop()) | Stack with float elements, ops=['push', 'push', 'push', 'pop']. |
775 | Python | Data Structures | intermediate | Implement a stack of floats and run the operation sequence: push, push, push, pop. | class SStack:
def __init__(self):
self._items = []
def push(self, item):
self._items.append(item)
def pop(self):
return self._items.pop()
def peek(self):
return self._items[-1]
s = SStack()
s.push(5.34)
s.push(19.98)
s.push(55.5)
print(s.pop()) | Stack with float elements, ops=['push', 'push', 'push', 'pop']. |
776 | Python | Data Structures | intermediate | Implement a stack of floats and run the operation sequence: push, push, push, pop. | class ContainerStack:
def __init__(self):
self._items = []
def push(self, item):
self._items.append(item)
def pop(self):
return self._items.pop()
def peek(self):
return self._items[-1]
s = ContainerStack()
s.push(97.54)
s.push(89.6)
s.push(45.4)
print(s.pop()) | Stack with float elements, ops=['push', 'push', 'push', 'pop']. |
777 | Python | Data Structures | intermediate | Implement a stack of floats and run the operation sequence: push, push, pop, push, pop. | class Box_Stack:
def __init__(self):
self._items = []
def push(self, item):
self._items.append(item)
def pop(self):
return self._items.pop()
def peek(self):
return self._items[-1]
s = Box_Stack()
s.push(7.7)
s.push(42.48)
print(s.pop())
s.push(50.88)
print(s.pop()) | Stack with float elements, ops=['push', 'push', 'pop', 'push', 'pop']. |
778 | Python | Data Structures | intermediate | Implement a stack of floats and run the operation sequence: push, push, pop, push, pop. | class ContainerStack:
def __init__(self):
self._items = []
def push(self, item):
self._items.append(item)
def pop(self):
return self._items.pop()
def peek(self):
return self._items[-1]
s = ContainerStack()
s.push(28.14)
s.push(96.78)
print(s.pop())
s.push(95.62)
print... | Stack with float elements, ops=['push', 'push', 'pop', 'push', 'pop']. |
779 | Python | Data Structures | intermediate | Implement a stack of floats and run the operation sequence: push, push, pop, push, pop. | class CollStack:
def __init__(self):
self._items = []
def push(self, item):
self._items.append(item)
def pop(self):
return self._items.pop()
def peek(self):
return self._items[-1]
s = CollStack()
s.push(19.83)
s.push(81.64)
print(s.pop())
s.push(53.71)
print(s.pop()) | Stack with float elements, ops=['push', 'push', 'pop', 'push', 'pop']. |
780 | Python | Data Structures | intermediate | Implement a stack of floats and run the operation sequence: push, push, pop, push, pop. | class QStack:
def __init__(self):
self._items = []
def push(self, item):
self._items.append(item)
def pop(self):
return self._items.pop()
def peek(self):
return self._items[-1]
s = QStack()
s.push(17.39)
s.push(75.32)
print(s.pop())
s.push(78.16)
print(s.pop()) | Stack with float elements, ops=['push', 'push', 'pop', 'push', 'pop']. |
781 | Python | Data Structures | intermediate | Implement a stack of floats and run the operation sequence: push, push, push, push, pop, pop. | class BufStack:
def __init__(self):
self._items = []
def push(self, item):
self._items.append(item)
def pop(self):
return self._items.pop()
def peek(self):
return self._items[-1]
s = BufStack()
s.push(21.49)
s.push(1.36)
s.push(57.62)
s.push(59.62)
print(s.pop())
prin... | Stack with float elements, ops=['push', 'push', 'push', 'push', 'pop', 'pop']. |
782 | Python | Data Structures | intermediate | Implement a stack of floats and run the operation sequence: push, push, push, push, pop, pop. | class ContainerStack:
def __init__(self):
self._items = []
def push(self, item):
self._items.append(item)
def pop(self):
return self._items.pop()
def peek(self):
return self._items[-1]
s = ContainerStack()
s.push(46.09)
s.push(71.07)
s.push(52.98)
s.push(31.04)
print(... | Stack with float elements, ops=['push', 'push', 'push', 'push', 'pop', 'pop']. |
783 | Python | Data Structures | intermediate | Implement a stack of floats and run the operation sequence: push, push, push, push, pop, pop. | class ContainerStack:
def __init__(self):
self._items = []
def push(self, item):
self._items.append(item)
def pop(self):
return self._items.pop()
def peek(self):
return self._items[-1]
s = ContainerStack()
s.push(12.79)
s.push(23.17)
s.push(53.82)
s.push(29.89)
print(... | Stack with float elements, ops=['push', 'push', 'push', 'push', 'pop', 'pop']. |
784 | Python | Data Structures | intermediate | Implement a stack of floats and run the operation sequence: push, push, push, push, pop, pop. | class BufStack:
def __init__(self):
self._items = []
def push(self, item):
self._items.append(item)
def pop(self):
return self._items.pop()
def peek(self):
return self._items[-1]
s = BufStack()
s.push(92.8)
s.push(27.77)
s.push(79.27)
s.push(64.6)
print(s.pop())
print... | Stack with float elements, ops=['push', 'push', 'push', 'push', 'pop', 'pop']. |
785 | Python | Data Structures | intermediate | Implement a stack of floats and run the operation sequence: push, pop, push, push. | class ContainerStack:
def __init__(self):
self._items = []
def push(self, item):
self._items.append(item)
def pop(self):
return self._items.pop()
def peek(self):
return self._items[-1]
s = ContainerStack()
s.push(12.5)
print(s.pop())
s.push(63.64)
s.push(97.25) | Stack with float elements, ops=['push', 'pop', 'push', 'push']. |
786 | Python | Data Structures | intermediate | Implement a stack of floats and run the operation sequence: push, pop, push, push. | class BufStack:
def __init__(self):
self._items = []
def push(self, item):
self._items.append(item)
def pop(self):
return self._items.pop()
def peek(self):
return self._items[-1]
s = BufStack()
s.push(9.24)
print(s.pop())
s.push(55.38)
s.push(72.49) | Stack with float elements, ops=['push', 'pop', 'push', 'push']. |
787 | Python | Data Structures | intermediate | Implement a stack of floats and run the operation sequence: push, pop, push, push. | class Box_Stack:
def __init__(self):
self._items = []
def push(self, item):
self._items.append(item)
def pop(self):
return self._items.pop()
def peek(self):
return self._items[-1]
s = Box_Stack()
s.push(89.94)
print(s.pop())
s.push(98.54)
s.push(62.97) | Stack with float elements, ops=['push', 'pop', 'push', 'push']. |
788 | Python | Data Structures | intermediate | Implement a stack of floats and run the operation sequence: push, pop, push, push. | class QStack:
def __init__(self):
self._items = []
def push(self, item):
self._items.append(item)
def pop(self):
return self._items.pop()
def peek(self):
return self._items[-1]
s = QStack()
s.push(82.57)
print(s.pop())
s.push(96.56)
s.push(18.5) | Stack with float elements, ops=['push', 'pop', 'push', 'push']. |
789 | JavaScript | Data Structures | intermediate | Implement a stack of ints and run the operation sequence: push, push, push, pop. | class QStack {
#items = [];
push(item) { this.#items.push(item); }
pop() { return this.#items.pop(); }
peek() { return this.#items[this.#items.length - 1]; }
}
const s = new QStack();
s.push(69);
s.push(85);
s.push(100);
console.log(s.pop()); | Stack with int elements, ops=['push', 'push', 'push', 'pop']. |
790 | JavaScript | Data Structures | intermediate | Implement a stack of ints and run the operation sequence: push, push, push, pop. | class ContainerStack {
#items = [];
push(item) { this.#items.push(item); }
pop() { return this.#items.pop(); }
peek() { return this.#items[this.#items.length - 1]; }
}
const s = new ContainerStack();
s.push(14);
s.push(93);
s.push(96);
console.log(s.pop()); | Stack with int elements, ops=['push', 'push', 'push', 'pop']. |
791 | JavaScript | Data Structures | intermediate | Implement a stack of ints and run the operation sequence: push, push, push, pop. | class Box_Stack {
#items = [];
push(item) { this.#items.push(item); }
pop() { return this.#items.pop(); }
peek() { return this.#items[this.#items.length - 1]; }
}
const s = new Box_Stack();
s.push(84);
s.push(33);
s.push(81);
console.log(s.pop()); | Stack with int elements, ops=['push', 'push', 'push', 'pop']. |
792 | JavaScript | Data Structures | intermediate | Implement a stack of ints and run the operation sequence: push, push, push, pop. | class ContainerStack {
#items = [];
push(item) { this.#items.push(item); }
pop() { return this.#items.pop(); }
peek() { return this.#items[this.#items.length - 1]; }
}
const s = new ContainerStack();
s.push(71);
s.push(27);
s.push(57);
console.log(s.pop()); | Stack with int elements, ops=['push', 'push', 'push', 'pop']. |
793 | JavaScript | Data Structures | intermediate | Implement a stack of ints and run the operation sequence: push, push, pop, push, pop. | class BufStack {
#items = [];
push(item) { this.#items.push(item); }
pop() { return this.#items.pop(); }
peek() { return this.#items[this.#items.length - 1]; }
}
const s = new BufStack();
s.push(35);
s.push(27);
console.log(s.pop());
s.push(81);
console.log(s.pop()); | Stack with int elements, ops=['push', 'push', 'pop', 'push', 'pop']. |
794 | JavaScript | Data Structures | intermediate | Implement a stack of ints and run the operation sequence: push, push, pop, push, pop. | class Box_Stack {
#items = [];
push(item) { this.#items.push(item); }
pop() { return this.#items.pop(); }
peek() { return this.#items[this.#items.length - 1]; }
}
const s = new Box_Stack();
s.push(20);
s.push(58);
console.log(s.pop());
s.push(94);
console.log(s.pop()); | Stack with int elements, ops=['push', 'push', 'pop', 'push', 'pop']. |
795 | JavaScript | Data Structures | intermediate | Implement a stack of ints and run the operation sequence: push, push, pop, push, pop. | class Box_Stack {
#items = [];
push(item) { this.#items.push(item); }
pop() { return this.#items.pop(); }
peek() { return this.#items[this.#items.length - 1]; }
}
const s = new Box_Stack();
s.push(48);
s.push(19);
console.log(s.pop());
s.push(12);
console.log(s.pop()); | Stack with int elements, ops=['push', 'push', 'pop', 'push', 'pop']. |
796 | JavaScript | Data Structures | intermediate | Implement a stack of ints and run the operation sequence: push, push, pop, push, pop. | class SStack {
#items = [];
push(item) { this.#items.push(item); }
pop() { return this.#items.pop(); }
peek() { return this.#items[this.#items.length - 1]; }
}
const s = new SStack();
s.push(59);
s.push(24);
console.log(s.pop());
s.push(25);
console.log(s.pop()); | Stack with int elements, ops=['push', 'push', 'pop', 'push', 'pop']. |
797 | JavaScript | Data Structures | intermediate | Implement a stack of ints and run the operation sequence: push, push, push, push, pop, pop. | class Box_Stack {
#items = [];
push(item) { this.#items.push(item); }
pop() { return this.#items.pop(); }
peek() { return this.#items[this.#items.length - 1]; }
}
const s = new Box_Stack();
s.push(94);
s.push(24);
s.push(83);
s.push(37);
console.log(s.pop());
console.log(s.pop()); | Stack with int elements, ops=['push', 'push', 'push', 'push', 'pop', 'pop']. |
798 | JavaScript | Data Structures | intermediate | Implement a stack of ints and run the operation sequence: push, push, push, push, pop, pop. | class SStack {
#items = [];
push(item) { this.#items.push(item); }
pop() { return this.#items.pop(); }
peek() { return this.#items[this.#items.length - 1]; }
}
const s = new SStack();
s.push(23);
s.push(51);
s.push(88);
s.push(78);
console.log(s.pop());
console.log(s.pop()); | Stack with int elements, ops=['push', 'push', 'push', 'push', 'pop', 'pop']. |
799 | JavaScript | Data Structures | intermediate | Implement a stack of ints and run the operation sequence: push, push, push, push, pop, pop. | class SStack {
#items = [];
push(item) { this.#items.push(item); }
pop() { return this.#items.pop(); }
peek() { return this.#items[this.#items.length - 1]; }
}
const s = new SStack();
s.push(10);
s.push(55);
s.push(32);
s.push(59);
console.log(s.pop());
console.log(s.pop()); | Stack with int elements, ops=['push', 'push', 'push', 'push', 'pop', 'pop']. |
800 | JavaScript | Data Structures | intermediate | Implement a stack of ints and run the operation sequence: push, push, push, push, pop, pop. | class QStack {
#items = [];
push(item) { this.#items.push(item); }
pop() { return this.#items.pop(); }
peek() { return this.#items[this.#items.length - 1]; }
}
const s = new QStack();
s.push(93);
s.push(68);
s.push(18);
s.push(94);
console.log(s.pop());
console.log(s.pop()); | Stack with int elements, ops=['push', 'push', 'push', 'push', 'pop', 'pop']. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.