[Training] 8.22-8.31 summer school motto

 

 

DAY 1

1.1 Sorting Algorithm

1.2 sequenced application

1.3 Complexity Analysis

 

 

 

 

 

1.1 Sorting Algorithm

  •  Comparison of sorting algorithms based on the exchange
    • Selection Sort
      • Ideas: constantly choose the number of remaining the largest number
      • Implementation: a sequence of ordered regions and the divided regions unsorted; each update (enlarged) ordered region is selected, until a length of unsorted region 0
      • Code:
    •  Bubble Sort
      • Ideas: one by one to compare exchange
      • Obviously efficiency is relatively low
    • Insertion Sort
      • Ideas: simulation touch poker? And maintain the sort of sequence selection is about the same (is divided into a sequence of sorted and unsorted regional area)
      •       
    • Shell sort

1.2. Sequenced application

 

 

- Pretreatment

- multi-keyword sort

 

 

 

 

 

 

- discrete

 

 

 

 

 

 

 

1.3 Complexity Analysis

 

  • Comparison of order
  • Sorting algorithm complexity
    •   Selection Sort
    •     Bubble Sort
    • Insertion Sort
    • Bucket sort
    • Merge sort
    • Quick Sort
    • Heapsort
  • Complexity analysis techniques

DAY 2

Mode test mode test

 

1. merge sort of reverse seek

2. The wire rod small ads

3. visiting the exhibition

4. birthday gift

DAY 3

1.1 queue

1.2 breadth-first search

1.3 circular queue

1.4 two-way queue

1.5 monotonous stack

Monotone queue 1.6

 

 

1.1 queue

1.1.1 handwritten queue

1.1.2 circular queue

  • Size-1 can store only the elements
  • Achieved by modulo

 

 

 

1.2 breadth-first search

 

 

1.2.1dfs and bfs

 

dfs: "attainable are brothers."

bfs: "My son is attainable" (fog)

 

 

 

1.2.2 Why can not we do dfs use three basic methods of dp

/ Dp idea of ​​how to use bfs

 

 

 

 

 

 

 

 

 dp with dfs

 

 

 

 

 1.3 circular queue

 

Why use a circular queue

 

achieve

 

1.4 double-ended queue (deque)

 

luogu sign the damn quasi

Really got nothing to understand ==

 

 

 

 

 

 

1.5 monotonous stack

    • Application 1: Ask most value range

 

            

 

 

 

              

               ○ Application 2: Find the right and left sides of a smaller than their place

                    ■ example: poj2559

More consistent than the top element stack monotonicity monotonicity replace the original top element

 

1.6 monotone queue

 

    • Application 1: address the special section the most value problem (monotonic ** interval)
      • This eliminates the need half of it

 

 

 

                ○ Application 2: sliding window (the minimum required to meet the conditions of section)

 

stl队列不方便调试,只用一个栈、队列或者单调队列时最好用手写

 

Guess you like

Origin www.cnblogs.com/phemiku/p/11395916.html