Take the middle number (No.5) and compare it with 18.
If > 18, compare the third number with 18.
If > 18, compare the second number with 18.
if
if
If > 18, compare the sixth number with 18.
if
In this way, the median is compared with the searched number 18 until the searched number 18 is found, which is much faster than the method of comparing one by one. Of course, the beginning can also be arranged in descending order. At this time, the comparison of numbers can be reversed.
Flowchart is not easy to draw here, draw it yourself.