Sorted Arrays Flashcards

1
Q

How do you know if an array is sorted?

A

Its components are in ascending order

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How does “greater than” work with Objects?

A

Using Comparable objects, which allows ordering to be defined over objects

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How does “binary search” work with a sorted array? (3)

A
  • Check middle element
  • Greater than, equal to, or less than target
  • If not found, search again in upper or lower half
How well did you know this?
1
Not at all
2
3
4
5
Perfectly