为区间,分段,分域树一样吗? [英] Are interval, segment, fenwick trees the same?

查看:179
本文介绍了为区间,分段,分域树一样吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

今天,我听到一个关于分域树讲座(二进制索引树)和老师说的比这棵树间隔和段树的推广,但是我这三年的数据结构的实现是不同的。 这是afirmation真的吗?为什么?

Today i listened a lecture about fenwick trees (binary indexed trees) and the teacher says than this tree is a generalization of interval and segment trees, but my implementations of this three data structures are different. Is this afirmation true? and Why?

推荐答案

我从来没有听说过的二进制索引树叫什么推广。这当然不是区间树和的段树的。我建议你​​遵循的链接说服自己动手。

I have never heard binary indexed trees called a generalization of anything. It's certainly not a generalization of interval trees and segment trees. I suggest you follow the links to convince yourself of this.

不是这棵树的间隔和段树的泛化

than this tree is a generalization of interval and segment trees

如果用这棵树你的老师的意思是二进制索引树,那么他错了。

If by "this tree" your teacher meant "the binary indexed tree", then he is wrong.

但我这三年的数据结构的实现是不同的。

but my implementations of this three data structures are different

当然,他们是不同的,你的老师从来没有说过,他们不应该。他只是说一个是另一个的推广(这是不正确的,但仍然)。无论哪种方式,实现应该是不同的。

Of course they are different, your teacher never said they shouldn't be. He just said one is a generalization of the other (which isn't true, but still). Either way, the implementations are supposed to be different.

你会拥有相同的实现是一个二进制索引树和树状数组,因为同样的事情

What would have the same implementation is a binary indexed tree and a fenwick tree, because those are the same thing.

这篇关于为区间,分段,分域树一样吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆