T/F questions - The following statement selects the nth bit of an integer x: (x & 1) >> n - The partition method splits the elements into three groups: those that are less than, equal to and greater than the pivot. - With a circularly linked list we can remove elements from the end of the list in constant time. - Shifting an integer to the left n times is equivalent to dividing that number by 2 and rounding down n times. - It is always better to use an ArrayList over an array - write a class MyClass that uses generics that stores generic data items in an array and supports the following methods: - constructor that takes the capacity, e.g. MyClass m = new MyClass(10); - access item at index i m.get(i); - set item at index i to a particular value m.set(i, "a string"); - see if there are duplicates in the list (using .equals) if( m.containsDuplicates() ){ System.out.println("duplicates!"); } - what is the big-O running time of your containsDuplicates method assuming n elements in the array and an array capacity of m elements? - write a method that takes an ArrayList and reverses the elements in the list - rewrite the method below using the ternary operator: private int absDiff(int x, int y){ if( x - y > 0 ){ return x - y; } else { return y - x; } } - what would be the order of numbers visited using binary search on the following data if we were searching for 9: 3, 8, 10, 11, 13, 18, 20, 21 - Identify three problems with the interface and class pair below: public interface A{ public void methodA(int a); public int methodB(); private void methodC(double d); } public class B implements interface A{ private static final int C = 10; private static int count = 0; private double d = 0.0; public void methodA(int a){ count++; C += a; } public int methodB(int a){ count -= a; } private void methodC(double d){ d = d; } } - In our implementation of a linked list, we used two kinds of objects, Node and LinkedList. Why are two classes required? - What are the advantages of linked lists over array-based lists? Vice versa?