I have been reading about interval trees on wikipedia. Does anyone know how to implement the delete
method in Java
? The link to the delete algorithm is http://en.wikipedia.org/wiki/Interval_tree#Deletion
问问题
2663 次
1 回答
0
我想使用居中间隔树方法(这是您使用的链接指向的位置)删除的伪代码看起来像:
deleteInterval(Node n, Interval i)
{
n.intervalsDesc.remove(i)
n.intervalsAsc.remove(i)
if (i.end < n.value && n.leftChild != null) deleteInterval(n.leftChild, i)
if (i.begin > n.value && n.rightChild != null) deleteInterval(n.rightChild, i)
}
于 2012-11-27T12:59:21.267 回答