Mozilla-Campus-Club-Cummins / CompetitiveProgramming-HacktoberFest23

1 stars 25 forks source link

Kth smallest element #4

Open ManasiGDeshmukh opened 10 months ago

ManasiGDeshmukh commented 10 months ago

Given an array arr[] and an integer K where K is smaller than size of array, the task is to find the Kth smallest element in the given array. It is given that all array elements are distinct.

Note :- l and r denotes the starting and ending index of the array.

Example 1:

Input: N = 6 arr[] = 7 10 4 3 20 15 K = 3 Output : 7 Explanation : 3rd smallest element in the given array is 7. Example 2:

Input: N = 5 arr[] = 7 10 4 20 15 K = 4 Output : 15 Explanation : 4th smallest element in the given array is 15. Your Task: You don't have to read input or print anything. Your task is to complete the function kthSmallest() which takes the array arr[], integers l and r denoting the starting and ending index of the array and an integer K as input and returns the Kth smallest element.

Expected Time Complexity: O(n) Expected Auxiliary Space: O(log(n)) Constraints: 1 <= N <= 105 1 <= arr[i] <= 105 1 <= K <= N

PalakAgrawaal commented 10 months ago

Can you assign me this issue? Palak Agrawal SY Comp A UCE2022412

Payalchandak5 commented 10 months ago

i want to work on this issue.Can you please assign me this issue Payal Chandak UEC2022118 SY ENTC

ManasiGDeshmukh commented 10 months ago

@Payalchandak5 Please create pr by tomorrow