第二章习题答案及练习.pptVIP

  • 4
  • 0
  • 约5.85千字
  • 约 23页
  • 2017-05-30 发布于四川
  • 举报
* 计算机软件基础(第三版) 第二章习题答案及练习 Evaluation only. Created with Aspose.Slides for .NET 3.5 Client Profile 5.2.0.0. Copyright 2004-2011 Aspose Pty Ltd. ( a) O(n2) (b) O(n) (c)O(n3) 3. O(n3) Evaluation only. Created with Aspose.Slides for .NET 3.5 Client Profile 5.2.0.0. Copyright 2004-2011 Aspose Pty Ltd. 8. 统计输入数中正数和负数的个数,输入0则结束。main() { int x,num1=0,num2=0; printf(input num); scanf(%d,x); while(x!=0) { if(x0) num1=num1+1; else num2=num2+1; scanf(%d,x);} printf(Positive num is: %d\n,num1); printf(Negative num is: %d\n,num2);} Evaluation only. Created with Aspose.Slides for .NET 3.5 Client Profile 5.2.0.0. Copyright 2004-2011 Aspose Pty Ltd. L S 2 8 3 7 5 ^ P R (1) L=P-link; 2 8 3 7 5 ^ P R S L (2) R-data=P-data; 2 8 5 7 5 ^ P R S 9. 对以下单链表分别执行下列各程序段,并画出结果示意图. Evaluation only. Created with Aspose.Slides for .NET 3.5 Client Profile 5.2.0.0. Copyright 2004-2011 Aspose Pty Ltd. (3) R-data=P-link-data; 2 8 7 7 5 ^ P R S (4) P-link-link-link-data=P-data; 2 5 3 7 5 ^ P R S Evaluation only. Created with Aspose.Slides for .NET 3.5 Client Profile 5.2.0.0. Copyright 2004-2011 Aspose Pty Ltd. (5) T=P; while(T!=NULL) { T-data=(T-data)*2; T=T-link; } S 2 ^ P R 10 14 6 16 (6) T=P; while(T-link!=NULL) { T-data=(T-data)*2; T=T-link; } S 2 ^ P R 10 14 6 8 Evaluation only. Created with Aspose.Slides for .NET 3.5 Client Profile 5.2.0.0. Copyright 2004-2011 Aspose Pty Ltd. (7) P=(JD*)malloc(sizeof(JD)); P-data=10; R-link=P; P-link=S; L S 2 8 3 7 5 ^ R P 10 Evaluation only. Created with Aspose.Slides for .NET 3.5 Client Profile 5.2.0.0. Copyright 2004-2011 Aspose Pty Ltd. (8) T=L; T-link=P-link; free(P); L S 2 8 3 7 ^ P R T 5 (9) S-link=L; L S 2 8 3 7 5 P R 如果 S-link= =L 则S所指向的结点为尾结点. Evaluation only. Created with Aspose.Slides for .NET 3.5 Client Prof

文档评论(0)

1亿VIP精品文档

相关文档