Ask Question, Ask an Expert

+1-415-315-9853

info@mywordsolution.com

Ask Computer Engineering Expert

problem 1: Suppose we implement a priority queue as a heap. Assume the queue has thousands of elements. Suppose further that we have four different priorities (1-4, highest to lowest). The heap typically has 5% of priority 1 elements, 10% priority 2 elements, 15% priority 3 elements, and 70% of priority 4 elements. The probability of the newly arriving element at priority i, P(i)  is  P(1) = 0.05, P(2) = 0.10, P(3) = 0.15 and P(4) = 0.7.

a) Find the average complexity of an enqueue operation.
b) Find the average complexity of the dequeue (remove) operation.

problem 2: Let's analyze the Heap enqueue/dequeue operations with different assumptions. Imagine that the elements already in the queue were put into a sequence with the head element at the front at the lowest priority elements toward the end. Then assume that any new element to be enqueued is equally likely to be placed anywhere into that sequence. You can assume that the heap contains n = 2k-1 elements for simplicity.

a) Find the average complexity of an enqueue operation.
b) Find the average complexity of the dequeue (remove) operation.

problem 3
: We considered building a balanced (or full) BST from a sorted array. Assume that the array has n = 2k-1 elements in sorted order. We will insert the array middle element first (as the root), then insert the middle element of the left half, then the middle element of the right half, and so on recursively. Since the array has n elements, the actual work at each level is the insert into the BST. Define the model (using a summation ) for the total number of comparisons to insert all the elements into the BST.

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M92983

Have any Question? 


Related Questions in Computer Engineering

Designing a model assume that you have been asked by the

Designing a model Assume that you have been asked by the city council to build an agent-based model of transportation patterns in the city. In particular they are interested in seeing where they should spend money with t ...

1 how does an nni differ from a uni2 what is the

1. How does an NNI differ from a UNI? 2. What is the relationship between TPs, VPs, and VCs? 3. How is an ATM virtual connection identified? 4. Name the ATM layers and their functions. 5. How many virtual connections can ...

Develop an algorithm fora an m x m median filter andb an m

Develop an algorithm for (a) an M x M median filter, and (b) an M x 1 separable median filter that minimizes the number of operations required for filtering N x N images, where N >> M. Compare the operation counts for M ...

1 create an array of 1000 integers sorted in numerical

1. Create an array of 1000 integers sorted in numerical order. Write a program that runs each sorting algorithm with this array, timing each algorithm, and compare the times. Compare these times to the times for sorting ...

1 assume object x has two simple variables an integer and

1. Assume object x has two simple variables: an integer and an IP address. What is the identifier for each variable? 2. Assume object x has only one table with two columns. What is the identifier for each column? 3. Assu ...

Consider a connected planar network with n vertices and m

Consider a connected planar network with n vertices and m edges. Let f be the number of "faces" of the network, i.e., areas bounded by edges when the network is drawn in planar form. The "outside" of the network, the are ...

1 why is pki so vital in modern communications2 discuss the

1. Why is PKI so vital in modern communications? 2. Discuss the role of digital signatures in modern communication. 3. Some say that with the development of systems such as IPSec, the role the CAs play in modern communic ...

In the fifth lab we investigate the state and behavior of

In the fifth lab, we investigate the state and behavior of the POP3 protocol. We retrieve the mails stored in our mailbox at the POP3 server and observe and analyze the states of the POP3 and the type and the contents of ...

Assume alice the client creates a tcp connection with bob

Assume Alice, the client, creates a TCP connection with Bob, the server. They exchange data and close the connection. Now Alice starts a new connection with Bob by sending a new SYN segment. The server responds with the ...

1 we would like to execute the loop below as efficiently as

1. We would like to execute the loop below as efficiently as possible. We have two different machines, a MIMD machine and a SIMD machine. 2. For a 4 CPU MIMD machine, show the sequence of MIPS instructions that you would ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Section onea in an atwood machine suppose two objects of

SECTION ONE (a) In an Atwood Machine, suppose two objects of unequal mass are hung vertically over a frictionless

Part 1you work in hr for a company that operates a factory

Part 1: You work in HR for a company that operates a factory manufacturing fiberglass. There are several hundred empl

Details on advanced accounting paperthis paper is intended

DETAILS ON ADVANCED ACCOUNTING PAPER This paper is intended for students to apply the theoretical knowledge around ac

Create a provider database and related reports and queries

Create a provider database and related reports and queries to capture contact information for potential PC component pro

Describe what you learned about the impact of economic

Describe what you learned about the impact of economic, social, and demographic trends affecting the US labor environmen