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

What is the time complexity as a function of the number n

What is the time complexity, as a function of the number n of vertices and m of edges, of the following network operations if the network in question is stored in adjacency list format? a) Calculating the mean degree. b) ...

1 in the game of life can you construct a glider gun of

1. In the Game of Life, can you construct a glider gun of glider emission period 15? Period 20? Save your configurations as buttons in the Life model in the NetLogo models library. 2. A methuselah is a small pattern that ...

Rewrite exercise 1 so that it stores the words from a text

Rewrite Exercise 1 so that it stores the words from a text file. Display all the words in the file and the number of times they occur in the file. Exercise 1 Write a program that generates 10,000 random integers in the r ...

This year our challenge will be based on the european

This year our challenge will be based on the European Soccer Database (https://www.kaggle.com/hugomathien/soccer). Judging criteria: Solutions will be judged by a panel of judges based on the responses to the two Challen ...

Define the aspects of a swot analysis and how it can

Define the aspects of a SWOT analysis and how it can benefit a company.

What is the difference and similarity between the network

What is the difference and similarity between the network interface adapter at an end-host and at an Ethernet switch(assuming both are attached to a shared-media)?

Cpsc programthis is the programwrite a class to represent a

CPSC Program This is the program Write a class to represent a dynamically sized array of integers. Name it DynArray. submit: a file named dynarray.h that contains all of your class code Class specifications: Private data ...

Suppose one wishes to confirm that none of the files in the

Suppose one wishes to confirm that none of the files in the directory /usr/spool/lpd are worldreadable. a. What would the fourth field of the tripwire database contain? b. What would the second field of the RIACS databas ...

Modeling food webs we mentioned how abm can be used to

Modeling food webs We mentioned how ABM can be used to describe food webs. However, these models are often written as an aggregate description. Imagine a model where instead of individual wolf and sheep there is simply a ...

Consider these three networksa find a 3-core in the first

Consider these three networks: a) Find a 3-core in the first network. b) What is the reciprocity of the second network? c) What is the cosine similarity of vertices A and B in the third network?

  • 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