DD2480-2022-group-7 / Java

All Algorithms implemented in Java
MIT License
0 stars 0 forks source link

Method BSTIterative::remove #8

Open samuelsoder opened 2 years ago

samuelsoder commented 2 years ago

The implementation of Binary Search Tree (iterative) remove method in src/main/java/com/thealgorithms/datastructures/trees/BSTIterative.java has reported cyclomatic complexity 13 by lizard.

Part 1 steps:

Part 2 steps:

chubretovic commented 2 years ago

If = 9 || = 0 && = 1 While = 2 For = 0 Return = 0

M = 12 - 0 + 2 = 14

charmed-quark commented 2 years ago

I've counted all if, else if, and else, as well as && and while, in total 17. For exit points I considered all the possible places where the function would stop running (no returns because it is void). These points are line 137 (if the if statement evaluates to false), line 174, line 177, and line 179, in total 4.

This gives 17 - 4 + 2 = 15.

I also tried not counting else which gives a result of 10. Neither agrees with lizard's calculation.