资源简介
python版 算法基础第五版 Foundation Of Algorithms 各章节代码,以及课后习题代码 各章节(1-11章)的代码基本上都有。习题只有写代码的有参考答案。证明没有,个人做的。如有错误欢迎纠正。本书图灵出版社翻译的错误不少,建议对照原英文版观看。

代码片段和文件信息
# -*- coding: utf-8 -*-
“““
Created on Thu Jan 3 22:47:27 2019
@author: lenovo
“““
‘‘‘
def wen(ab):
c=1
def shi(de):
jie = c
print(jie)
c+=1
print(jie)
shi(44)
wen(33)
‘‘‘
import itertools
import numpy as np
# 算法 3.11
# 1 生成不包含v1的集合
def make_set(v): # 输入不包含v1的矩阵
long_v = len(v)
subset = []
for i in range(1 long_v+1):
subset.extend(itertools.combinations(v i))
return [list(i) for i in subset]
def k_subset(k n s): # 包含k个顶点的所有子集
return s[bin2(nk-1):bin2(n k)]
def edge(w): # 给一个无向连通矩阵返回非递减的边信息
n = np.shape(w)[0]
edge_list = []
for i in range(n-1):
for j in range(1 n-1):
if i+j < n:
edge_list.append((w[i][i+j] i+1 i+j+1))
edge_list.sort()
return edge_list
s = [1 3 2 4]
def merges(low mid high):
q = [0]*(high - low + 1)
i j k = low mid+1 0
while (i <= mid) & (j <= high):
if s[i] < s[j]:
q[k] = s[i]
i += 1
else:
q[k] = s[j]
j += 1
k += 1
if i == mid+1:
q[k:] = s[j:high+1]
else:
q[k:] = s[i:mid+1]
s[low:high+1] = q
return s
if __name__ == ‘__main__‘:
v = [2 3 4 5]
# print(make_set(v))
# w = np.array([[0 1 3 20 20] [1 0 3 6 20] [3 3 0 4 2] [20 6 4 0 5] [20 20 2 5 0]])
# print(edge(w))
print(merges(013))
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2019-01-19 13:46 Foundations_Of_Algorithms\
目录 0 2019-01-19 13:46 Foundations_Of_Algorithms\.idea\
目录 0 2019-01-08 18:57 Foundations_Of_Algorithms\.idea\dictionaries\
文件 151 2019-01-08 18:57 Foundations_Of_Algorithms\.idea\dictionaries\lenovo.xm
文件 764 2019-01-15 16:56 Foundations_Of_Algorithms\.idea\Foundations_Of_Algorithms.iml
目录 0 2019-01-01 16:16 Foundations_Of_Algorithms\.idea\inspectionProfiles\
文件 294 2019-01-01 16:04 Foundations_Of_Algorithms\.idea\misc.xm
文件 309 2019-01-01 16:04 Foundations_Of_Algorithms\.idea\modules.xm
文件 239 2019-01-13 19:24 Foundations_Of_Algorithms\.idea\other.xm
文件 54437 2019-01-19 13:46 Foundations_Of_Algorithms\.idea\workspace.xm
目录 0 2019-01-19 13:40 Foundations_Of_Algorithms\bin_search_tree\
文件 4793 2019-01-16 20:49 Foundations_Of_Algorithms\bin_search_tree\bin_search_tree.py
文件 9155 2019-01-19 13:40 Foundations_Of_Algorithms\bin_search_tree\B_tree.py
文件 79 2019-01-16 16:20 Foundations_Of_Algorithms\bin_search_tree\__init__.py
目录 0 2019-01-17 15:17 Foundations_Of_Algorithms\bin_search_tree\__pycache__\
文件 2805 2019-01-17 15:17 Foundations_Of_Algorithms\bin_search_tree\__pycache__\bin_search_tree.cpython-36.pyc
文件 195 2019-01-16 18:52 Foundations_Of_Algorithms\bin_search_tree\__pycache__\__init__.cpython-36.pyc
文件 1609 2019-01-14 16:09 Foundations_Of_Algorithms\ceshi.py
目录 0 2019-01-11 18:34 Foundations_Of_Algorithms\chapter1\
目录 0 2019-01-17 21:50 Foundations_Of_Algorithms\chapter10\
文件 0 2019-01-17 21:50 Foundations_Of_Algorithms\chapter10\nothing
目录 0 2019-01-18 10:50 Foundations_Of_Algorithms\chapter11\
文件 1364 2019-01-18 10:05 Foundations_Of_Algorithms\chapter11\chapter11.py
文件 313 2019-01-18 10:50 Foundations_Of_Algorithms\chapter11\work11.py
文件 3272 2018-12-28 00:19 Foundations_Of_Algorithms\chapter1\chapter1.py
文件 6828 2019-01-02 14:07 Foundations_Of_Algorithms\chapter1\work1.py
目录 0 2019-01-11 18:39 Foundations_Of_Algorithms\chapter2\
文件 5564 2019-01-02 14:13 Foundations_Of_Algorithms\chapter2\chapter2.py
文件 15992 2019-01-04 20:47 Foundations_Of_Algorithms\chapter2\work2.py
目录 0 2019-01-16 20:31 Foundations_Of_Algorithms\chapter3\
文件 3160 2019-01-16 20:31 Foundations_Of_Algorithms\chapter3\binary_search_tree.py
............此处省略30个文件信息
相关资源
- 二级考试python试题12套(包括选择题和
- pywin32_python3.6_64位
- python+ selenium教程
- PycURL(Windows7/Win32)Python2.7安装包 P
- 英文原版-Scientific Computing with Python
- 7.图像风格迁移 基于深度学习 pyt
- 基于Python的学生管理系统
- A Byte of Python(简明Python教程)(第
- Python实例174946
- Python 人脸识别
- Python 人事管理系统
- 基于python-flask的个人博客系统
- 计算机视觉应用开发流程
- python 调用sftp断点续传文件
- python socket游戏
- 基于Python爬虫爬取天气预报信息
- python函数编程和讲解
- Python开发的个人博客
- 基于python的三层神经网络模型搭建
- python实现自动操作windows应用
- python人脸识别(opencv)
- python 绘图(方形、线条、圆形)
- python疫情卡UN管控
- python 连连看小游戏源码
- 基于PyQt5的视频播放器设计
- KNN算法实战
- 一个简单的python爬虫
- csv文件行列转换python实现代码
- Python操作Mysql教程手册
- Python Machine Learning Case Studies
评论
共有 条评论