COMP 2313 NAU A Dictionary Implementation Using Binary Search Trees File

User Generated

raqrefh

Computer Science

COMP 2313

North American University

COMP

Description

A Dictionary implementation using Binary Search Trees

Program requirements and structure

You should be able to do the following:

  • Add dictionary entries
  • Search for an entry
  • Print the whole dictionary

You will be using the .compareTo method from the String class in order to move through your tree.

Recursive method to print the tree in inorder traversal (you need little mods below code)

public void printTree(Node root){
      if(root != null){
           printTree(root.getLeftChild());
           System.out.println(root.toSting( ));
           printTree(root.getRightChild());
      }
}

Please use CODE TEMPLATE!

Unformatted Attachment Preview

COMP 2313 DATA STRUCTURES CODE ASSIGNMENT Assignment Name: Printing odd numbers Student Name :John Doe Assignment Date: 9/4/2020 Student id : 123 Problem Printing odd numbers in an integer array. Challenges • Finding pattern to find odd numbers • Accessing elements • Iteration 1 COMP 2313 DATA STRUCTURES FALL 2020 Code package data_structures; public class Sample { public static void main(String[] args) { // int array created and initialized with integer numbers 1-8 int[] numbers = {1,2,3,4,5,6,7,8}; //for loop to visit all elements of the int array for(int i = 0 ; i < numbers.length ; i++){ // since size of the array is dynamic numbers.length used to access the last element //Any odd number can be calculated using modulus operator. Basically remainder of the division 2 is not zero if(numbers[i]%2 != 0) { System.out.println(numbers[i]); // only odd numbers index will return true } } } } Pseudo Code Initialize int array with random int numbers for (index=0 to last index) if (current%2 not equal to zero) print current element 2 COMP 2313 DATA STRUCTURES FALL 2020 UML Diagram Outputs Figure 1 Output Screen of the Odd Numbers Question REPL.IT LINK https://repl.it/repls/CarefulWretchedRuntimelibrary#Main.java 3 COMP 2313 DATA STRUCTURES FALL 2020
Purchase answer to see full attachment
User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.

Explanation & Answer

Attached. Pleas...


Anonymous
Super useful! Studypool never disappoints.

Studypool
4.7
Trustpilot
4.5
Sitejabber
4.4

Similar Content

Related Tags