Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C language please Print one line of output to the screen: the number of linked list nodes (as specificed below) that you were able to

image text in transcribed

C language please

Print one line of output to the screen: the number of linked list nodes (as specificed below) that you were able to dequeue through your linked list before running out of memory. Attempt to manage your memory so that you never run out of memory, in which case you should report completion of 100,012 dequeue operations. Write the C-language code for a linked list node structure that stores a pointer to a string as its data. Assuming this will be used in a queue, write the functions needed to enqueue at the tail of the queue and dequeue from the head of the queue. Your enqueue should accept a pointer to the string that is to be enqueued, attempt to create the node structure to store it, attempt to insert the structure into the queue, and return an integer error code. Your dequeue should act as a peek, returning a pointer to the string that was just dequeued or null in the case of a failure. Both enqueue and dequeue should also accept the address of a pointer to the head and the address of a pointer to the tail. Write a C-language main function that will test your code. Begin by enqueueing 10 nodes. Then enter a loop that will iterate 100,000 times. Each time the loop iterates, enqueue 1 node and then dequeue 1 node. After the loop has completed, dequeue 12 nodes. (If you coded your dequeue correctly, this will dequeue the remaining 10 nodes but will not crash your code to twice dequeue from an empty queue.) At the end of your program, you should have enqueued 100,010 nodes and dequeued 100,010 nodes but there should have never been more than 11 nodes in your queue at any time. All strings in this program should each be independently created groups of 1,000,000 randomly generated characters, each one in its own dynamically allocated memory space. If your enqueue ever reports a failure, terminate your loop and report the iteration number. If your random string generation ever fails, terminate your loop and report the iteration number. int enqueue (char * string, struct LLnode ** front, struct LLnode ** tail); char * dequeue (struct Linode ** front, struct Linode ** tail)

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

Database Design Query Formulation And Administration Using Oracle And PostgreSQL

Authors: Michael Mannino

8th Edition

1948426951, 978-1948426954

Students also viewed these Databases questions