coolraj334
BAN USERIf the computer has enough primary memory, simply three hashmaps of type :
(telephone#, String[])
(first name, String[])
(last name, String[])
If not enough primary memory, create a folder which contains files by numbers example
1,2,3,4 ......
and create three hashmaps as above by replacing string[] with the respective numbers.
Is it asked to create a "computer move" ? I think this may waste precious interview time.
- coolraj334 December 03, 2014would we ever get this much time in an interview ?
- coolraj334 December 03, 2014Do we really need to create separate classes for different items ? Can't a String field in item class do ?
- coolraj334 December 03, 2014I think we can use a simple linked list to traverse the URLs appending it in end whenever we find new nodes. There is no requirement for order of parsing the URLs, so a graph search may be unnecessary.
As for bottlenecks,
1) Method used for parsing :
Using simple regex to figure out <a> tags in the page may be more efficient than a external library for parsing HTML.
2) Using multi-threading: given the large number of URLs, this may be efficient. If we use n threads, for example, the time taken is (T/n) . [where T is the time taken if we use a single thread.]
3) Outsourcing and Distributed Computing: If Bandwidth/processing power of our server is low, we may want to outsource the URLs to a remote machine with a superior resources.
4) Language Used for implementation : Because of difference in goals of design, different languages have different execution times for different tasks. A more "network-oriented" language may be more suitable.
The question explicitly says "write code". grep is an external tool.
- coolraj334 June 23, 2015