kth smallest element
Lección 10 de 11 del curso Ordenamiento de burbuja de Coddy.
Desafío
FácilCrea una función llamada <strong>kth_smallest</strong> que recibe un arreglo de elementos distintos, la longitud del arreglo (n) y un entero k (k<=n). Devuelve el k-ésimo elemento más pequeño del arreglo.
Entrada de ejemplo: arr=[2,4,6,1,5,7,8], n=7, k=3
El 3er elemento más pequeño es 4.
Salida: 4
Pruébalo tú mismo
#include <stdio.h>
#include <stdlib.h>
int kth_smallest(int* arr, int arr_size, int n, int k) {
// Escribe el código aquí
return 0;
}
Todas las lecciones de Ordenamiento de burbuja
1Basics of Bubble Sort
IntroductionWorking of the Bubble SortSwap adjacent elementsBubble Sort Algorithm