1. Dictionary tree (prefix tree) :

  • Quick word lookup by prefix.
  • Traverse to add and find.

3. Priority queue

  • Priority queues no longer follow a first-in, first-out principle, but are divided into two cases:

    Maximum priority queue: Regardless of queue order, the current largest element is first queued.

    Minimum priority queue: Regardless of the order in which the current smallest element is queued, the smallest element is queued first.

4. The binary heap

  • The top of the largest heap is the largest element in the entire heap.

  • The top of the smallest heap is the smallest element in the entire heap.

5. Observe the input data range to predict whether there will be a timeout. The standard is 10^8 calculations.

6. Use math. floor to see if the data is greater than 0, otherwise math. ceil should be used.

7. Sort returns a difference value instead of a ratio.