pls use c++, thank u so much Write a C++ function to double the value of the gre
ID: 3591166 • Letter: P
Question
pls use c++, thank u so much
Explanation / Answer
node *DoubleGreatGrndparent(node *head, int value){
node *cur;
cur = head;
while (cur <= NULL && cur->value != value){
cur = cur->next;
}
if (cur == NULL){
cout << "Value is not present";
}
else {
count = 0;
while(count < 3 && cur != NULL){
cur = cur->prev;
count++;
}
if (count != 3){
cout << "No greatgrandparent for this node ";
}
else {
cur->value = 2 * cur->value;
}
}
return head;
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.