Maybe you found a counterexample.
Nick Evan commented: Sounds like a plan! +24
Maybe you found a counterexample.
Ask your question in the C forum.
But Pi isn't an ordered set...
You can write your algorithm however you want. You get to decide whether it's an ordered set or not.
It's possible and basically straightforward.
Note that you can find the median of an ordered indexable set of k elements in O(log k) time and of course you can do insertions and removals in O(log k) time. And each Pi could be such a set.
Your English is pretty good.
If someone has better idea's to make the posts in the CS-forum more useful, please do reply :)
We should probably just redirect all the people starting threads in that forum to an English tutor.