Welcome

首页 / 软件开发 / 数据结构与算法 / 算法题:区间数据计算

算法题:区间数据计算2013-11-14 jasenkin 最近一年多来,一直比较忙,最近一段时间终于空闲了,把以前没写的都补上.....

这边随笔主要是计算一系列数据的间隔数据。从一堆数据中查询出每个区间的起始数据,结束数据以及数据个数,同时可以设置相应精度(小数位数)。

区间数据数据结构

1、区间数据主要包括当前区间的起始数据,结束数据以及数据个数。结构如下:

public struct IntervalData<TKey, TValue>{private TKey _startValue;private TKey _endValue;private TValue _count; public IntervalData(TKey startValue, TKey endValue, TValue count){this._startValue = startValue;this._endValue = endValue;this._count = count;} public TKey StartValue{get { return this._startValue; }set { this._startValue = value; }} public TKey EndValue{get { return this._endValue; }set { this._endValue = value; }} public TValue Count{get { return this._count; }set { this._count = value; }}}