Answered You can hire a professional tutor to get the answer.

QUESTION

Please fill in where it asks in java // Your class. Notice how it has no generics.

Please fill in where it asks in java

// Your class. Notice how it has no generics.

// This is because we use generics when we have no idea what kind of data we are getting

// Here we know we are getting two pieces of data: a string and a line number

public class IndexTree {

  // This is your root 

  // again, your root does not use generics because you know your nodes

  // hold strings, an int, and a list of integers

  private indexNode root;

  // Make your constructor

  // It doesn't need to do anything

  // complete the methods below

  // this is your wrapper method

  // it takes in two pieces of data rather than one

  // call your recursive add method

  public void add(String word, int lineNumber) {

  }

  // your recursive method for add

  // Think about how this is slightly different the the regular add method

  // When you add the word to the index, if it already exists, 

  // you want to add it to the IndexNode that already exists

  // otherwise make a new indexNode

  private indexNode add(indexNode root, String word, int lineNumber) {

    return null;

  }

  // returns true if the word is in the index

  public boolean contains(String word) {

    return false;

  }

  // call your recursive method

  // use book as guide

  public void delete(String word) {

  }

  // your recursive case

  // remove the word and all the entries for the word

  // This should be no different than the regular technique.

  private indexNode delete(indexNode root, String word) {

    return null;

  }

  // prints all the words in the index in inorder order

  // To successfully print it out

  // this should print out each word followed by the number of occurrences and the list of all occurrences

  // each word and its data gets its own line

  public void printIndex() {

  }

  public static void main(String[] args) {

    IndexTree index = new IndexTree();

    // add all the words to the tree

    // print out the index

    // test removing a word from the index

  }

}

public class ReadingFromFileExample {

  public static void main(String[] args) {

    String fileName = "pg100.txt";

    try {

      Scanner scanner = new Scanner(new File(fileName));

      while (scanner.hasNextLine()) {

        String line = scanner.nextLine();

        System.out.println(line);

        //String[] words = line.split("\s+");

        //for(String word : words){

        //

Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question