could you help me please

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

could you help me please

Post by answerhappygod »

could you help me please
Could You Help Me Please 1
Could You Help Me Please 1 (63.72 KiB) Viewed 14 times
Q4: An array of size MAX_SIZE is used to implement a circular queue. Front, Rear, and count are tracked. Suppose front is 0 and rear is MAX_SIZE -1. How many elements are present in the queue? a) 0 b) MAX_SIZE-1 c) MAX_SIZE d) 1 Q5: A simple queue, if implemented using an array of size MAX_SIZE, gets full when: a) rear=MAX_SIZE-1 b) B. front (rear+1)%MAX_SIZE c) C. front-rear+1 d) D. rear= (rear+1)%MAX_SIZE Q6: Given the following data structures: 1. Singly linked list with only head pointer 2. Singly linked list with head and tail pointers 3. Doubly linked list with head and tail pointers Which can efficiently represent a stack and which for a queue? Explain your answer. Q7: Assume that you have an empty circular queue (array-based implementation) which can hold only four elements. What are the array indices of the back and the front elements after executing this series of queue operations: enqueue ("a"), enqueue("b"), getFront (), enqueue(“c"), enqueue("d"), dequeue (), dequeue (), dequeue (), enqueue("a"), enqueue ("b"), enqueue ("c"), dequeue (), getFront (), enqueue ("d"), dequeue ()
Q8: What is the sequence of popped out values if the following sequence of operations are performed on a stack: push(1), push(2), push(1), pop, push(2), pop, pop, pop, push(2), pop Q9: Consider the algorithm described in the following pseudocode. What would be the output for the input "goodluck"? 1 declare a stack of characters 2 while there are more characters in the word to read ) { 3 read a character 4 push the character on the stack 5} 6 while the stack is not empty ) { 7 pop a character off the stack 8 write the character to the screen 9 } Q10: What does the following code fragment do to the queue? 1 Stack stack = new Stack(); 2 while (!queue.isEmpty()) 3 stack.push(queue.dequeue ()); while (!stack.is Empty()) 4 5 queue. enqueue (stack.pop());
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply