开发者

Is an iteration on a F# map or set in-order traversal?

开发者 https://www.devze.com 2023-01-02 03:12 出处:网络
AFAIK, F# Map and set are implemented as red-black trees, so I guess that an iteration on these would be in-order traversal. I di开发者_如何学编程d some test and the iteration results are always sorte

AFAIK, F# Map and set are implemented as red-black trees, so I guess that an iteration on these would be in-order traversal. I di开发者_如何学编程d some test and the iteration results are always sorted. But I want to make it sure.

Is it in-order traversal?


The documentation on MSDN is pretty good for figuring this out. For instance, the return value for Set.toSeq is "An ordered sequence of the elements of set." It looks like the answer to your question is yes, for both maps and sets.


AFAIK, F# Map and set are implemented as red-black trees

AVL trees.

Is it in-order traversal?

Yes.

0

精彩评论

暂无评论...
验证码 换一张
取 消