Question

1. Fill the blanks in the table with big Oh notation about the performance of these...

1. Fill the blanks in the table with big Oh notation about the performance of these operations

Operation Name

Performance (O(?))

Stack’s push(o) (array based)

Stack’s pop(o) (array based)

Queue’s enqueuer (array based)

Queue’s dequeuer (array based)

Vector’s InsertAtRank(r, o) (array based)

Vector’s InsertAtRank(r, o) (linked list based)

Vector’s ReplaceAtRank(r, o) (array based)

Vector’s ReplaceAtRank(r, o) (linked list based)

List’s ReplaceElement(p, o) (linked list based)

List’s SwapElements(p, q) (linked list based)

2. To include exactly 25 nodes, draw the tallest and shortest binary trees. What are the height of these two trees?

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Answer :

1.  Stack’s push(o) (array based) - O(1) , Each time another component is included toward the finish of array. Along these lines, independent of number of components as of now in the array, this task will dependably take same time. So it will be O(1).

2. Stack’s pop(o) (array based)-- O(n) Each time first component of array is expelled, all outstanding n-1 components are climbed. so it will be O(n).

For 3 and 4. Queue is a first in first out data structure. Similarly as with stack, getting to a particular component of the Queue should be possible in linear time O(n), as we have to cross it. However, we as a rule have a pointer/reference to the first and last component of the queue. In this way both enqueue and dequeue can be performed in consistent time O(1).

DEAR PLEASE DO RATE IT IF HELPS ELSE LET ME KNOW YOUR DOUBT.

NOTE : KINDLY POST SEPARATELY AS WE ARE RESTRICTED TO ANSWER ONLY A SINGLE QUESTION FROM MULTIPLE POSTED QUESTIONS. FURTHERMORE , WE ARE ALLOWED TO ANSWER ONLY FIRST FOUR PARTS OF THE QUESTION WITH MANY SUB PARTS.

THANK YOU!!!

Add a comment
Know the answer?
Add Answer to:
1. Fill the blanks in the table with big Oh notation about the performance of these...
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. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Can you please help with the below? 1)   Which of the following is true about using...

    Can you please help with the below? 1)   Which of the following is true about using a 2-3-4 tree? a.   It is designed to minimize node visits while keeping to an O(log n) search performance b.   It is designed to self-balance as new values are inserted into the tree c.   As soon as a node becomes full, it performs the split routine d.   None of the above 2)   Which of the following is true about a binary search tree? a.  ...

  • Goals This assignment is an individual assignment and you will work on it on your own....

    Goals This assignment is an individual assignment and you will work on it on your own. The goal of this assignment is to be able to use stacks and queues, and to master and have an in-depth understanding of such primitive ADTs. In this assignment you will build a more complex ADT using the primitive stack and queue ADTs. Moreover, an important goal of this assignment is to be able to analyze an ADT that you will build yourself using...

  • JAVA 3 LECTURE REVIEW PLEASE NEED ANSWERS ASAP. DUE IN AN HOUR!!! Question 12 points The...

    JAVA 3 LECTURE REVIEW PLEASE NEED ANSWERS ASAP. DUE IN AN HOUR!!! Question 12 points The best-case performance for a shell sort is: --- O(1) O(n2)   O(n) O(n log n)   Signaler cette question Question 22 points The best-case performance for an array of n items using insertion sort is: --- O(n2)   O(n) O(1) there is no best-case Signaler cette question Question 3 2 points A recursive method that processes a chain of linked nodes --- uses the first node in...

  • This assignment is comprised of 3 parts: ​All files needed are located at the end of...

    This assignment is comprised of 3 parts: ​All files needed are located at the end of the directions. Part 1: Implementation of Dynamic Array, Stack, and Bag First, complete the Worksheets 14 (Dynamic Array), 15 (Dynamic Array Amortized Execution Time Analysis), 16 (Dynamic Array Stack), and 21 (Dynamic Array Bag). These worksheets will get you started on the implementations, but you will NOT turn them in. ​Do Not Worry about these, they are completed. Next, complete the dynamic array and...

  • JAVA 3 PLEASE ANSWER AS MANY QUESTIONS AS POSSIBLE! ONLY 2 QUESTIONS LEFT THIS MONTH!!! Question...

    JAVA 3 PLEASE ANSWER AS MANY QUESTIONS AS POSSIBLE! ONLY 2 QUESTIONS LEFT THIS MONTH!!! Question 12 pts Which is a valid constructor for Thread? Thread ( Runnable r, int priority ); Thread ( Runnable r, String name ); Thread ( int priority ); Thread ( Runnable r, ThreadGroup g ); Flag this Question Question 22 pts What method in the Thread class is responsible for pausing a thread for a specific amount of milliseconds? pause(). sleep(). hang(). kill(). Flag...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT