1 Introduction to Algorithms

1.1 Introduction

Algorithm is a set of instructions to complete the task. Any code snippets can be regarded as the algorithm

1.2 Binary Search

Scenario: Suppose 1-100 look 75
simple look: Guess turn up starting from 1 to 75 times before it needs only the
binary search: 50-75,2 times you can
use a binary search, did not rule out half of all numbers. For a list of n elements using a binary search can take up to log 2 N steps, and the need to find the most simple steps n

Guess you like

Origin www.cnblogs.com/csj2018/p/12042169.html