NotImplemented
BAN USERThe above is the version for binary search tree.
 NotImplemented May 20, 2014With parent is trivial. Without parent the idea is also simple  traverse the tree looking for the value and storing the smallest value which is greater than required.
void next(node* root, int & x)
{
if (root>value > x)
x = min(x, root>value);
if (root>value > x)
find(root>left);
else
find(root>right);
}

NotImplemented
May 19, 2014 1. Use binary search tree with ability to calculate order statistic. Add: O(logN), Median: O(logN).
2. Use two priority queues. One queue for N/2 greater values and another for N/2 smaller values. Add: O(logN), Median: O(1)
What I actually have meant is to run breadth first search from all guards.
 NotImplemented May 07, 2014Total amount of visited edges is O(E), triangles is about O(V^3).
 NotImplemented March 27, 2014Why didn't somebody write the approach instead lines of code?
Iterate through text.size()pattern.size()+1 substrings maintaining amount of each character in sliding window pattern.size() size and amount of matched characters. Whenever matched characters equals alphabet size we have found required substring.
Finding maximum of a convex function. Hint: ternary search.
 NotImplemented March 14, 2014What about find shortest path from all guards? Just put them into one queue initially.
 NotImplemented March 10, 2014Hint: InclusionExclusion Principle
 NotImplemented September 15, 2013Open Chat in New Window
I might have been too tired when wrote that code down. Corrected version is below.
 NotImplemented May 20, 2014