[Solved] CSE222_505 HW5-General Tree,Binary Tree, Heap
5.0
1 customer review
Digital download
Digital download
$25.00
Message us on WhatsApp for payment or download support.
| //Search file or directory names including new myFileSystem.search(new); //This will output:// file root/first_directory/new_file.txt// dir root/second_directory/new_directory// file root/second_directory/new_directory/new_file.doc //Remove files or directories myFileSystem.remove(root/first_directory/new_file.txt); myFileSystem.remove(root/second_directory/new_directory); |
| //Create a tree for preorder expressionExpressionTree expTree = new ExpressionTree(+ + 10 * 5 15 20);//Create a tree for postorder expressionExpressionTree expTree2 = new ExpressionTree(10 5 15 * + 20 +); //Evaluate expressions result1 = expTree.eval(); |
| //Create an empty age treeAgeSearchTree<AgeData> ageTree = new AgeSearchTree<AgeData>();//Add nodes for some ages, remove method works similarly ageTree.add(new AgeData(10)); ageTree.add(new AgeData(20)); ageTree.add(new AgeData(5)); ageTree.add(new AgeData(15)); ageTree.add(new AgeData(10)); //Create a string representing the tree and print ittreeStr = ageTree.toString(); System.out.println(treeStr);//This will print://10 2//5 1 |
| //Create an empty heapMaxHeap<AgeData> heap = new MaxHeap<AgeData>();//Add nodesheap.add(new AgeData(10)); heap.add(new AgeData(5)); heap.add(new AgeData(70)); heap.add(new AgeData(10)); heap.add(new AgeData(50)); heap.add(new AgeData(5)); heap.add(new AgeData(15)); //Create a string representing the heap and print it heapStr= heap.toString(); System.out.println(heapStr); //output://10 2//5 2//70 1//50 1//15 1 //Print the number of people younger than 15System.out.println(heap.youngerThan(10))//output will be 2 //Find the number of people at any ageSystem.out.println(heap.find(new AgeData(10)).toString())//It will print://10 2 |
| Detailed system requirements | |
| Use case diagrams (extra points) | |
| Class diagrams | X |
| Other diagrams | |
| Problem solutions approach | X |
| Test cases | X |
| Running command and results | X |