By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,826 Members | 2,384 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,826 IT Pros & Developers. It's quick & easy.

best Data Structure to store 'grid' ?

P: 1
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 to avoid using arrays.

Specifically i am trying to implement an "Availability Calendar", where i want to show RoomTypes as row headers (variable number), and Weekdays as column headers (fixed, limited to 2 weeks at a time); and the intersection being all information about the particular cell (e.g. booked, available, guest names, etc).

..............1/Mon....2/Tue....3/Wed....14/Sun
+--------+--------+---------+---------+---------+
Type1
+--------+--------+---------+---------+---------+
Type2
+--------+--------+---------+---------+---------+
etc...
+--------+--------+---------+---------+---------+

Thanks in advance.
Mar 2 '09 #1
Share this Question
Share on Google+
3 Replies


Plater
Expert 5K+
P: 7,872
How about a DataTable?
Mar 2 '09 #2

tlhintoq
Expert 2.5K+
P: 3,525
Or creative use of a dictionary.
Key is the room number since that is unique.
Definition is a custom object with the room details.
Mar 3 '09 #3

10K+
P: 13,264
Always think classes when doing object oriented programming.
Mar 3 '09 #4

Post your reply

Sign in to post your reply or Sign up for a free account.