vector<int> initial={4,7,16,18,8,11,10,15,5,9,2,6,17,19,12,13,1,3,14,20};
Vector<vector<int>> allparents;//This is a 2D vector of size [10][20] in which each row consists of a randomly shuffled vector of initial.
I want to first sort the initial vector in an ascending manner and generate a new vector (vector<int>ascending) and then find the corresponding index of that element in every row of the allparents vector.This is to repeated for all the rows of the allparents vector and then be stored in a new 2d vector(vector<vector<int>> index.I have written a function below which should do this,but it throws this error : Process returned -1073741819 (0xC0000005)
As i am new to vectors,I would request your help in debugging this error.Thanks.
(2) Please consider the intelligibility of what you have written. I'm looking at:
I want to first sort the initial vector in an ascending manner [OK]
... and generate a new vector (vector<int>ascending) [OK]
... and then find the corresponding index of that element [WHAT ELEMENT?]
... of the allparents vector.
... This [WHAT?]
.... is to [BE] repeated for all the rows of the allparents vector [???]
.... and then [WHAT?] be stored in a new 2d vector(vector<vector<int>> index.
(3) As for your code, where are initial[] and index[][] defined?