Ask Me Help Desk

Ask Me Help Desk (https://www.askmehelpdesk.com/forum.php)
-   Java (https://www.askmehelpdesk.com/forumdisplay.php?f=440)
-   -   Maps problem (https://www.askmehelpdesk.com/showthread.php?t=734245)

  • Feb 14, 2013, 08:12 PM
    firebolt93
    Maps problem
    Complete the following method:
    ● public static Map<String,ArrayList<String>> loadEditMap(String filename). This method reads a collection of words, all of the same length, and returns an
    “edit map” for the words. In the map, each word (key) is associated with an ArrayList (value) containing all the other words that different from it by exactly one character (an edit distance of one). Each word in the file will therefore appear in the map once as a key and possibly in the ArrayLists associated with several other words. For example, the small set of words “bank”, “roof”, “sand”, “sank” and “tank” would produce the map:
    “bank” → [“sank”, “tank”]
    “roof” → []
    “sand” → [“sank”]
    “sank” → [“bank”, “sand”, “tank”]
    “tank” → [“bank”, “sank”]

  • All times are GMT -7. The time now is 02:55 PM.