Ask Question, Ask an Expert


Ask Computer Engineering Expert

1. On the east coast of the U.S. there are many toll roads such as the Pennsylvania Turnpike and the Garden State Expressway. When you enter the toll road you get handed a ticket with your entrance location marked on it. Then when you exit the toll road you pay an amount based on where you entered and exited. To be precise, each segment (from exit i to exit i+1) has a cost Ci,i+1 and the cost of entering at exit j and exiting at exit k (for j < k) is equal to k-1i=j Ci,i+1. If the road has n exits then it has n-1 segments which can be represented in a one dimensional array, C[1,....,n-1], where C[i] holds the cost to travel from exit i to exit i + 1. Clearly, if you have the array C you can determine the cost of traveling from exit j to exit k by computing k-1i=j Ci,i+1 which will take O(k-j) time.

Show how to build a data structure that will allow you to determine the cost of traveling from exit j to exit k on the toll road in O(1) time. A fair answer creates a data structure that has O(n2) elements. A better answer creates a data structure that has O(n) elements.

Be sure to justify the correctness of your solution and analyze the running time required to build your data structure.

2. A binary tree is full if all of its nodes have either zero or two children. Let Bn denote the number of full binary trees with n nodes.
(a) Draw all full binary trees with 3, 5, and 7 nodes and determine the exact values of B3,B5,B7.

(b) Why did I leave out trees with an even number of nodes?

(c) For odd n devise a recurrence relation for Bn and bound its value in terms of n.

3. A one pass auction is an auction in which each bid must be immediately and irrevocably accepted or refused. Specifically, a one pass auction works as follows:

• A seller announces the availability of an item

• n buyers agree to bid on the item and are presented to the seller in random order.

• When buyer i appears he must make a bid bi > 0 without any knowledge of the bids thus far.

• The seller must decide immediately whether to accept or reject buyer i's bid. If the seller accepts then all future buyers are turned away. If the seller rejects then buyer i leaves and his bid is withdrawn.

Obviously the seller would like to maximize her profit but since she doesn't know what future bids will be and she can't accept a bid she has already rejected she will never be able to formulate an algorithm that ensures that she accepts the highest bid. She must turn to a probabilistic algorithm. Consider the following two phase algorithm that a seller may follow:

1) Reject the first n/10 bids but keep track of the largest bid seen. Call that bid B*.

2) In the remaining bids accept the first bid that surpasses B* (if none surpass B* then accept the very last bid).

Investigate this algorithm and try to answer the following problems:

(a) Using the given algorithm what is the probability that the seller accepts the highest bid?

(b) Can you come up with a better probabilistic algorithm for a one pass auction? Justify why it is better.

(c) In general, how do you determine whether one algorithm is better than another for this type of auction?

Computer Engineering, Engineering

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

Have any Question? 

Related Questions in Computer Engineering

1 assume a data structure is made of an integer of value

1. Assume a data structure is made of an INTEGER of value (131) and another structure made of an IPAddress of value ( and an OCTETSTRING ("UDP"). Using BER, encode the data structure. 2. Given the code 0204000 ...

For hash functions it is crucial to have a sufficiently

For hash functions it is crucial to have a sufficiently large number of output bits, with, e.g., 160 bits, in order to thwart attacks based on the birthday paradox. Why are much shorter output lengths of, e.g., 80 bits, ...

Assignment1must be a 200-300 word responsesupporting

Assignment 1.) Must be a 200-300 word response Supporting Activity: Version Control Concerns Discuss the concerns of trying to maintain multiple baselines of your system. For example, Microsoft in 2015 announced they wou ...

Systems programming assignmenttask 1now that the os has a

Systems Programming Assignment Task 1 Now that the OS has a keyboard driver, it is possible to produce a simple command processor. You should expand the Run() method in command.c to produce a simple command processor tha ...

Extend the postfix calculator adt as followsa to perform

Extend the Postfix Calculator ADT as follows: (a) To perform several unary operations commonly found on scientific calculators: absolute value, square root, sine, cosine, and tangent. The operations should be specified t ...

Q1 suppose you have a digital signal with a period of 1500

Q1. Suppose you have a digital signal with a period of 1500 milliseconds. What is the period in microseconds? Q2. What is the 12-bit BCD binary code for 538 10 ? Q3. Convert the 8-bit unsigned binary value 01111010 2 to ...

Q1 explain the difference in sram and dramq2 assume a

Q1. Explain the difference in SRAM and DRAM. Q2. Assume a computer has the capacity to hold up to 4 memory modules, with each module containing 1G bytes. How many total bits are needed in the memory address? Q3. What is ...

The original us income tax of 1913 was quite simple the tax

The original U.S. income tax of 1913 was quite simple. The tax was • 1 percent on the first $50,000. • 2 percent on the amount over $50,000 up to $75,000. • 3 percent on the amount over $75,000 up to $100,000. • 4 percen ...

In problem how far upstream does the flow from the source

In Problem, how far upstream does the flow from the source reach? Problem :- For the case of a source at the origin with a uniform free stream plot the streamline ψ = 0.

1 what are the conceptual differences between a reference

1. What are the conceptual differences between a reference validation mechanism, a trusted computing base, and the TOE Security Functions? 2. Choose a Common Criteria protection profile and a security target of a product ...

  • 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

WalMart Identification of theory and critical discussion

Drawing on the prescribed text and/or relevant academic literature, produce a paper which discusses the nature of group

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