Chapter

Searching

From ComputerScienceOne by Dr Chris Bourke

Concepts

  1. How can a Comparator sort Student objects by GPA?

    "Comparator<Student> byGpa = new Comparator<Student>() {\n\n@Override\n\npublic int compare(Student a, Student b) {\n\nreturn b.getGpa().compareTo(a.getGpa());\n\n}\n\n};\n\nWe now turn our attention

  2. How do Java collections perform a linear search?

    "Java Set and List collections provide several linear search methods. Both have a public boolean contains(Object o) method that returns true or false depending on whether or not an object matching o i

  3. What are the requirements for using binary search in Java?

    "The Arrays and Collections classes provide many variations on methods that implement binary search. All of these methods assume that the array or List being searched are sorted appropriately (you can

Searching | ComputerScienceOne | Bifalgorithm | Bifalgorithm