Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question 1: Structure definition struct pizzaMaker char topping [30]; struct pizzaMaker * next; // the topping you to next topping (if you want more toppings)

image text in transcribed

image text in transcribed

image text in transcribed

Question 1: Structure definition struct pizzaMaker char topping [30]; struct pizzaMaker * next; // the topping you to next topping (if you want more toppings) typedef struct pizzaMaker pizzaNode; a. Create a pointer called headPizza that will point to the start of a list (head node), once the list is created. Since the list currently is empty, make headPizza point to NULL for now. b: Create a new node called pnode1 of type pointer to pizzaNode. Set topping of this new node to "Onion" and next to NULL. Make this the head node. c. Assume that you have the following Linked list: Write code to create a new node called newNode (where newNode is of type pizzaNode *). Prompt the user for a pizza topping of their choice to set the value of topping of newNode. Add this node as the last node of the list. So if the user enters Spinach, the new list now becomes: Question 2: Answer this question using the code given on the next page (page 2), You are given a struct (lines 7 12), definition of createBug (lines 62-72), printOneBug (lines 7480 ), addTail (lines 114129 ). a. Using the struct and functions given on page 2 , what gets printed by the following code? 3031323334353637383940structbugptrTemp=NULL;structbugheadLL=NULL;ptrTemp=createBug();headLL=addTail(headLL,ptrTemp);ptrTemp=createBug();headLL=addTail(headLL,ptrTemp);printOneBug(headLL);printOneBug(headLL->next); b. Write function definition for adding a bug at the front of the current list. Use the following prototype. It takes the current list and a new node, adds the new node to the front of the list. It returns the updated linked list. struct bug addFront (struct bug currentLL, struct bug* addMe); c. Write function definition for printing all bugs in the current list using the following prototype: void printBugs (struct bug currentLL); d. Write function definition for printing all bugs in the current list using the following prototype: void killAllBugs (struct bug currentLL); e. Rewrite the definition given on line 115 to add a bug at the end of the current list, using the following prototype. void addTailMethod2 (struct bug ** currentLL, struct bug * add/e)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions