3

I have implemented several splay tree algorithms.

What's the best way to compare them?

Is it a good start to compare execution time when adding random nodes?

I've also implemented an Binary Search Tree that keeps track of how much every node is visited. I wrote an optimize() method that creates an Optimal Binary Search Tree.
If we do not plan on modifying a search tree, and we know exactly how often each item will be accessed, we can construct an optimal binary search tree, which is a search tree where the average cost of looking up an item (the expected search cost) is minimized.
How can I involve this in the comparison of splay trees?

Bernhard Barker
  • 54,589
  • 14
  • 104
  • 138

1 Answers1

2

I like the empirical approach.

In this approach:

  1. Create a bunch of random typical data sets, of various lengths.
  2. Run each implementation and find out what is the execution time for each.
  3. Use Hypothesis testing methods to find out if one implementation is better then the other. In here, the null hypothesis (H0) is "The two implementations should take the same time to execute, on average.
  4. Conclude from step 3 that one implementation is better then the other, with probability 1-p (where p is your p_value).

PS Wilcoxon test is considered a good one, and is used a lot in literature and research to compare two algorithms.

amit
  • 175,853
  • 27
  • 231
  • 333