Skip to content

Instantly share code, notes, and snippets.

@utkarshl
Last active December 10, 2015 06:28
Show Gist options
  • Save utkarshl/4394245 to your computer and use it in GitHub Desktop.
Save utkarshl/4394245 to your computer and use it in GitHub Desktop.
void splitdown(int postn)
{
if(postn>1) splitdown(postn>>1);
tree[postn].split(tree[2*postn],tree[2*postn+1]);
}
void update(int postn, node nd)
{
postn += 1<<n;
splitdown(postn>>1);
tree[postn] = nd;
mergeup(postn);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment