Open code423n4 opened 2 years ago
(1)https://github.com/ampleforth/market-oracle/blob/5e7fd1506784f074748ab6bd5df740ca2227b14f/contracts/MedianOracle.sol#L200 (2) https://cs.stackexchange.com/questions/1914/find-median-of-unsorted-array-in-on-time
Search of the median is done in O(n^2) while this can be reduce to O(n), this is a high optimisation as price computation is called for each oracle update.
(1)https://github.com/ampleforth/market-oracle/blob/5e7fd1506784f074748ab6bd5df740ca2227b14f/contracts/MedianOracle.sol#L200 (2) https://cs.stackexchange.com/questions/1914/find-median-of-unsorted-array-in-on-time
Search of the median is done in O(n^2) while this can be reduce to O(n), this is a high optimisation as price computation is called for each oracle update.