Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

QUESTION 3: STACKS AND QUEUES [9pts] On the attached ZipGrade sheet answer the following questions: ZipGrade 1. A stack is LIFO while a gueue is

image text in transcribed

QUESTION 3: STACKS AND QUEUES [9pts] On the attached ZipGrade sheet answer the following questions: ZipGrade 1. A stack is LIFO while a gueue is FIFO B. False A. True ZipGrade 2. Assuming is an empty stack, what will be the stack contents (from bottom to top) after the given sequence of operations: s.push (1); if(s.pop ( ) % 3--1) s.push (2); s push (3) A. 2,3 C. [3,2 D. [3,1] ZipGrade 3. Assuming q is the given sequence ofoperatus, what villbthe queue contents (Crom front to back) after q.enqueue (1); q.enqueue (2) q.dequeue if (q.peek ( )-I) //look at front q.enqueue (3); ZipGrade 4. You have a stack whose internal storage is a linked list which appears in memory as 5 nul1 where x is the head of the internal storage and there is no tail pointer. Assumi with the optimal Big-O, what value is on the top of the stack? A. 5 ing the Stack class is built C. Any value 1-5 D. null E. Either 1 or 5, but not 2-4 B.1 ZipGrade 5. You have a gueue whose internal storage is a dynamic array which appears in memory as 12 3 4 5 where x is the pointer to the internal storage and additional helper values may be in the Queue class. Assuming the Queue class is built with the optimal Big-0, what value is at the front of the queue? A. 5 B. 1 C. Either 1 or 5, but not 2-4 D. Any value 1-5 E. null QUESTION 4: ITERATORS [4pts] Given a doubly-linked list with the following Node definition: class Node next Node current - head:? A. public boolean hasNext) return current.next null;\ B. public boolean hasNext) return currentnull;h C. public boolean hasNext return current.next nul1; D. public boolean hasNext() { return current != null;}

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 Concepts

Authors: David M Kroenke, David J Auer

6th Edition

0132742926, 978-0132742924

More Books

Students also viewed these Databases questions