diff --git a/K,th smallest element in array b/K,th smallest element in array new file mode 100644 index 0000000..05d5e5a --- /dev/null +++ b/K,th smallest element in array @@ -0,0 +1,11 @@ +def kthSmallest(arr, N, K): #arr=Array N=len(array) K=Kth element in array + arr.sort() + return arr[K-1] +if __name__ == '__main__': + arr = [12, 3, 5, 7, 19] + N = len(arr) + K = 2 + + # Function call + print("K'th smallest element is", + kthSmallest(arr, N, K))