As the Bitcoin price has quadrupled in the past one year
Ask Expert

Be Prepared For The Toughest Questions

Practice Problems

As the Bitcoin price has quadrupled in the past one year

Problem 2 Profit maximisation in block mining - version 1.

As the Bitcoin price has quadrupled in the past one year (9/2020-9/2021), you have made a decision of becoming a miner to earn some profit. You find out that in Bitcoin blockchain and the like, miners are responsible for constructing blocks and if successful (being the first to solve a puzzle), will receive not only a base reward but also transaction fees included in the transactions in the block. While the base reward is fixed and out of control of the miners, the transaction fees are not. You quickly figure out that one way for the miners to maximise their profit is to select the set of transactions that sum up to the highest fee. The problem formulation you come up with is: given n available transactions, in which transaction ti has size si and pays fee fi , 1 ≤ i ≤ n, the miner should select a set I of transaction (indices) that has the maximum total fee Σi∈I fi while guaranteeing that the total size Σi∈I si does not exceed the block size limit b.

a) Design a greedy algorithm for this problem (note that it does NOT have to return the optimal solution): algorithm description + short pseudocode + complexity analysis. Run it on the toy example in Table 1 with b = 8 and write down the list of transactions selected by the algorithm in their corresponding order.

b) Design a dynamic programming algorithm of complexity O(nb) that can find a set of transactions that maximises the profit: write down the recursion formula, build the dynamic programming table for the toy example in Table 1 with b = 8, and identify the set of transactions output by the algorithm together with the maximum profit.

Hint
ComputerGreedy algorithm is any algorithm which follows the problem-solving heuristic, at each stage, of making the locally optimal choice. It is an algorithmic paradigm which builds up a solution piece by piece, by always choosing the next piece which offers the most obvious and immediate benefit. ...

Know the process

Students succeed in their courses by connecting and communicating with
an expert until they receive help on their questions

1
img

Submit Question

Post project within your desired price and deadline.

2
img

Tutor Is Assigned

A quality expert with the ability to solve your project will be assigned.

3
img

Receive Help

Check order history for updates. An email as a notification will be sent.

img
Unable to find what you’re looking for?

Consult our trusted tutors.

Developed by Versioning Solutions.