in the code video they didnt show how to take the input from user as value and random pointer
How to take the input(random pointer) form user?
@rkrrockstar89 its a normal integer only as you can see in the sample input…you can take input easily. The input format is:
int n
n lines containing: val, index
index should be a pointer rgt?
@ishita index should be a pointer right?? to point to the given data in that index
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.
@rkrrockstar89 hey for input you have to use hashing ,see this function for your reference:
Node* createList(int num,unordered_map<Node*,int> &Random,int i,unordered_map<int,Node*> &node_number){
if(num == 0) {
node_number[-1] = NULL;
return NULL;
}
int a,b; cin>>a>>b;
Node* n = new Node(a);
n->next = createList(num-1,Random,i+1,node_number);
Random[n] = b;
node_number[i] = n;
return n;
}
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.