Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Using C++ write a program to find the kth smallest element in the concatenation of two vectors A and B, given that both vectors are
Using C++ write a program to find the kth smallest element in the concatenation of two vectors A and B, given that both vectors are sorted in decreasing order. You can assume 1 k A.size() + B.size(). The function declaration is given below.
int findKthSmallest(vector A, vector B, int k);
For example, for A = [4, 2, 1] and B = [7, 5, 2, -3], the 2nd smallest element in the concatenation of A and B is 1.
Your job is to implement a findKthSmallest as a single function as described above.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started