Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please answer all my incorrect answers for review (True True 1. (12 p.) Describe the order of magnitude of each of the following functions using

image text in transcribed

please answer all my incorrect answers for review

(True True 1. (12 p.) Describe the order of magnitude of each of the following functions using (single term) Big-o notation.. (a)n + n2 + 10n4 064) (b) n_logn + n2 + n3 ORDU (c) 10n(20n* - 5) otno correction - no (d) n* (n3 - 3) + (n4 - 4n* + 4) en V - (e) (n + n4 + 1)/(n + 4) or correction day - (f) 10n + 7n2 + 5n3 + 2n4 + no o n ) 2. (12 p.) True or False? Circle your choice. False (a) A stack is a FIFO (First In First Out) data structure True False (b) A stack is a LILO (Last In Last Out) data structure True (False (c) The stack pop operation should be classified as a "observer" False (d) The stack push operation should be classified as a "transformer" True False (e) The stack top operation should be classified as an "observer" True False (a) You can define multiple constructors for a given Java class. (1) Java interface may extend another interface. True False (g) Java interface may implement another interface. True False (h) Java class may extend another class. True False (1) Java class may implement another class. True False (k) If 5, 4, 3, 2, and 1 were pushed, in a given order, on an initially empty stack than 1 is on top of the stack. True False (0) If 1, 2, 3, 4, and 5 were pushed, in a given order, on an initially empty stack and then pop True operation was performed three times than 2 is on top of the stack. False In the next three problems consider class ArrayBoundedStack. Note that only method signatures are listed. public class ArrayBoundedStack implements Stackinterface { protected final int DEFCAP = 100; // Default capacity protected Tl elements; // Holds stack elements protected int toplndex = -1; // Index of top element in stack public ArrayBoundedStack(); // Default constructor. Stack capacity = DEFCAPO public ArrayBounded Stack(int max):// Non default constructor. Stack capacity = max public void push(T element); 1/ Push the element if stack is not full, otherwise throw Stack OverflowException public void popo: // Pop the top if stack is nonempty, otherwise throw StackUnderflowException public T top(); // Return the top if stack is nonempty, otherwise throw StackUnderflowException public boolean isEmpty: // Return true if stack is empty false otherwise public boolean isFull(); // Return true if stack is full false otherwise (b) Implement the isEmpty() method. 3. (12 p.) (a) Implement the push() method. Stack.push CE element) corrected Corrected Stack. Is Empty E element) - Public boolean is Empty (1){ return top Index ==-1; Public void push to con flis Fullci) th Stack Overflow Exception top indext; elementic top index]=el; F-18

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

Sql++ For Sql Users A Tutorial

Authors: Don Chamberlin

1st Edition

0692184503, 978-0692184509

More Books

Students also viewed these Databases questions

Question

Explain Coulomb's law with an example

Answered: 1 week ago

Question

What is operating system?

Answered: 1 week ago

Question

What is Ohm's law and also tell about Snell's law?

Answered: 1 week ago