C#中的快速订单统计树还是SortedList提供相同功能的DS更高效?

编程入门 行业动态 更新时间:2024-10-27 02:18:33
本文介绍了C#中的快速订单统计树还是SortedList提供相同功能的DS更高效?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 我需要我的C#代码中的快速订单统计树。我知道唯一的数据结构有 IndexOf ()方法,并保持排序的项目是 SortedList 。不幸的是,它的插入复杂度是O(n)不同于 SortedDictionary ,它是O(Lg n),但SortedDictionary没有IndexOf()。

我需要的方法只是添加()和 IndexOf ()

谢谢

解决方案

我使用了一个很好的红黑树实现,并实现了我自己的订单统计树。它是一个通用DS。 由于它没有框架DS的所有通用属性,它的工作速度比我的特定问题快5倍。

I need a Fast Order Statistic Tree in my C# code. The only data structure I know that has IndexOf() method and keeps items sorted is SortedList. Unfortunately, its insertion complexity is O(n) unlike SortedDictionary that is O(Lg n) but SortedDictionary does not have IndexOf().

The methods I need are just Add() and IndexOf()

Thanks

解决方案

I have used a nice implementation of Red-black tree and implemented my own Order Statistic Tree. It is a generic DS. As it does not have all general purpose properties of framework DSs it works 5 times faster for my specific problem.

更多推荐

C#中的快速订单统计树还是SortedList提供相同功能的DS更高效?

本文发布于:2023-11-30 06:34:24,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1649034.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:高效   订单   快速   功能   SortedList

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!