Question

1.A stack implemented with an array has what performance? Select one: a. O(n3) b. O(n log...

1.A stack implemented with an array has what performance?

Select one:

a.

O(n3)

b.

O(n log n)

c.

O(n)

d.

O(n2)

2.

A stack uses the first in first out insertion and deletion method.

Select one:

True

False

3. Match the following stack operations with their meaning.

object pop();

boolean isEmpty();

push (object);

integer size();

object top();

meanings are:

- returns the number of elements stored

-just removes the last inserted elements

- returns the last inserted elements without removing it

-inserts an element

-indicates whether no elements are stored

-removes snd returns the last inserted element

Homework Answers

Answer #1

Solution 1: Option C is the correct option as the stack could be implemented using an array in O(n) of time.

Solution 2: It is False as the Stack actually uses the Last In First Out mode of operation while a Queue actually uses the First In First Out mode of operation.

Solution 3: Given below is the correct match for each and every stack operation:

  • object pop(): Removes snd returns the last inserted element
  • boolean isEmpty(): Indicates whether no elements are stored
  • push(object): Inserts an element.
  • integer size(): Returns the number of elements stored
  • object top(): Returns the last inserted elements without removing it

Here's the solution to your question and it is absolutely correct, please please please provide it a 100% rating. Thanks for asking and happy learning!!

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT