kth smallest element
Coddyの「バブルソート」コースのレッスン 10/11。
チャレンジ
簡単<strong>kth_smallest</strong> という名前の、異なる要素の配列、配列の長さ (n)、および整数 k (k<=n) を受け取る関数を作成してください。配列の中で k 番目に小さい要素を返してください。
入力例: arr=[2,4,6,1,5,7,8], n=7, k=3
3番目に小さい要素は 4 です。
出力: 4
自分で試してみよう
#include <stdio.h>
#include <stdlib.h>
int kth_smallest(int* arr, int arr_size, int n, int k) {
// ここにコードを記述してください
return 0;
}
バブルソートのすべてのレッスン
1Basics of Bubble Sort
IntroductionWorking of the Bubble SortSwap adjacent elementsBubble Sort Algorithm