摘要:
1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 #include 9 #include 10 using namespace std; 11 12 void Heapfy(int a[], int idx, int max)//堆调整 13 { 14 int...
阅读全文
posted @ 2017-05-09 15:24
无惧风云
阅读(123)
推荐(0)
摘要:
You are given a string representing an attendance record for a student. The record only contains the following three characters: A student could be re
阅读全文
posted @ 2017-05-09 15:09
无惧风云
阅读(146)
推荐(0)
摘要:
Given two arrays, write a function to compute their intersection. Example:Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], return [2, 2]. Note: Each elemen
阅读全文
posted @ 2017-05-08 22:20
无惧风云
阅读(165)
推荐(0)
摘要:
1 #include 2 using namespace std; 3 //快速排序 4 void Quicksort(int a[], int low, int high) 5 { 6 if (low >= high) 7 return; 8 int first = low; 9 int last = high; 10 int ...
阅读全文
posted @ 2017-05-08 17:45
无惧风云
阅读(165)
推荐(0)
摘要:
1 #include 2 using namespace std; 3 //冒泡排序 4 void BubbleSort(int a[], int n) 5 { 6 int i, j, t; 7 for (i = 0; i = i+1; j--) 10 { 11 if (a[j] 降序】 12 { 13...
阅读全文
posted @ 2017-05-08 17:22
无惧风云
阅读(144)
推荐(0)
摘要:
1 #include 2 using namespace std; 3 //选择排序 4 void select_sort(int a[], int n) 5 { 6 int i, j, m,t; 7 for (i = 0; i a[j]) 13 m = j; 14 } 15 if (m != i) 1...
阅读全文
posted @ 2017-05-08 17:15
无惧风云
阅读(139)
推荐(0)
摘要:
1 #include 2 using namespace std; 3 //直接插入排序 4 void InsertSort(int a[], int n) 5 { 6 int i, j, key; 7 for (i = 1; i = 0 && a[j]>key) 12 { 13 a[j + 1] = a[j]; 14 ...
阅读全文
posted @ 2017-05-08 16:57
无惧风云
阅读(156)
推荐(0)
摘要:
Given a roman numeral, convert it to an integer. Input is guaranteed to be within the range from 1 to 3999.
阅读全文
posted @ 2017-05-08 15:32
无惧风云
阅读(129)
推荐(0)
摘要:
Given an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at least twice in the arr
阅读全文
posted @ 2017-05-08 09:19
无惧风云
阅读(138)
推荐(0)