Answered Essay: list_handout 09/08/17 09:57:11 #include #include using namespace

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 <iomanip> #include <iostream> 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 < setw (14)< operation << s= << v.size ( ) Hint: The array based list is similar to the std: :vector class The single and double linked lists mimic the std: list class We will make a few more improvements to make the similarities even more striking soon. See cplusplus.com for details on the two std container classes mentioned for (int i-0 i<v.size); i++) cout << cout <<n; int main(int argc, char argv) Hint: For HW2, you will implement single linked list class member functions push_front , pop front) and front). For HW3, you will implement an improved findnode ) member function for the double linked 1ist class cout << left; printlist (list v, v) list v; v.push back (7) printlist(v.push back (7), v) v.push back (8)printlist(v.push_back (8), v)i v.push_back (9)printlist (v.push_back (9), v) v.insert (1, 20) printlist (v.insert (1,20) , v v.erase (2) v.insert (0, 11) printlist (v.insert (0,11), v) v.push_back (2)printlist (push_back (2) , v)i v.pop back ) v.insert (1, 4) printlist (v.insert (1,4), v) Hint: The single and double linked list classes share the implementation of many member functi ns. These are defined in the former and referred to by in the latter to save space printlist (v.erase (2) , v) printlist (pop_back ), v)i Hint: If you cant wrap your head around the code, draw a simple picture similar to those drawn in class. print list (v[1] = 5, v); printlist (clear, v)i v.clear i unix> ./list list v v.push-back (7) s=1 : 7 v.push_back (8) s-2 7 8 ˇ·push-back (9) s=3 : 7 8 9 v.insert (1,20) : 7 20 8 9 v.erase (2) v.insert (0,11) -4:11 7 20 9 push back (2) 5 11 7 20 9 2 pop back ) v.insert (1, 4) S-511 47 20 9 v[1] = 5 clear ( s=0 : s-37 20 9 s-4:11 7 20 9 s=5 : 11 5720 9 S=0

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

Expert Answer

 

node *findnode(int n){
node *p;
int count,found;
count = 0;
found = 0;
if (head == NULL)
return NULL;
p = head;
count
if (n < N/2) {
while (count <= N/2){
if (p->data == n){
found = 1;
break;
}
p = p->next;
count++;
}
}
else{
while (p->next != NULL)
p = p->next;
while (count <= N/2){
if (p->data == n){
found = 1;
break;
}
p = p->prev;
count++;
}
}
if (found == 1)
return p;
else
return NULL;

}

Buy Essay
Calculate your paper price
Pages (550 words)
Approximate price: -

Help Me Write My Essay - Reasons:

Best Online Essay Writing Service

We strive to give our customers the best online essay writing experience. We Make sure essays are submitted on time and all the instructions are followed.

Our Writers are Experienced and Professional

Our essay writing service is founded on professional writers who are on stand by to help you any time.

Free Revision Fo all Essays

Sometimes you may require our writers to add on a point to make your essay as customised as possible, we will give you unlimited times to do this. And we will do it for free.

Timely Essay(s)

We understand the frustrations that comes with late essays and our writers are extra careful to not violate this term. Our support team is always engauging our writers to help you have your essay ahead of time.

Customised Essays &100% Confidential

Our Online writing Service has zero torelance for plagiarised papers. We have plagiarism checking tool that generate plagiarism reports just to make sure you are satisfied.

24/7 Customer Support

Our agents are ready to help you around the clock. Please feel free to reach out and enquire about anything.

Try it now!

Calculate the price of your order

Total price:
$0.00

How it works?

Follow these simple steps to get your paper done

Place your order

Fill in the order form and provide all details of your assignment.

Proceed with the payment

Choose the payment system that suits you most.

Receive the final file

Once your paper is ready, we will email it to you.

HOW OUR ONLINE ESSAY WRITING SERVICE WORKS

Let us write that nagging essay.

STEP 1

Submit Your Essay/Homework Instructions

By clicking on the "PLACE ORDER" button, tell us your requires. Be precise for an accurate customised essay. You may also upload any reading materials where applicable.

STEP 2

Pick A & Writer

Our ordering form will provide you with a list of writers and their feedbacks. At step 2, its time select a writer. Our online agents are on stand by to help you just in case.

STEP 3

Editing (OUR PART)

At this stage, our editor will go through your essay and make sure your writer did meet all the instructions.

STEP 4

Receive your Paper

After Editing, your paper will be sent to you via email.

× How can I help you?