首页 > 其他分享 >Programming abstractions in C阅读笔记:p166-p175

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

时间:2023-10-08 10:00:16浏览次数:48  
标签:斐波 abstractions int Liber Programming p166 Fib Fibonacci 那契

《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)

标签:斐波,abstractions,int,Liber,Programming,p166,Fib,Fibonacci,那契
From: https://www.cnblogs.com/codists/p/17748207.html

相关文章

  • 2022 China Collegiate Programming Contest (CCPC) Mianyang Onsite
    2022ChinaCollegiateProgrammingContest(CCPC)MianyangOnsiteC.CatchYouCatchMe解题思路:站在距离出口最近的点等深度深的蝴蝶飞上来即可。时间复杂度:\(O(n)\)代码:#include<bits/stdc++.h>usingnamespacestd;usingll=longlong;voidsolve(){ intn......
  • 2022 China Collegiate Programming Contest (CCPC) Weihai Site EAJGCI
    2022ChinaCollegiateProgrammingContest(CCPC)WeihaiSite目录2022ChinaCollegiateProgrammingContest(CCPC)WeihaiSiteVP概况E-PythonWillbeFasterthanC++A-DunaiJ-Eat,Sleep,RepeatG-Grade2C-GrassI-DragonBloodlineVP概况这场我一年......
  • 2017 China Collegiate Programming Contest Final (CCPC-Final 2017)
    Preface今天打学校统一要求的这场CCPC2017Final,直接被打爆了,各种数学题搞得人生活不能自理主要是H徐神开场就秒出了正确的思路,然后一心认准高斯消元然后一直想+写+调到结束都没卡过去比赛最后20min的时候祁神想到了更好写的基于施密特正交化的方法,可以碍于时间有限没调出来不......
  • C++模板元编程(C++ template metaprogramming)
    实验平台:Win7,VS2013Community,GCC4.8.3(在线版) 所谓元编程就是编写直接生成或操纵程序的程序,C++模板给C++语言提供了元编程的能力,模板使C++编程变得异常灵活,能实现很多高级动态语言才有的特性(语法上可能比较丑陋,一些历史原因见下文)。普通用户对C++模板的使用可能不是很......
  • 2022 China Collegiate Programming Contest (CCPC) Weihai Site
    PrefaceVP到自己学校出的题了可海星,不得不说学长们出的题比起昨天VP的CCPC2022广州做起来要舒服地多这场前面写题都很顺基本都是一发过,中期的medium也没怎么卡思路和卡机子,一道一道地慢慢出最后一个小时徐神RushF可惜没Rush出来,然后我和祁神坐在下面把B的做法给搞出来了,但不知......
  • 2022 China Collegiate Programming Contest (CCPC) Guangzhou Onsite
    Preface好难啊这场广州站,不愧是5题金4题铜的超恶劣站,中档题普遍难度较高但我感觉主要原因还是题目出的太偏向于DP了,AI是本质差不多的树上换根DP,M又是个数位DP,导致像我这种不擅长DP的人直接中期坐牢但好在祁神大力切出了medium~hard的K题,然后最后一小时我把一直在想的A题丢给徐......
  • Sublime txt - CompetitiveProgrammingParser配置
    官网依赖环境:python3浏览器插件:CompetitiveCompanionSublmieText插件:FastOlympicCoding配置打开浏览器的扩展找到扩展CompetitiveCompanion点击详情信息找到并点击扩展选项在Customports填入12345打开SublimeText在首选项......
  • 2022 China Collegiate Programming Contest (CCPC) Mianyang Onsite
    Preface久违地VP一场,由于CCPC桂林在即因此最近就自主VP一下去年的CCPC这场打的时候全队不在状态,签完到后我就因为A题一个cornercase没考虑到卡了快两个小时然后好不容易搞过去徐神上来有狂WAE题,最后也是喜提+11后面写的D题也是需要特判,好家伙又是快到比赛结束才看出来最后......
  • Gym 104270 The 2018 ICPC Asia Qingdao Regional Programming Contest (The 1st Univ
    A.SequenceandSequenceB.KawaExam可以发现,对答案会产生影响的只有割边,把所有边双缩起来,然后就是一个森林。考虑一个树的时候怎么做,就是对于每条边求出这条边两端的众数个数,考虑线段树合并,每次动态维护子树内的众数和子树外的众数。#include<iostream>#include<cstdio>......
  • 2022 China Collegiate Programming Contest (CCPC) Mianyang Onsite GCHMAD
    2022ChinaCollegiateProgrammingContest(CCPC)MianyangOnsite目录2022ChinaCollegiateProgrammingContest(CCPC)MianyangOnsiteVP情况G-LetThemEatCakeC-CatchYouCatchMeH-LifeisHardandUndecidable,but...M-Rock-Paper-ScissorsPyramidA-......