laboon / CS1699_Fall2018

CS1699 - BLOCKCHAIN TECHNOLOGY AND CRYPTOCURRENCY
MIT License
37 stars 19 forks source link

Delieverable2 : Treemap with dupulicate #35

Closed koseoyoung closed 5 years ago

koseoyoung commented 5 years ago

Hi, I have a question about storing the information of transactions! (especially about data structure)

After using knapsack algorithm, we should store the transactions to be sorted by fee. But when we use Treemap data structure, if there is same transaction fee, it may cause a problem. How can we store whole information with Treemap with duplicate?

Thank you!

laboon commented 5 years ago

Yes, if you are using the same key, you will not be able to store a separate value. But what if you swap your key and your value? You could then maintain sorting by value without worrying about duplicates.

laboon commented 5 years ago

Let me know if this answers your question - if it does, feel free to close this issue.

koseoyoung commented 5 years ago

Yes I got it !! Thank you !!