Programming abstractions in C阅读笔记:p166-p175

《Programming Abstractions In C》学习第58天,p166-p175总结。

一、技术总结

1.斐波那契数列(Fibonacci Sequenc)

(1)斐波那契数列来源

斐波那契数列来自于《Liber Abaci》一书里兔子繁殖问题,相关资料很多,这里不赘述。

(2)关于《Liber Abaci》一书

《Liber Abaci》——Liber:a book(意思是“书”);Abaci:abacus的复数形式(意思是“算盘”)。

根据Laurence Sigler《Fibonacci’s Liber Abaci: A Translation into Modern English of Leonardo Pisano’s Book of Calculation》一书第9页内容“One should here again make the point, that while derived from the word abacus the word abaci refers in the thirteenth century paradoxically to calculation without the abacus. Thus Liber abaci should not be translated as The Book of the Abacus......”在13世纪, abaci是指直接使用印度数字(Hindu numerals),而不用“算盘”进行计算。所以,这本书恰当的中文译名应该是《计算之书》(The Book of Calculation,注:纪志刚翻译的中文版用的就是这个名字)。

(3)关于“斐波那契”这个名字

既然称为斐波那契数列,那么作者的名字是否叫斐波那契?根据百科说法是:Liber Abaci is a historic 1202 Latin manuscript on arithmetic by Leonardo of Pisa, posthumously known as Fibonacci。Fibonacci是“filius Bonacci”,即“son of Bonacci”(波那契之子)。参考Keith Devlin所著《The Man of Numbers: Fibonacci's Arithmetic Revolution》一书)。

2.递推关系(recurrence realtion)

p173:

tn = tn-1 + tn-2

An expression of this type, in which each element of a sequence is defined in terms of earlier elements, is called a recurrence relation。

3.斐波那契序列的C语言实现

/*
 * File: fib.c
 * -----------
 * This program lists the terms in the Fibonacci sequence with
 * indices ranging from MinIndex to MaxIndex
 */

#include <stdio.h>
#include "genlib.h"

/* Constants */
#define MinIndex 0
#define MaxIndex 12

/* private function prototype */
int Fib(int n);

/* Main program */

int main() {
    int i;

    printf("This program lists the Fibonacci sequence.\n");
    for (i = MinIndex; i < MaxIndex; i++) {
        printf("Fib(%d)", i);
        if (i < 10) { // 打印对齐
            printf(" ");
        }
        printf(" = %4d\n", Fib(i));
    }
    return 0;
}

/*
 * Function: Fib
 * Usage: t = Fib(n)
 * -----------------
 * This function returns the nth term in the Fibonacci sequence
 * using a recursive implementation of the recurrence relation
 *
 * Fib(n) = Fib(n - 1) + Fib(n - 2)
 */

int Fib(int n) {
    if (n < 2) {
        return n;
    } else {
        return (Fib(n - 1) + Fib(n - 2));
    }
}

二、英语总结

1.suspcious什么意思?

答:

(1)suspicious < suspicion:adj. feel doubt or not trust(可疑的)。 语法结构:be suspicious of。

(2)suspicion < suspect:c/u.

(3)suspect: vt. sub-("up to") + *spek-("to observe"),The notion behind the word is "look at secretly," hence, "look at distrustfully"(怀疑)。

2.supersede是什么意思?

答:p168,The frame for Fact temporarily supersedes the frame for Main。vt. super-(above) + *sed-(to sit),即“displace, replace”之意。

3.essence是什么意思?

答:u. the basic or most import quality of sth(本质、核心)。示例:p174, The essence of recursion is to break problems down into simpler ones that can be solved by calls to exactly the same function。形容词格式:essential。之前老是不记得essential是什么意思,这里对比着来记。

三、参考资料

1. 编程

(1)Eric S.Roberts,《Programming Abstractions in C》:https://book.douban.com/subject/2003414

2. 英语

(1)Etymology Dictionary:https://www.etymonline.com

(2) Cambridage Dictionary:https://dictionary.cambridge.org

欢迎搜索及关注:编程人(a_codists)

©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 217,509评论 6 504
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 92,806评论 3 394
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 163,875评论 0 354
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 58,441评论 1 293
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 67,488评论 6 392
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 51,365评论 1 302
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 40,190评论 3 418
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 39,062评论 0 276
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 45,500评论 1 314
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 37,706评论 3 335
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 39,834评论 1 347
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 35,559评论 5 345
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 41,167评论 3 328
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 31,779评论 0 22
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 32,912评论 1 269
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 47,958评论 2 370
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 44,779评论 2 354

推荐阅读更多精彩内容