13.07.2015 Views

computing the quartet distance between general trees

computing the quartet distance between general trees

computing the quartet distance between general trees

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

7.2. IMPLEMENTATION 57ble sort, will, in spite of a quadratic worst-case running time, perform in linear time oninput that is nearly sorted, indeed giving a wrong impression of <strong>the</strong> algorithm. My implementationmakes a depth-first numbering of <strong>the</strong> leaves in T and <strong>the</strong>n numbers <strong>the</strong>leaves in T ′ according to this. This numbering determines in which order we processdifferent parts of <strong>the</strong> tree. If we shuffle <strong>the</strong> leaves in both <strong>trees</strong> and redo <strong>the</strong> experiment<strong>the</strong> topologies of <strong>the</strong> <strong>trees</strong> remain <strong>the</strong> same, but <strong>the</strong> algorithm will process each tree in adifferent order.Repeating <strong>the</strong> experiment 25 times with different permutations of <strong>the</strong> leaves result in<strong>the</strong> plot displayed in Fig. 7.13. The difference in performance is difficult to observe andit is evident that <strong>the</strong> order of <strong>the</strong> leaves is not a decisive factor; <strong>the</strong> running time is onlydependent on <strong>the</strong> structure of <strong>the</strong> tree. These results will hopefully heighten <strong>the</strong> level ofconfidence.time in seconds - t(n)10001001010.1Performance of <strong>the</strong> C++ implementation if leaves are shuffled before execution.bin, best exp= 2.06ran, best exp= 2.07sqrt, best exp= 1.79star, best exp= 2.04wc, best exp= 2.02nn 2n 30.0150 100 200 500 800number of leaves - nFigure 7.13: Shuffling <strong>the</strong> leaves does not yield a different running time.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!