Word tree data structure problem

Assignment Help JAVA Programming
Reference no: EM131715706

Introduction to Computer Science Assignment

Word Tree Data Structure

Here we define a special kind of rooted tree that we use to efficiently index words by storing their prefixes. The main property of this tree is that each edge corresponds to a character. Thus the path from the root of the tree to any node in the tree defines a string.  The string defined by each node is a prefix of all strings defined by the descendents of that node.

Below is an example tree. It contains the following words: a, and, ax, dog, door, dot.  You will note that the dashed nodes correspond to prefixes in the tree (an, d, do, doo) that are not in our list of words. The tree must also keep track of this distinction by storing for each node whether it corresponds to a word or not.

Note that if C is the set of all possible characters defined at the edges, then each node can have at most  k = | C | children,  where the | C |  notation just means the number of elements in set C.

2386_figure.png

What You Need To Do -

Read the provided code (WordTree.java, A3TesterPosted.java), including the comments which explain what the various methods do.     This will take you some time, so go slow and read the code carefully. Note that the WordTree class has a private inner class TreeNode.

For the WordTree class, fill in the missing code for the following methods:

  • createChild(), toString() for the inner class TreeNode
  • getPrefixNode(), insert(), contains(), getListPrefixMatches()

We suggest you implement them in the order listed above. To get started, you may wish to add a main() method to the WordTree class. Eventually you should move on to using the Tester file. Don't forget to delete the main method when you submit!

You may only use Java String methods length() and charAt(). In particular, do not use String searching methods such as String.startsWith(), String.substring(), etc. The point of the assignment is for you to organize and compare strings using this tree data structure.

Only add code in the area where it says to add code. The grader may be sensitive to any changes that you make outside that area.   Any helper methods that you wish to write should be added at the end of the WordTree.java file.

Note that all methods and also the inner class have been given the public access modifier. This was done to simplify grading.   As you will learn later in the course, typically one does not make all methods public.

Submit only the file WordTree.java as a zip file. Use the A3TesterPosted.java file to test your code.  You do not need to submit this tester file.

Attachment:- Assignment Files.rar

Reference no: EM131715706

Questions Cloud

Create a historical timeline describing the major events : Create a historical timeline describing the major events within the field of forensic science.Your timeline should bullet point the significant events .
Coefficient of kinetic friction : A mass of 10 kg is moving at 5.3 m/s on a horizontal surface and the enitre surface has friction with a coefficient of kinetic friction of 0.58.
Discuss visual perception and interpretation of events : What social pressures does the group exert upon you to alter your visual perception and interpretation of events. Explain
Horizontal surface with friction : A mass of 7 kg is moving at 7.9 m/s on a horizontal surface with friction. If y = 0 m for gravitational potential energy is the horizontal surface
Word tree data structure problem : COMP 250: Introduction to Computer Science Assignment. Read the provided code including the comments which explain what the various methods do
How are mental health programs delivered in prison : Describe the different types of cultures and subcultures you might face in prison.How are mental health programs delivered in prison?
Coefficient of static friction between the wheels : The coefficient of static friction between the wheels and track is 0.207. the acceleration of gravity is 9.9 m/s squared.
Define what can be done to prevent the food fights : What can be done to prevent the "food fights" which seem to break out every Thursday in the school cafeteria
Earth satellite remains in orbit at a distance : An earth satellite remains in orbit at a distance of 11494 km from the center of the earth. What speed would it have to maintain?

Reviews

len1715706

11/10/2017 3:49:04 AM

Topic: Java Programming. Submit only the file WordTree.java as a zip file. Use the A3TesterPosted.java file to test your code. You do not need to submit this tester file. The T.A.s handing this assignment are Ram and Navin. Their office hours and location and email contacts will be posted on mycourses Announcements. general instructions as Assignments 1 and 2, in particular, the late penalty. We will deduct at least 20 points for any student who has to resubmit after the due date (i.e. late) because the wrong file or file format was submitted. This policy will hold regardless of whether the student can provide proof that the assignment was indeed “done” on time. This includes submitting a .class file, starter code, a rar or 7z format.

len1715706

11/10/2017 3:48:58 AM

Submit a single zipped file A3.zip which contains the modified WordTree.java file, to the myCourses assignment A3 folder. Include your name and student ID number in the comment at the top of the WordTree.java file. In this assignment, you will work on the problem of storing a set of n words in a tree data structure, and a method for efficiently finding all the words that have a given prefix. You should be familiar with the latter problem through the autocomplete feature found on cell phones, web forms, Eclipse. For instance, if you type in “aar", then the autocomplete feature may suggest aardvark, aardvarks, aardwolf, aardwolves, aargh.

Write a Review

JAVA Programming Questions & Answers

  Recursive factorial program

Write a class Array that encapsulates an array and provides bounds-checked access. Create a recursive factorial program that prompts the user for an integer N and writes out a series of equations representing the calculation of N!.

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Java class, array, link list , generic class

These 14 questions covers java class, Array, link list , generic class.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd