13 terms

de morgan's laws

!(a && b) is the same as !a || !b

de morgan's laws

!(a || b) is the same as !a && !b

short-circuit evaluation

In a logical expression, if the value of the first operand is sufficient to determine the result, then the second is not evaluated.

polymorphism

mechanism that ensures that the correct method is called for an object disguised as a more generic type.

java.lang.Comparable<T>

built-in interface used for designating objects that can be compared in some way

int compareTo(T other)

sole method specified by java.lang.Comparable<T>

boolean equals(Object x)

Object instance method that is used to determine whether two objects are the same

sequential search

type of array search where elements are checked one by one in order until a value is found

binary search

type of array search used (with specific implementations) for already sorted arrays

selection sort

array sorting algorithm - start at n and iterate down to 2 for k, swapping the kth element with the largest of the remaining

insertion sort

array sorting algorithm - start at 2 and iterate for k up to n, inserting the kth element in its appropriate position

mergesort

recursive sorting algorithm - divide the array into two equal halves and sort each half, then merge them back together

quicksort

recursive sorting algorithm - choose a pivot element, then rearrange each side so that those elements less than the pivot are to the left and greater are to the right; then, sort (recursively)