摘要:
quicksort(A,p,r){if p < r; then q<- partition(A,p,r) quicksort(A,p,q-1) quicksort(A,p+1,r)}其中partition(A,p,r){x<-A[r]i<-p-1for j<-p to r-1 do if A[j]<= x then i++; exchange A[i]<-... 阅读全文
摘要:
Bitwise operator in C/C++ 歡迎來到二進位的世界。電腦資料都是以二進位儲存,想當然程式語言的變數也都是以二進位儲存。在 C/C++ 當中有幾個位元運算子: << SHIFT LEFT 、 >> SHIFT RIGHT 、 & AND 、 | OR 、 ^ XOR 、 ~ NOT ,可以對變數進行位元運算。接下來要介紹位元運算的一些用途。 &l... 阅读全文
摘要:
简单功能模仿:stack:函数实现voidstack(){ int stcak[10]; int top=0;while(top<10) stack[top++]=top;while(top>0) cout<<stack[--top]<<" ";}queue:函数实现void queue(){ int queue[10];int front=0,rear=0;q... 阅读全文
摘要:
Problem D: Above AverageIt is said that 90% of frosh expect to be above average in theirclass. You are to provide a reality check.The first line of standard input contains an integer C,the number of... 阅读全文
摘要:
The ProblemMedian plays an important role in the world of statistics. By definition,it is a value which divides an array into two equal parts. In this problemyou are to determine the current median of... 阅读全文
摘要:
A sequence of n > 0 integers is called a jolly jumper if the absolute values of the difference between successive elements take on all the values 1 through n-1. For instance,1 4 2 3is a jolly jumpe... 阅读全文
摘要:
In this problem you are to generate a triangular wave form according to a specified pair of Amplitude and Frequency.Input and OutputThe input begins with a single positive integer on a line by itself ... 阅读全文