The volatile keyword

It’s in the book. It’s very specific. This tells the compiler not to optimize objects that are qualified by the volatile keyword because their values may change outside of program control or detection.

The extern keyword

A link indicating the language used by any non-C ++ function.

The static keyword

A static member of a class shared by all objects of the class

Binary search

Just pay attention to the boundary problem. While is > or >=

Binary search framework:

int binarySearch(int[] nums, int target) { int left = 0, right = ... ; while(...) { int mid = left + (right - left) / 2; if (nums[mid] == target) { ... } else if (nums[mid] < target) { left = ... } else if (nums[mid] > target) { right = ... } } return ... ; }Copy the code