The Percentile actually uses KthSelector logic and is dependent on only
KthSelector
however the variability part is pivoting strategy.

Given that both KthSelector and Pivoting are independent we could make them
as utility classes or may be functions with in MathUtils with exposed
interfaces.

Heres my opinion:

First, Move Both PivotingStrategy and KthSelector to utils package as they
can be general purposed

Secondly, make PivotingStrategy  enum implement an interface
PivotingStrategyInterface which allows
random generator to be set and with other necessary  methods. This is to
make way for some one who is interested to make a different seed for random
or for a different pivoting strategy itself.

Next, make the KthSelector accept a PivotingStrategyInterface rather than
enum

Next, make Percentile accept a constructed KthSelector and allow it flow
through evaluate and estimate method instead of flowing PivotingStrategy
through estimate method.

What do you think

thanks
venkat.

Reply via email to