Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

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

Question the redblue computation simulates two interactive

Question : The Red/Blue computation simulates two interactive flows: an n × n board is initialized so cells have one of three colors: red, white, and blue, where white is empty, red moves right, and blue moves down. Colo ...

Sql for databasebuild a query of all students on athletic

Sql for database Build a query of all students on athletic scholarship. Additionally, produce a report with descriptive report and column headings. Be sure there is enough data to prove the selection and sort worked as r ...

Question suppose you have a 50-bit string that contains

Question : Suppose you have a 50-bit string that contains exactly 37 ones at random positions. How many bits of entropy does this string contain?

Design a combinational circuit with three inputs a b and c

Design a combinational circuit with three inputs: A, B, and C, D and the output W. The output should be 1 only when the values of A, B interpreted as an unsigned integer (AB) is equal to the values of C, D interpreted as ...

Question you are required to sort a file containing

Question : You are required to sort a file containing integers between 0 and 999999. You cannot afford to use one million pigeon-holes, so you decide instead to use one thousand pigeon-holes numbered from 0 to 999. You b ...

Question suppose that a word of data is transferred from

Question : Suppose that a word of data is transferred from the main memory to the memory buffer register (MBR). However, after decoding the MBR comes to know that it is not the real data rather it is an indirection (poin ...

Question 1you want a list of products whose product lines

Question 1 You want a list of products whose product lines contain the term  Classic  or  Vintage.  please pick up best option from the following. a. SELECT productline FROM products WHERE MATCH(productline) AGAINST('Cla ...

Access your browsers security settings and configure the

Access your browser's security settings and configure the browser to refuse all cookies or to prompt you before allowing a cookie. Restart the browser; then visit several different Web sites. Be sure to visit popular sit ...

Question a supervisor states integration testing is a waste

Question : A supervisor states, "Integration testing is a waste of time. If each program is tested adequately, integration testing is not needed. Instead, we should move on to system testing as soon as possible. If modul ...

You are required but not limited to turn in the following

You are required, but not limited, to turn in the following source file: Requirements to get full credits in Documentation The assignment number, your name, StudentID, Lecture number(time), and a class description need t ...

  • 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

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As