473,413 Members | 1,731 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,413 software developers and data experts.

Question on data structures

JL
Hi,

I was asked the following question at work:

"Assume that you have 5000 columns and 5000 rows of data. You take these
data from the database and need to show them in a table. Before showing
these data in a table, you need to store it in a code data sturcture. Rows
and columns will be added and deleted, so the data structure needs to be
efficient. Spatial locality needs to be considered, and memory needs to be
freed when data is deleted. Which data structure (in C# or VB) will you use?"

The answer is none of the following:
- 2D array
- Double linked-lists
- 2D vector

Does anyone know the answer to this? Thanks!
Dec 16 '05 #1
5 2436
JL,

I may assume that this is not for a database, because these figurs are than
absolute in the categorie "It is only a fool who is doing this".

In a normal "data" structure it would be for me a collection inside a
collection.

(The type of the collection is than dependend how the use is and irellevant
to answer now)

Still is this are only 25.000.000 items.

However if it is for graphical representation items, than there are other
things that probably make the decission, and that is certainly not my area.

Just my opinion,

Cor
Dec 16 '05 #2
Try to Google for "Sparse Array"...

You may want also to explain us the whole picture as you seem to be in an
unusual case (5000 columns x 5000 lines is hardly usable IMO). Is this real
data or perhaps just graphics data of some kind ?

--
Patrice

"JL" <JL@discussions.microsoft.com> a écrit dans le message de
news:69**********************************@microsof t.com...
Hi,

I was asked the following question at work:

"Assume that you have 5000 columns and 5000 rows of data. You take these
data from the database and need to show them in a table. Before showing
these data in a table, you need to store it in a code data sturcture. Rows and columns will be added and deleted, so the data structure needs to be
efficient. Spatial locality needs to be considered, and memory needs to be freed when data is deleted. Which data structure (in C# or VB) will you use?"
The answer is none of the following:
- 2D array
- Double linked-lists
- 2D vector

Does anyone know the answer to this? Thanks!

Dec 16 '05 #3
JL
Patrice,

Thanks for the reply. I do not have information on why there are 5000 col x
5000 rows as it was just the scenario given. I was asked the same question
in an interview - I guess the interviewer wanted to test my knowledge on
..NET collection classes. I gave all those 3 answers (2D array, Double
linked-lists & 2D vector) but they weren't what the interviewer was looking
for.

"Patrice" wrote:
Try to Google for "Sparse Array"...

You may want also to explain us the whole picture as you seem to be in an
unusual case (5000 columns x 5000 lines is hardly usable IMO). Is this real
data or perhaps just graphics data of some kind ?

--
Patrice

"JL" <JL@discussions.microsoft.com> a écrit dans le message de
news:69**********************************@microsof t.com...
Hi,

I was asked the following question at work:

"Assume that you have 5000 columns and 5000 rows of data. You take these
data from the database and need to show them in a table. Before showing
these data in a table, you need to store it in a code data sturcture.

Rows
and columns will be added and deleted, so the data structure needs to be
efficient. Spatial locality needs to be considered, and memory needs to

be
freed when data is deleted. Which data structure (in C# or VB) will you

use?"

The answer is none of the following:
- 2D array
- Double linked-lists
- 2D vector

Does anyone know the answer to this? Thanks!


Dec 16 '05 #4

JL wrote:
Patrice,

Thanks for the reply. I do not have information on why there are 5000 col x
5000 rows as it was just the scenario given. I was asked the same question
in an interview - I guess the interviewer wanted to test my knowledge on
.NET collection classes. I gave all those 3 answers (2D array, Double
linked-lists & 2D vector) but they weren't what the interviewer was looking
for.


I suspect the interviewer was thinking about an array list of array
lists. But, I don't think that would be the most efficient data
structure for either speed or size.

Brian

Dec 16 '05 #5
Brian,
I suspect the interviewer was thinking about an array list of array
lists. But, I don't think that would be the most efficient data
structure for either speed or size.


That is exactly why I wrote collection of collections. However I got no
reply on that one.

An arraylist is one of the collections (implementing IList and ICollection)

:-)

Cor

Dec 16 '05 #6

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

Similar topics

1
by: kazack | last post by:
Hi all it's me again with another question as I got further in my book. The chapter I am in covers structres, abstract data and classes. I only read through to the end of the coverage on...
5
by: achrist | last post by:
Here's a program: #include <stdio.h> int main(int argc, char **argv) { double an_array = {0.0, 1.0, 2.0, 3.0, 4.0}; typedef struct a_struct {double v0, v1, v2,v3, v4;} a_type; typedef...
11
by: theshowmecanuck | last post by:
As a matter of academic interest only, is there a way to programmatically list the 'c' data types? I am not looking for detail, just if it is possible, and what function could be used to...
5
by: Shwetabh | last post by:
Hi everyone. My question is, why are data structures implemented only with struct data type? Why not union when it is more efficient as compared with structures? Thanks in advance
4
by: emma middlebrook | last post by:
Hi Straight to the point - I don't understand why System.Array derives from IList (given the methods/properties actually on IList). When designing an interface you specify a contract. Deriving...
10
by: jack | last post by:
Hi guys, I am working on a project which requires an implementation of discrete event simulation in C using linked lists. I would greatly appreciate if someone could provide with some sources...
0
by: Art Cummings | last post by:
Good morning all. I just finished an assignment using structures. In this assignment I used an array of structures. What I would have liked was to use an array of structures with a function. ...
17
by: Suresh Pillai | last post by:
I am performing simulations on networks (graphs). I have a question on speed of execution (assuming very ample memory for now). I simplify the details of my simulation below, as the question I...
20
by: xiao | last post by:
Hi~ every one~ I have a queston about fread function. if i have a code like this: (nscrdh and data are defined as two dementional arrays and both of them were stored in the same binary file) ...
14
AmberJain
by: AmberJain | last post by:
Hello, I am presently studying Data structures in C. And so I have a simple question about stack. The book which I got my hands on says about stack: For me this quote (from the book) is a bit...
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.