經典電腦科學問題解析:使用Python - 第一章 - 閱讀筆記

Classic Computer Science Problems in Python

經典電腦科學問題解析:使用Python

閱讀補充筆記


第一章:Small problems熱身的小問題

1.1 The Fibonacci sequence

在此介紹了費式數列,除了第一和第二個數字為0及1外,每個數都是前兩數的和。

1.1.3 Memoization to the rescue

在程式碼中運用到了from typing import Dict,typing 是Python 3.5後才新增的模組,為了在自訂函數中增加可讀性。


1.1.4 Automatic memoization

為了減少記憶體空間,使用了LRU演算法,以from functools import lru_cache實現。


1.1.6 Generating Fibonacci numbers with a generator

不透過額外的for迴圈方便將迴圈的運算過程列印出來,使用yield 完成。


留言

這個網誌中的熱門文章

[RPA Starter]Introduction to the UiPath Enterprise Platform

安全框架和控制(Security frameworks and controls)

網路架構(Network architecture)