Skip to content

Program for recursive finding kth smallest element in array

Notifications You must be signed in to change notification settings

Seygaa/findingKthElement

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

findingKthElement

Program for recursive finding kth smallest element in array.

Input:

  1. integer 1<=n<=106: number of sets
  2. n integers 1<=ai<=106: elements of array
  3. integer 1<=m<=100: number of requests for kth element
  4. m integers 1<=kj<=106: kth element to find

Output

For each set:

ki and found value when kth element exists

or

ki and word 'brak' otherwise

Example

Input

3
5
1 2 3 4 5
3
1 2 3
5
5 3 4 4 3
5
2 5 1 3 4
10
1 1 1 1 1 1 1 1 1 1
5
1 10 0 -1 11

Output

1 1
2 2
3 3
2 3
5 5
1 3
3 4
4 4
1 1
10 1
0 brak
-1 brak
11 brak

About

Program for recursive finding kth smallest element in array

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages