## 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:

## 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

## 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]

## 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,

## 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.

## 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.

## 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

## PAT(A) 1124. Raffle for Weibo Followers (20)

### 1124. Raffle for Weibo Followers (20)

John got a full mark on PAT. He was so happy that he decided to hold a raffle（抽奖） for his followers on Weibo -- that is, he

## PAT(A) 1123. Is It a Complete AVL Tree (30)

### 1123. Is It a Complete AVL Tree (30)

An AVL tree is a self-balancing binary search tree. In an AVL tree, the heights of the two child subtrees of any node differ

## PAT(A) 1122. Hamiltonian Cycle (25)

### 1122. Hamiltonian Cycle (25)

The "Hamilton cycle problem" is to find a simple cycle that contains every vertex in a graph. Such a cycle is called a "Hamiltonian cycle".

In this problem, you are supposed to tell if a given cycle is

## PAT(A) 1121. Damn Single (25)

### 1121. Damn Single (25)

"Damn Single (单身狗)" is the Chinese nickname for someone who is being single. You are supposed to find those who are alone in a big party, so they can be taken care of. Input Specification:

## PAT(A) 1120. Friend Numbers (20)

### 1120. Friend Numbers (20)

Two integers are called "friend numbers" if they share the same sum of their digits, and the sum is their "friend ID". For example, 123 and 51 are

## PAT(A) 1119. Pre- and Post-order Traversals (30)

### 1119. Pre- and Post-order Traversals (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

## PAT(A) 1118. Birds in Forest (25)

### 1118. Birds in Forest (25)

Some scientists took pictures of thousands of birds in a forest. Assume that all the birds appear in the same picture belong to the same tree.

## PAT(A) 1117. Eddington Number(25)

### 1117. Eddington Number(25)

"British astronomer Eddington liked to ride a bike. It is said that in order to show off his skill, he has even defined an "Eddington number",

## PAT(A) 1116. Come on! Let's C (20)

### 1116. Come on! Let's C (20)

"Let's C" is a popular and fun programming contest hosted by the College of Computer Science and Technology, Zhejiang University. Since the idea of the contest is for fun, the award rules are funny as the following:

## PAT(A) 1111. Online Map (30)

### 1111. Online Map (30)

Input our current position and a destination, an online map can recommend several paths. Now your job is to recommend two paths to your user: one is the shortest, and the other is the fastest. It is guaranteed that a path exists for

## PAT(A) 1110. Complete Binary Tree (25)

### 1110. Complete Binary Tree (25)

Given a tree, you are supposed to tell if it is a complete binary tree.

Input Specification:

Each input file contains one test case. For each case,

## PAT(A) 1109. Group Photo (25)

### 1109. Group Photo (25)

Formation is very important when taking a group photo. Given the rules of forming K rows with N people as the following:

The number of people in each row must be N/K (round down to the nearest integer),

## PAT(A) 1064. Complete Binary Search Tree (30)

### 1064. Complete Binary Search Tree (30)

A Binary Search Tree (BST) is recursively defined as a binary tree which has the following properties:

The left subtree of a node contains only nodes with keys less than the

## 1063. Set Similarity (25)

### 1063. Set Similarity (25)

Given two sets of integers, the similarity of the sets is defined to be Nc/Nt*100%, where Nc is the number of distinct common numbers shared by the two sets,

## PAT(A) 1062. Talent and Virtue (25)

### 1062. Talent and Virtue (25)

About 900 years ago, a Chinese philosopher Sima Guang wrote a history book in which he talked about people's talent and virtue. According to his theory, a man

## Pat(A) 1061. Dating (20)

### 1061. Dating (20)

Sherlock Holmes received a note with some strange strings: "Let's date! 3485djDkxh4hhGE 2984akDfkkkkggEdsb s&hgsfdk d&Hyscvnm". It took him only a minute to figure out that