Dictionary Data Structure

A dictionary data structure is one which is capable of storing objects in sorted order based on key such as a string or an integer. For instance, you might have several hundred City objects which consist of the name of the city, the latitude and longitude at which it is located, and the radius or expanse of the city limits. One way of storing these cities is to sort them by name; another is to store them in decreasing order by population; yet another is in increasing order by latitude.

To manage a structure based on the names of cities, you would not need a comparator for cities; but, rather, since the keys are city names (strings), your comparator would need to handle strings. So to compare cities by name in Java 1.5, your comparator might look like this:

    public class CityNameComparator implements Comparator<String>
{
            public int compare (String s1, String s2) {
                        
                     (however you want to do string comparison) 
                        return 

            }

}

Specifically in this project we'll use a dictionary to hold and sort cities and attractions by name and a spatial data structure to hold and sort by coordinate. The data dictionary will be required in all project parts.

New for part 2 will be the requirement that you implement the SortedMap interface using an AVL-G tree which could be used as the basis of your data dictionary in parts 2 and 3. However, if we demanded that you use that structure and it didn't work, we'd be unable to grade any of your project if the AVL-G was broken. So, keep using the Treemap/Treeset from part1 as well.

MM Hugue 2018-10-01