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 are the helo and mail from commands both necessary in

1. Are the HELO and MAIL FROM commands both necessary in SMTP? Why or why not? 2. In Figure 26.13 in the text, what is the difference between the MAIL FROM in the envelope and the FROM in the header?

1 the discussion of acyclic creates imposes constraints on

1. The discussion of acyclic creates imposes constraints on the types of created subjects but not on the types of created objects. Why not? 2. Prove that if a graph for cc is constructed and has no loops, the system is a ...

1 in ftp can a server retrieve a file from the client site2

1. In FTP, can a server retrieve a file from the client site? 2. In FTP, can a server get the list of the files or directories from the client? 3. FTP can transfer files between two hosts using different operating system ...

1 what is a hybrid firewall2 list the five generations of

1. What is a hybrid firewall? 2. List the five generations of firewall technology. Which generations are still in common use? 3. How does a commercial-grade firewall appliance differ from a commercial-grade firewall syst ...

1 what is the difference between a compiler and an

1. What is the difference between a compiler and an interpreter? 2. What are the advantages of (a) a compiler over an interpreter (b) an interpreter over a compiler? 3. What advantages are there to a language-processing ...

Based on klamaths requirements select some network

Based on Klamath's requirements, select some network optimization technologies that will help maintain video quality for the distance-learning program. Based on Figure 11-6, "New Core WAN at Klamath," draw a network topo ...

1 why should salts be chosen at random2 does using

1. Why should salts be chosen at random? 2. Does using passwords with salts make attacking a specific account more difficult than using passwords without salts? Explain why or why not. 3. Show that a system using an EKE ...

1 convert the following c function to the corresponding

1. Convert the following C function to the corresponding MIPS assembly procedure:  int count(int Model[], Color[], Year[], int n, intx,y,z) {   int res = 0;                 inti = 0;  for(i = 0; i != n; i++)              ...

1 what are the most important criteria for selecting an

1. What are the most important criteria for selecting an internetworking device? 2. What is the difference between single-mode and multimode fiber? Which is faster? 3. Why are QoS features often necessary in LAN switches ...

Q 1 identify and explain the three major interrelated tasks

Q. 1 Identify and explain the three major interrelated tasks for creating 3-D animation. a. creating the objects and scenes b. defining motion c. rendering the final animation Q. 2 Identify and explain the advantages of ...

  • 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