i am unable to understand how to show the output in vectors,could you please tell the changes required?? and could you suggest me a way to execute the code without using vectors??
Merge k sorted arrays
@Vibhuti0206
āoutputā is a vector in your code. Vectors are very much like arrays. They offer all the functionality of arrays and much more. In order to print the contents in āoutputā , use a loop.
for(int i=0;i<output.size();i++) {
cout << output[i] << " ";
}
https://ide.codingblocks.com/s/159869..i have written the code,still it is showing warnings and errors?unable to debug,modifications required?
@Vibhuti0206
You havent allocated any memory to the 2D vector āarrā. When you push back in arr[i] , you first need to have a arr[i] . Allocate memory to the 2D vector arr of size k and that should resolve the runtime error.
I hope Iāve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.