文件名称:fk
介绍说明--下载内容均来自于网络,请自行研究使用
1.分别写出下列函数的递归算法和迭代算法,并求出n=10时的函数值。
Fib(n)= n 当n=0或n=1
Fib(n-2)+Fib(n-1) 当n³ 2
2. 假设以带头结点的循环链表表示队列,并且只设一个指针指向队尾元素结点而不设头指针,试编写相应的队列初始化、入队列、出队列和判断队列状态的算法。
利用上述算法完成下面的各操作,并在每一操作后输出队列状态。
1)下列元素逐一入队:5,7,3,8,55 状态:5个元素
2)3个元素出队 状态:2个元素
3)再2个元素出队 状态:队空
4)再1个元素出队 状态:队空(指示下溢)-1, respectively, to write the following function recursive algorithms and iterative algorithms and function values obtained when n = 10. Fib (n) = n when n = 0 or n = 1 fib (n-2)+Fib (n-1) when n2 2. Assumed to take the lead in the circular list of the node that queue, and set a pointer to a team only tail element nodes without head pointer, try to write the queue initialization into the queue, a queue and to determine queue status algorithm. Using the algorithm described above to complete the following operations, after each operation, the output queue status. 1) each of the following elements into the team: 5,7,3,8,55 status: 2) three elements of the five elements dequeue state: 3) two elements dequeue state of two elements: team empty 4) and then 1 elements dequeue status: Team empty (indicating underflow)
Fib(n)= n 当n=0或n=1
Fib(n-2)+Fib(n-1) 当n³ 2
2. 假设以带头结点的循环链表表示队列,并且只设一个指针指向队尾元素结点而不设头指针,试编写相应的队列初始化、入队列、出队列和判断队列状态的算法。
利用上述算法完成下面的各操作,并在每一操作后输出队列状态。
1)下列元素逐一入队:5,7,3,8,55 状态:5个元素
2)3个元素出队 状态:2个元素
3)再2个元素出队 状态:队空
4)再1个元素出队 状态:队空(指示下溢)-1, respectively, to write the following function recursive algorithms and iterative algorithms and function values obtained when n = 10. Fib (n) = n when n = 0 or n = 1 fib (n-2)+Fib (n-1) when n2 2. Assumed to take the lead in the circular list of the node that queue, and set a pointer to a team only tail element nodes without head pointer, try to write the queue initialization into the queue, a queue and to determine queue status algorithm. Using the algorithm described above to complete the following operations, after each operation, the output queue status. 1) each of the following elements into the team: 5,7,3,8,55 status: 2) three elements of the five elements dequeue state: 3) two elements dequeue state of two elements: team empty 4) and then 1 elements dequeue status: Team empty (indicating underflow)
(系统自动生成,下载前可以参看下载内容)
下载文件列表
实验一1陈道远2罗传炜\~$班级.doc
....................\上机作业1递归.c
....................\上机作业2.c
....................\作业1迭代.c
实验一1陈道远2罗传炜
....................\班级.doc