-2

BFS

I want to know how time and memory is calculate i tried to use this O(b^d) but not give me the same values

mohamed abdallah
  • 134
  • 2
  • 10
  • The actual time required to run a specific algorithm with a specific input can never be calculated. In order to benchmark an algorithm, you have to implement and run it. –  May 25 '16 at 13:19
  • They are both proportional to b^d (*i.e.* the number of nodes) - see that neighboring values for time and memory differ roughly by a factor of 100 (same as the number of nodes). – danbanica May 25 '16 at 13:39

1 Answers1

1

The most important calculation is in the second column: the number of nodes in a complete tree. The formula for that is presented in the answer to "What is the total number of nodes in a full k-ary tree, in terms of the number of leaves?". Just replace k by 10, as your table talks about "branching factor b = 100":

N = (10d+1 - 1) / 9

For some reason the table you present, does not count the root node, because with the root node included, the count for a tree with depth 2 would be 111, not 110. But that is just a detail.

The time in seconds is calculated as the number of nodes (i.e. the value in column 2) divided by 100,000, as indicated in the footnote ("100,000 nodes/second"). It is quite trivial to translate a big number of seconds to minutes, hours, days, years, etc.

The footnote further mentions the assumption that the memory consumption is "1000 bytes/node", so it is a matter of multiplying the number of nodes (value in second column) by 1000. The table then actually uses the JEDEC memory standards for storage, where a kilobyte is not exactly 1000 bytes, but 1024 bytes. So you need to divide the number of nodes by that factor to get the number of kilobytes, then again for getting the number of megabytes, ...etc. See for instance "How to convert byte size into human readable format in java?".

Community
  • 1
  • 1
trincot
  • 317,000
  • 35
  • 244
  • 286