Due 9am, Monday, 06 November 2017
In this prelab, you will familiarize yourself with some of the design and implementation issues in the upcoming lab 7. Please write or type up your solutions, and hand in a paper copy before class on Monday. Remember, late prelabs receive zero credit.
In the previous lab, you created a WebPageIndex class that represents the data from a single document (either local file or URL). In this lab, you will be creating a collection of those indexes and then determining which page best matches what a user is searching for.
You will be using an ArrayList as an efficient implementation of a complete binary tree. One of the activities you will need to be able to do is to move up and down the tree.
In order to make these heaps work, you will need to create Comparators of various sorts. Begin by looking over the documentation for java.util.Comparator<T>. Pay special attention to the compare() method you are required to implement.
Inside our binary heap, there are a few private methods we will need to implement. We discussed both of these in class, but you will need to implement them yourself.
In the application portion of this lab, you will be reading in and creating a number of WebPageIndex objects (from Lab 6), storing them in your heap, and then processing user search queries on those objects.
Explain how you compute the "score" of a particular web page given a String that represents a user query of one or more words under the following conditions (pseudocode or just a concise description is fine):
We'll be using these comparators in our PriorityQueue which will be based on a binary heap. Recall that in class we discussed that these are "min-heaps" -- heaps where the minimum value is at the root.
Our WebPageIndex objects allow us to also search for phrases in our web pages.