計概-程式問題 - 考試
By Faithe
at 2013-06-17T14:14
at 2013-06-17T14:14
Table of Contents
[考題]95年關務計算機概要
若以下列遞迴函式計算 Count(4)時,最多有多少個 Count()的
活動記錄(activation records)會同時存在?
int Count (int x)
{
if (x == 0)
return (1);
else if (x == 1) return (0);
else
{
int a = Count (x – 1);
int b = Count (x – 2);
return (a+b);
}
}
請問一下這題要如何判斷??
我只計算出Count()會被呼叫9次!!
但是要知道同時存在在活動紀錄內的Count()有幾個就卡住了!!
麻煩知道的大大說明一下!!感謝><....
--
若以下列遞迴函式計算 Count(4)時,最多有多少個 Count()的
活動記錄(activation records)會同時存在?
int Count (int x)
{
if (x == 0)
return (1);
else if (x == 1) return (0);
else
{
int a = Count (x – 1);
int b = Count (x – 2);
return (a+b);
}
}
請問一下這題要如何判斷??
我只計算出Count()會被呼叫9次!!
但是要知道同時存在在活動紀錄內的Count()有幾個就卡住了!!
麻煩知道的大大說明一下!!感謝><....
--
Tags:
考試
All Comments
By Jake
at 2013-06-17T23:54
at 2013-06-17T23:54
By Bennie
at 2013-06-22T17:34
at 2013-06-22T17:34
By Xanthe
at 2013-06-27T09:36
at 2013-06-27T09:36
By Leila
at 2013-06-27T18:21
at 2013-06-27T18:21
Related Posts
今年三等警特
By Kristin
at 2013-06-17T13:25
at 2013-06-17T13:25
有人收到台電雇員的准考證嗎?
By Oliver
at 2013-06-17T13:09
at 2013-06-17T13:09
關於刑事簡易程序的救濟
By Liam
at 2013-06-17T13:03
at 2013-06-17T13:03
鐵佐養路工程
By Heather
at 2013-06-17T12:48
at 2013-06-17T12:48
鐵佐養路工程
By Belly
at 2013-06-17T12:32
at 2013-06-17T12:32