[Introduction to Programming - C Language] MOOC Professor Weng Kai from Zhejiang University [Week 7] Notes + Understanding

1Array operations

1.Array operations

Insert image description here
Insert image description here
Insert image description here

2. Array example: prime numbers

Insert image description here

Adding curly brackets for no reason is often for output debugging.

Insert image description here
Push the algorithm forward, but not to the level of code: pseudo code

2search

1.Linear search

Insert image description here

Detail 1: Note that we need a single export

Insert image description here

Detail 2: See picture above

2. Search example

Insert image description here

Insert image description here

Apply to structure. Merging 2 arrays and putting the value and string together
is more cache-friendly

3. Binary search

Insert image description here

Improved efficiency, only 7 searches are needed for 100 items [The premise of the dichotomy method is that it is in order]

3 Preliminary sorting

1Select sort

Insert image description here
Insert image description here
Insert image description here

Guess you like

Origin blog.csdn.net/m0_57495651/article/details/132380239