Company logo
  • Jobs
  • Bootcamp
  • About Us
  • For professionals
    • Home
    • Jobs
    • Courses
    • Questions
    • Teachers
    • Bootcamp
  • For business
    • Home
    • Our process
    • Plans
    • Assessments
    • Payroll
    • Blog
    • Sales
    • Calculator

0

69
Views
best data structure for table

I'm trying to find the best data structure for visualize this UI: enter image description here

I'm using javascript/typescript with Angular and I should be able to add/remove/update items. Please consider also that I will have lot of rows and columns and up to 100 non-repeated items in each cell. So far I'm considering this data structure:

var data = new Map<string, Map<string, Set<Item>>>();

where the strings are rowKeyN and columnKeyN and Set contains the items in each cell.

This kind of datastructure seems a bit complicated to use but is the best that I found in terms of performance. What do you think? Thank you in advance.

8 months ago · Santiago Trujillo
1 answers
Answer question

0

Bumped into this question - you should look at Guava's (for Java) Table representation - where the last case you would get a List

see more details here for Guava's table

but in short: taken from the docs:

Table<Vertex, Vertex, Double> weightedGraph = HashBasedTable.create();
weightedGraph.put(v1, v2, 4);
weightedGraph.put(v1, v3, 20);
weightedGraph.put(v2, v3, 5);

weightedGraph.row(v1); // returns a Map mapping v2 to 4, v3 to 20
weightedGraph.column(v3); // returns a Map mapping v1 to 20, v2 to 5

In your case it would be Table<Vertex,Vertex,Array>

I came here while trying to search something like the above for Typescript - I haven't found it - yet - if anyone knows of such an implementation - let me know

8 months ago · Santiago Trujillo Report
Answer question
Find remote jobs