- 博客(13)
- 收藏
- 关注
原创 My solution for SRM 306 DIV2 [250]
Problem Statement: http://www.topcoder.com/stat?c=problem_statement&pm=6413&rd=9986My solution:#include #include using namespace std;class SortMachine { public: SortMachine () {} public: int coun
2006-06-09 09:05:00 1148
原创 Anagrams by Stack
Anagrams by Stack Time limit: 1 Seconds Memory limit: 32768K Total Submit: 1719 Accepted Submit: 724 How can anagrams result from sequences of stack operations? There are two sequen
2006-06-05 17:23:00 1340 1
原创 Crashing Balloon
Crashing Balloon Time limit: 1 Seconds Memory limit: 32768K Total Submit: 3758 Accepted Submit: 993 On every June 1st, the Childrens Day, there will be a game named "crashing ballo
2006-06-04 20:47:00 1162
原创 Fire Net
Fire Net Time limit: 1 Seconds Memory limit: 32768K Total Submit: 5171 Accepted Submit: 1689 Suppose that we have a square city with straight streets. A map of a city is a square bo
2006-06-04 20:44:00 1012
原创 Quicksort in C++
/*The PARTITION procedure is the key to the QUICKSORT algorithm, it rearranges the subarray A[p...r] in place. PARTITION always selects an element A[r] as a pivot element around which to partition the
2006-05-01 20:51:00 1347
原创 Heap Sort in C++
/*This function is an important subroutine for manipulating max-heaps. Its inputs are an array A with its length and an index i into the array. When maxHeapify is called, it is assumed that the binar
2006-04-29 17:06:00 2403 1
原创 Solution for exercise 1.3-7 in Introduction to Algorithms
Describe a θ(nlgn)-time algorithm that, given a set S of n real numbers and another real number x, determines whether or not there exist two elements in S whose sum is exactly x.Solution: First, sort
2006-03-22 16:57:00 1487
原创 Solution for exercise 1.3-5 in Introduction to Algorithms
Referring back to the searching problem (see Exercise 1.1-3), observe that if the sequence A is sorted, we can check the midpoint of the sequence against v and eliminate half of the sequence from furt
2006-03-22 16:00:00 1279
原创 Merge sort in C++
/* * A is an array and p, q, and r are indices numbering elements of the array * such that p * * This procedure assumes that the subarrays A[p. .q] and A[q + 1. .r] are in * sorted order. It merg
2006-03-22 15:05:00 2705
原创 Solution for exercise 1.2-3 in Introduction to Algorithms
Consider the problem of determining whether an arbitrary sequence (x1, x2, . . . , xn) of n numbers contains repeated occurrences of some number. Show that this can be done in θ(n lg n) time, where
2006-03-21 15:14:00 1429
原创 Solution for exercise 1.2-1 in Introduction to Algorithms
Consider sorting n numbers stored in array A by first finding the smallest element of A and putting it in the first entry of another array B. Then find the second smallest element of A and put it i
2006-03-21 13:53:00 1262
原创 Solution for exercise 1.1-4 in Introduction to Algorithms
Consider the problem of adding two n-bit binary integers, stored in two n-element arrays A and B. The sum of the two integers should be stored in binary form in an (n + 1)-element array C. State th
2006-03-20 17:36:00 1949
转载 How Eclipse Finds Your Classes at Runtime
In Eclipse each plug-in has its own class loader and has its own class look-up path that is derived from the imported plug-ins. A separate class loader gives each plug-in a separate name space for its
2006-03-20 11:43:00 1320
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人