I have two lists where one list is filled with ID’s and the other list is filled with process names. Multiple process names can share an ID. I want to be able to create a data structure where I can use a specific ID and then return the list of processes associated with that ID. I also want to be able to use a specific process name and return the list of ID’s it’s connected with. I know I could create a dictionary for this but the list of ID’s will be very large and will continue to grow but the process names will be fairly short (fewer than 20 most likely) and will not grow as much. I’m not sure how efficient a dictionary will be in the long run. I want to be able to store the connections between the two lists locally on my computer so I can reload them into my program to add new connections for new ID’s.
| ID's | Process |
| -------- | -------- |
| ID 1 | Process 1|
| ID 2 | Process 2|
... ...
The two lists are something along those lines but the ID’s list is significantly larger.
I tried imagining this as a matching section on an exam where there are two columns and we have to connect the items in each column to the other. Multiple items can share the same connection. I implemented this with two dictionaries that established relationships between ‘column A’ and ‘column B’ (where A is the ID and B is the process name). The structure works well but I am not sure if it will be efficient for the rapidly growing column A and I’m not sure how to efficiently store the data on my PC. I am wondering to see if this structure could be improved on or if there is another one that would be much better.
Psonu is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
2