3 ms·
You can do it without hash tables. If you're able to create a graph structure with references/access/pointer types or whatever COBOL uses you can have records
by Jtsummers 6y ago
You can do it without hash tables.
If you're able to create a graph structure with references/access/pointer types or whatever COBOL uses you can have records with contents similar to:
record Bag:
string : Description
array of Bag Pointer : Children
array of Integer : Count
Where the indexes into the two arrays correlate. Since, as you parse, you don't know where the children may be, you can use an array to store the bags as you read them in. And in a second pass construct the graph proper. You may also want a set of pointers up to the bags containing a bag, but it's not, strictly, needed.
If I were doing this year's in C, I'd have done something like that since it, also, doesn't have a built-in hash table/dictionary.
- galoisgirl 6y agoThanks! I'll give that a try over the week-end.