Amazon Interview QuestionSDE1s
Interview Type: In-Person
1. Initialize a hash table for with tag as key and ArrayList of elements as value.
2. loop through the array int a; if the tag doesn't exist add the tag and add a[i] to its ArrayList; if the tag already exists in the hash table, add a[i] to the ArrayList.
3. After the loop is done, now loop through the Hash Table and print all the tags and its ArrayList contents in the order.
I assume by infinitely large you mean an array that does not fit in memory otherwise your program will never terminate obviously. If that's the case this sounds like a simple problem- adr June 10, 2018
* Create k files (k - number of tags)
* Read the input array by blocks that fit in memory
* If an element in the block has tag i add it to i-th file
* When you are done processing the array, just traverse your files in order