Bucket Sort stundent vector

how the vector is able to store the two entity at the same place in the student ex case the vector is able to store the two entity in one index ?

@Vikaspal hey you can take vector of pairs which can store two entity at same place ,here is syntax: vector< pair < int , int > > vect;
// initializing 1st and 2nd element of
// pairs with array values
int arr[] = {5, 20, 10, 40 };
int arr1[] = {30, 60, 20, 50};
int n = sizeof (arr)/ sizeof (arr[0]);

// Entering values in vector of pairs
for(int i=0; i<n; i++) `
vect.push_back( make_pair(arr[i],arr1[i]) );

// Printing the original vector(before sort())

cout << “The vector before applying sort is:\n”;

for(int i=0; i<n; i++) {
// “first” and “second” are used to access
// 1st and 2nd element of pair respectively
cout << vect[i].first << " ";
<< vect[i].second << endl;
}

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.