将单链表(a1,a2,a3.an-1,an)转换成(an,an-2,...,a2,a1,a3,...,an-1)的算法
1个回答
pre=a1;
p=a1->next;
a1->next = NULL;
while(p!= NULL)
{
pp=p->next;
p->next=pre;
pre = p;
p = pp;
}
相关问题
计算(a1+a2+…+an-1)(a2+a3+…+an-1+an)-(a2+a3+…+an-1)(a1+a2+…+an)
计算(A1+A2+…+An-1)(A2+A3+…+An)-(A2+A3+…+An-1)(A1+A2+…+An)
(an)中 a3=2 a2=1 (1/(an)+1)成等差 则a1=________ an=_____________
计算(a1+a2+...+an-1)x(a2+a3+...+an)-(a2+a3+...+an-1)(a1+a2+...
数列{an}满足:a1=1,a2=3/2,an+2=3/2an+1-1/2an
数列an,a1=1 ,a2=2/3,1/an+1 + 1/an-1 =1/an,求an
数列{an}中a1=1,a2=3,a3=2,an+2=an+1 -an,求S2012
在数列an中,a1=1/2 an+1=3an/an+3 求a2 a3 a4 a5?
数列{an}中,a3=1,a1+a2+…+an=an+1(n=1,2,3…).
在数列an中,a1=2,a2=3,an+2=3*an+1-2*an