473,396 Members | 2,068 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Calendar Queue data structure

I have been working on a C# calendar queue data structure as defined in the
paper:

http://www.leekillough.com/heaps/pap...dar_queues.pdf

I am hoping someone can recommend how they would approach the following,
which is simplified for illustration:

public class CalendarQueue

{

private SortedLinkList[] buckets

public void Enqueue(Object obj);

public Object DequeueMin()

private void Resize(int newSize)

}

Basically, when you enqueue objects into the CalendarQueue, the object will
be placed into one bucket within the buckets. Each bucket is a
SortedLinkList. The end result is that each bucket will have a different
amount of objects. The buckets are sorted and the objects within each
bucket is sorted.

The CalendarQueue is smart enough to keep track of the cost of enqueueing
and dequeueing. When enqueueing and dequeueing get too costly, the
CalendarQueue will Resize itself.

Resizing code is where my question is. Resizing potentially could double
the number of buckets. When more buckets are added, the objects in the
previous buckets will need to be placed into the new set of buckets. What
is the most optimal way of doing this in C#?

The pdf file was created with C code. It recommends having a very big array
where the buckets will swap back and forth from top of the array to the
bottom. For example, lets say the big array has 1000 capacity and the
current buckets is 100. Buckets will occupy 0-100 of the big array and then
when resized to 200, buckets will occupy 800-1000. The object will have to
move from the 0-100 buckets to the 800-1000 bucket. Most likely, each new
bucket will contain about half as many objects in the new set.

How would you approach this issue of moving objects in one SortedLinkList
into another SortedLinkList as fast as possible?

This has been a fun exercise and cant wait to hear what you guys think.

Sincerely,

Dan
Nov 15 '05 #1
0 1722

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: dmb000006 | last post by:
Hello, I have a database style data structure, each record has several fields. I would like to create a nested data structure that would let me 'query' the data on the value of certain...
2
by: yee young han | last post by:
I need a fast data structure and algorithm like below condition. (1) this data structure contain only 10,000 data entry. (2) data structure's one entry is like below typedef struct _DataEntry_...
2
by: Zhaozhi Gao | last post by:
I'm doing a simple project for school. This is the first time I've ever used Access. Is there a way i can simulate a Circular Queue data structure for the datas in a table. I tried assign index...
0
by: Julia Jin | last post by:
Hi, there, In my program, I use some data structure a lot, such as list, queue, prior queue, tree, etc. Right now, I chose some programs from "Mastering Algorithms With C " by Kyle Loudon. But I...
6
by: herrcho | last post by:
#include <stdio.h> #define MAX 10 int queue; int front, rear; void init_queue() { front=rear=0; }
2
by: Bob Jenkins | last post by:
I have this cute data structure that I just found a second opportunity to use. I googled for references to it, but came up empty. I probably just don't know its name. The algorithm on this...
4
by: semooo | last post by:
hi Im waseem I need an immediate help as soon as possible, I have three simple question with coding problems in data structure in c++ thess are : 1)suppose that you are finanicier and purchase...
4
by: sakcee | last post by:
Hi I hope that I can learn from your experience . I want to know if you have seen a perticular problem and used a perticular data structure , and why? I usually end up using just arrays,...
3
by: dev101 | last post by:
hi fellow coders, what is the best data structure to store a grid / matrix, with 2 Keys (row, col), and the Values (cell entries) can be any object? Similar to a 2-dimensional array, but i am trying...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.