最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

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

SEO心得admin53浏览0评论
本文介绍了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.

发布评论

评论列表(0)

  1. 暂无评论