

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Practice questions for the last day quiz of c sc 227, focusing on binary search trees and ordered maps. Students are required to identify binary search trees, draw pictures, implement methods, and analyze code output.
Typology: Quizzes
1 / 2
This page cannot be seen from the preview
Don't miss anything!


OrderedMap<String, Integer> aBST = new OrderedMap<String, Integer>(); aBST.put("Matrix", 5); aBST.put("Antz", 3); aBST.put("Bean", 2); aBST.put("Shaft", 2); aBST.put("Scream", 3); aBST.put("Titanic", 4);
OrderedMap<Double, String> doubleTree = new OrderedMap<Double, String>(); System.out.println("\nMax key is " + doubleTree.maxKey() ); OrderedMap<Integer, String> intTree = new <Integer, String> OrderedMap(); intTree.put(5, "A"); intTree.put(8, "B"); intTree.put(-3, "C"); intTree.put(4, "D"); System.out.println("\nMax key is " + intTree.maxKey() );
Max key is null Max key is 8
Map<String, BankAccount> tm = new TreeMap<String, BankAccount>(); tm.put("M", new BankAccount("Michel", 111.11)); tm.put("G", new BankAccount("Georgie", 222.22)); tm.put("S", new BankAccount("Sam", 333.33)); tm.put("P", new BankAccount("Pei", 333.33)); tm.put("Z", new BankAccount("Zac", 333.33)); Set