## 梯度下降算法简介

(可以证明, 沿着梯度方向或反方向, 可以获得最大、最快的进度. 对于梯度的详细了解,可参照高数课本导数部分关于梯度的介绍).

## 梯度下降算法步骤

### 1. 通用步骤

1. 计算当前误差
2. 查看当前误差是否符合要求, 或是否已达到迭代上限, 若是,结束
PAT(A) 1135. Is It A Red-Black Tree (30)

### 1135. Is It A Red-Black Tree (30)

There is a kind of balanced binary search tree named red-black tree in the data structure. It has the following 5 properties:

(1) Every node is either red or black. (2) The root is black. (3) Every leaf (NULL) is black. (4) If

PAT(A) 1134. Vertex Cover (25)

### 1134. Vertex Cover (25)

A vertex cover of a graph is a set of vertices such that each edge of the graph is incident to at least one vertex of the set. Now given a graph with several vertex sets, you are supposed to tell if each of them is a vertex cover or not.

PAT(A) 1133. Splitting A Linked List (25)

### 1133. Splitting A Linked List (25)

Given a singly linked list, you are supposed to rearrange its elements so that all the negative values appear before all of the non-negatives, and all the values in [0, K] appear before all those greater than K. The order of th

PAT(A) 1132. Cut Integer (20)

### 1132. Cut Integer (20)

Cutting an integer means to cut a K digits long integer Z into two integers of (K/2) digits long integers A and B. For example, after cutting Z = 167334, we have A = 167 and B = 334. It is interesting to see that Z can be devided by the pr

PAT(A) 1127. ZigZagging on a Tree (30)

### 1127. ZigZagging on a Tree (30)

Suppose that all the keys in a binary tree are distinct positive integers. A unique binary tree can be determined by a given pair of postorder and inorder traversal sequences. And it is a simple standard routine to print the numbe

PAT(A) 1126. Eulerian Path (25)

### 1126. Eulerian Path (25)

In graph theory, an Eulerian path is a path in a graph which visits every edge exactly once. Similarly, an Eulerian circuit is an Eulerian path which starts and ends on the same vertex. They were first discussed by Leonhard Euler while s

PAT(A) 1125. Chain the Ropes (25)

### 1125. Chain the Ropes (25)

Given some segments of rope, you are supposed to chain them into one rope. Each time you may only fold two segments into loops and chain them into one piece, as shown by the figure. The resulting chain will be treated as another segmen