See list_handout.pdf for the class definition and implementation of a double linked list. Rewrite the findnode(int index)functionto perform a forward search in the first half ofthe list if index<N/2 and a backward search in the second half of the list otherwise. The result should be that no more than N/2 nodes will be visited as part of a search.Hint: Sketch what you are trying to accomplish on a piece of paper before you thinkabout the code.

list_handout 09/08/17 09:57:11 #include #include using namespace std; Hint: Notice how the three different list implementations on the next several pages use the SAME public interface with the only differences being wrt the implementation details class 1ist/see next several pages Hint: Notice how the operator member functions are overloaded differently to support the different underlying 1ist types void printlist (const char operation, list &v) cout
node *findnode(int n){
node *p;

See roll_handout.pdf coercion the arrange limitation and toolation of a inclose linked roll. Rewrite the findnode(int protest)functionto discharge a impertinent quest in the chief half ofthe roll if protest<N/2 and a awkward quest in the assist half of the roll incorrectly. The effect should be that no over than N/2 nodes achieve be visited as segregate of a quest.Hint: Sketch what you are troublesome to achieve on a constituent of paper antecedently you thinkabout the sequence.

list_handout 09/08/17 09:57:11 #include #include using namedistance std; Hint: Notice how the three irrelative roll toolations on the contiguous distinct pages correction the SAME general interface with the merely differences life wrt the toolation details arrange 1ist/see contiguous distinct pages Hint: Notice how the operator part offices are overloaded irrelatively to food the irrelative underlying 1ist types wanting imprintroll (const char performance, roll &v) cout

node *findnode(int n){

node *p;

int compute,found;

compute = 0;

fix = 0;

if (mind == NULL)

return NULL;

p = mind;

count

if (n < N/2) {

while (compute <= N/2){

if (p->data == n){

fix = 1;

break;

}

p = p->next;

count++;

}

}

else{

while (p->contiguous != NULL)

p = p->next;

while (compute <= N/2){

if (p->data == n){

fix = 1;

break;

}

p = p->prev;

count++;

}

}

if (fix == 1)

return p;

else

return NULL;

}