I am confused with Divide and Conquer (the technique we apply to solve a problem using recursion) and Induction.
Like if I am sorting an array using recursion, I will divide the whole array.
Something like below:
void sortv(vector<int> &v){
if(v.size()==1)
{ return; }
int num=v.back();
v.pop_back();
sortv(v);
insert(v,num);
}
So, when I am calling sortArray() inside sort array after decreasing one element from array I am assuming that, that call will sort that much part of the array and now I just have to insert the last element at the correct position.
Am I using divide and conquer strategy which says break the problem into smaller sub problems and approach and you should know how the sub-problems solution are related to each other or It is induction which says assume that your function can solve for the smaller problem!
Or are both of them are same?