原创 1107 Social Clusters (30分) -- 並查集

When register on a social network, you are always asked to specify your hobbies in order to find some potential friends

原创 1099 Build A Binary Search Tree (30分)

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

原创 1039 Course List for Student (25分)

Zhejiang University has 40000 students and provides 2500 courses. Now given the student name lists of all the courses,

原创 1029 Median (25分) 使用nth_element函數與兩點法

Given an increasing sequence S of N integers, the median is the number at the middle position. For example, the median

原创 1088 Rational Arithmetic (20分)

For two rational numbers, your task is to implement the basic arithmetics, that is, to calculate their sum, difference,

原创 1103 Integer Factorization (30分) 【DFS】

The K−P factorization of a positive integer N is to write N as the sum of the P-th power of K positive integers. You ar

原创 1086 Tree Traversals Again (25分)

An inorder binary tree traversal can be implemented in a non-recursive way with a stack. For example, suppose that when

原创 1043 Is It a Binary Search Tree (25分)

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

原创 1101 Quick Sort (25分)

There is a classical process named partition in the famous quick sort algorithm. In this process we typically choose on

原创 1097 Deduplication on a Linked List (25分)

Given a singly linked list L with integer keys, you are supposed to remove the nodes with duplicated absolute values of

原创 1015 Reversible Primes (20分)

A reversible prime in any number system is a prime whose "reverse" in that number system is also a prime. For example i

原创 1004 Counting Leaves (30分)

A family hierarchy is usually presented by a pedigree tree. Your job is to count those family members who have no child

原创 1024 Palindromic Number (25分)

A number that will be the same when it is written forwards or backwards is known as a Palindromic Number. For example,

原创 1063 Set Similarity (25分)

Given two sets of integers, the similarity of the sets is defined to be N​c​​/N​t​​×100%, where N​c​​ is the number of

原创 1078 Hashing (25分)

The task of this problem is simple: insert a sequence of distinct positive integers into a hash table, and output the p