The Design of Software (CLOSED)

A public forum for discussing the design of software, from the user interface to the code architecture. Now closed.

The "Design of Software" discussion group has been merged with the main Joel on Software discussion group.

The archives will remain online indefinitely.

Name this data structure:

I'm using a data structure that I've never seen in the 'wild'.  I don't know what it's called so I can't google it.  I'm going to describe it and if anyone recognizes it please tell me what it's called:

The data structure is basically a X by Y grid (or matrix but I don't want to confuse it with linear algebra) with the ability to append other grids too it causing it to grow, so it's like a dynamic 2D grid as well:


A = aa
    aa

    bbbb
B = bbbb
    bbbb
    bbbb

            ..bbbb
A concat B = aabbbb
            aabbbb
            ..bbbb


Here's hoping the ascii formatting looks okay.....
Paul Send private email
Sunday, July 27, 2008
 
 
Nope, try this:

aa
aa

bbbb
bbbb
bbbb
bbbb


B concat A:

bbbb..
bbbbaa
bbbbaa
bbbb..
Paul Send private email
Sunday, July 27, 2008
 
 
No such structure exists beyond multidimensional arrays.

The problem is, what happens with your code when B is 5 rows high, and the a's dont fit perfectly center?

Monday, July 28, 2008
 
 
Eddy Vluggen Send private email
Monday, July 28, 2008
 
 
It also resembles a Sparse Array:

http://en.wikipedia.org/wiki/Sparse_array
Adam
Monday, July 28, 2008
 
 
I can't understand your formalism.  Could you give a specific example?

Monday, July 28, 2008
 
 
I also believe multidimensional arrays is the only way to classify this structure.

What other operations are available?
AdamBT
Monday, July 28, 2008
 
 
Sounds like a ragged array (one of the things that made Clipper a great language.)  It's an array where the numbers of elements in each row (or column) are not equal and any given element can be another array.

Might help if you tell us how you are using it.
JBrooks Send private email
Monday, July 28, 2008
 
 
Thanks for the input so far.

Alignment is arbitrary, I use integer division but scaling to fill the available are could also be done.

The allowed operations are: concatTop, concatBottom, concatLeft, concatRight.

One way to think of it is: the grids are bitmapped images and the operations are compositions of two images such that the resulting image has:

def concatTop(image1, image2):
        newimage.width = max(image1.width, image2.width)
        newimage.height = image1.height + image2.height
Paul Send private email
Monday, July 28, 2008
 
 

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics
 
Powered by FogBugz