public SortedBucket Split(int maxSpacesPerBucket) { SortedBucket sortedBucket = new SortedBucket(maxSpacesPerBucket); int num = this.Count / 2; for (int i = 0; i < num; i++) { sortedBucket.Insert(this.ExtractMax()); } sortedBucket.Limit = sortedBucket.Minimum; return(sortedBucket); }
public static void Main(string[] args) { var buckeList = new SortedBucket <int, string>(2, SortMode.Asc); buckeList.Add(5, "five"); buckeList.Add(4, "4"); buckeList.Add(789, "5"); buckeList.Add(3, "8"); var page = 1; while (buckeList != null) { Console.WriteLine("Page: " + page++); foreach (var item in buckeList) { Console.WriteLine(item.Key + " " + item.Value); } buckeList = buckeList.Next; } }