admin@onlinelearningcenter.in (+91) 7 999 01 02 03

Find Kth smallest and largest element in an array

Kopal Jaiswal
352 Posts

WAP to find Kth smallest and largest element in an array.

 

Example:

input:

arr[]={12,456,23,45,67,89,50,20}

k=2

 Output:

2nd smallest = 29

2nd largest  = 89

 

 

Published By : Kopal Jaiswal
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.

Comments

Jquery Comments Plugin