华为题(斐波那契数列非递归)定义.pdfVIP

  • 3
  • 0
  • 约2.47千字
  • 约 3页
  • 2021-11-11 发布于福建
  • 举报
1. 非递归实现斐波那契数列数列 . 利用栈的操作来实现 #include stdio.h #include string.h #include stdlib.h #define ElemType int #define STACK_INIT_SIZE 100 #define STACKINITSIZE 10 typedefstruct { ElemType *top; ElemType *base; int stack_init_size; }sqStack; void InitStack(sqStack *s) { s-base=(ElemType *)malloc(STACK_INIT_SIZE* sizeof (ElemType)); if (!s-base) exit(0); s-top=s-base; s-stack_init_size=STACK_INIT_SIZE; } void Push(sqStack *s,ElemType e) { if (s-top-s-base=s-stack_

文档评论(0)

1亿VIP精品文档

相关文档