Menu

[Solved] 2 Queue Given Following Declarations Returns Random Number B Inclusive Int Random Const In Q37220536

2. Now for a queue, given the following declarations: // returns a random number between a and b inclusive int random (const

2. Now for a queue, given the following declarations: // returns a random number between a and b inclusive int random (const int a, const int b) // stack node struct qnode t string s; snode *next; // queue class class Queue [ private: qnode *head, *tail; public: Queue() { head = NULL; tail = NULL Queue ) int enqueue (string); // does not add “” on stack eturns “” if queue is empty ring dequeue // r ostream& print (ostream&) a. (5pts) Write the code for the enqueue method b. (5pts) Write the code for the dequeue methood c. (15pts) If you have a sorted array of 200 strings, implement the Fisher-Yates shuffle algorithm to create a random permutation of the array and store the final results in a Queue and print out the results. (EXTRA)(5pts) Estimate the running time of your implementation. Express in big-O notation. d. Show transcribed image text 2. Now for a queue, given the following declarations: // returns a random number between a and b inclusive int random (const int a, const int b) // stack node struct qnode t string s; snode *next; // queue class class Queue [ private: qnode *head, *tail; public: Queue() { head = NULL; tail = NULL Queue ) int enqueue (string); // does not add “” on stack eturns “” if queue is empty ring dequeue // r ostream& print (ostream&) a. (5pts) Write the code for the enqueue method b. (5pts) Write the code for the dequeue methood c. (15pts) If you have a sorted array of 200 strings, implement the Fisher-Yates shuffle algorithm to create a random permutation of the array and store the final results in a Queue and print out the results. (EXTRA)(5pts) Estimate the running time of your implementation. Express in big-O notation. d.

Expert Answer


Answer to 2. Now for a queue, given the following declarations: // returns a random number between a and b inclusive int random (c… . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *