[1;37m【 以下文字轉載自 [32mandrew [37m的信箱 】
【 原文由 [32m yves [37m 所發表 】 [m
Given the following C fuction . The following promlems are related to
these functions.
void one(int v[],int left ,int right)
{ini i,last;
void two(int v[],ini i ,int j);
if(left〉=right )
return;
two(v,left,(left+right)/2);
last=left;
for(i=left+1;i〈 =right;i+ +)
/*i+ + denotes increasing i by one */
if(v[i]〈 v[left] )
two(v,+ +last,i);
/* + + last denotes increasing last by one */
two (v,left,last);
one (v,left,last -1);
one (v,last+1,right);}
void two (int v[],int i,int j)
{int temp:
temp=v[i];
v[i]=v[j];
v[j]=temp;}
1.Assume that "score"is a one dimensional array. What is the purpose
of the statement one(score,0,9)?
2.Given an example for the array,"score"mentioned above.
3.Show the content changing process of the array, "score" answered
in the above problem. when the statement one (score,0,9)is executed.
----------------------------------------------------------------------
A..(a)What is the time complexity of the quick sort algorithm?
(b)Write a rescursive quick sort function qsort(X,n,flag)to sort
the given integer array X of size n.Write it in any of these language:
FORTRAN,Pascal,C or C++.Where flag is an integer to indicate how
to sort -1 means to sort X into acending order, 1 means to sort X
into descending order.You should give enough comments in your
program.
B--Illustrate how to implement a STACK via using a single linked
list.
--
[=m 申訴找我,特別服務則要收費...... :Q yves [=S
無言獨上西樓 月如勾
寂寞梧桐深院鎖清秋
剪不斷 理還亂 是離愁
別是一般滋味在心頭
[m [1;36m※ 來源:‧大葉大學戀戀紅城 sun.dyu.edu.tw‧[FROM: ccdiup14.dyu.edu.tw] [m
--
[m [1;35m※ 轉載:‧大葉大學戀戀紅城 sun.dyu.edu.tw‧[FROM: ccdiup13.dyu.edu.tw] [m