0
$\begingroup$

Apologies if a duplicate. New to this community and did try to search.

I want to create a mapping document that equates defect severity levels together so it looks like

|| System 1 || System 2 || System 3 ||    
| level1-1 | level1-2 | level1-3 |   
| level2-1 | level2-2 | level2-3 |

So that I can effectively do a lookup with a key of "level2-2" and get the row back. Similar I guess to a SQL row and being able to match on a column

Is there a name for this data structure?

$\endgroup$
  • $\begingroup$ I don't really understand what this data structure is supposed to do, and I don't understand the relationship between the document you're trying to produce and any data structure. Could you clarify exactly what data you're trying to store. And, since you say that its similar to a database table, what's stopping you just using a database? $\endgroup$ – David Richerby Dec 5 '16 at 12:36
  • $\begingroup$ It's a mapping so it each row is essentially an object with 3 attributes. I would like to be able to find the row or instance by using any of the 3 attributes as key. So for a customer or similar. I can look up by email or name or similar but having the customer details in one structure rather than separately indexed hashtables for each column. Nothing stopping me from using a database I was interested if there was a common pattern or name for this is all? $\endgroup$ – PatrickWalker Dec 5 '16 at 13:38
  • $\begingroup$ OK, it's a database, pure and simple. $\endgroup$ – David Richerby Dec 5 '16 at 14:05
  • $\begingroup$ A single-table relational database is conceptually a collection of records/tuples, plus one or more indexes if faster access is needed. A surprisingly large number of data structures essentially boil down to that arrangement. $\endgroup$ – Pseudonym Dec 6 '16 at 1:38
1
$\begingroup$

There are many data structures you could use for this purpose.

One possibility is a relational database (just like you've shown).

Another possibility is any data structure for storing equivalence relations; for instance, the standard Union-Find data structure would do. Here you'd be storing that (System 1, level1-1) is equivalent to (System 2, level1-2), and so on. That would work, too.


[ General advice for asking in the future: Don't worry too much about "names" for something. Names matter a lot less than finding a reasonable solution. Instead, think of the task you're trying to accomplish, what your requirements are, what you're trying to optimize, and then ask how to do that. You might get back an answer that says "read up on this standard thing"; or you might get back an answer that just directly describes a solution to your problem. Either way, you win! ]

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.