- 博客(32)
- 资源 (2)
- 收藏
- 关注
原创 《数据结构》(C语言版)——串的定长顺序存储表示
/* run this program using the console pauser or add your own getch, system("pause") or input loop */// 用到的库文件#include <stdio.h> // printf(); scanf()#include <stdlib.h> // exit()#incl...
2018-04-05 17:16:34
2525
原创 《数据结构》(C语言版)——循环队列――――队列的顺序存储结构
/* run this program using the console pauser or add your own getch, system("pause") or input loop */// 用到的库文件#include <stdio.h> // printf();scanf()#include <stdlib.h> // exit()#includ...
2018-03-20 17:38:18
946
原创 《数据结构》(C语言版)——单链队列――――队列的链式存储结构
/* run this program using the console pauser or add your own getch, system("pause") or input loop */// 用到的库文件#include <stdio.h> // printf();scanf()#include <stdlib.h> // exit()#includ...
2018-03-20 16:39:23
880
原创 《数据结构》(C语言版)——栈的应用举例-表达式求值
/* run this program using the console pauser or add your own getch, system("pause") or input loop */// 用到的库文件#include <stdio.h> // printf();scanf()#include <stdlib.h> // exit()#includ...
2018-03-19 22:24:40
7233
3
原创 《数据结构》(C语言版)——栈的应用举例-迷宫求解
/* run this program using the console pauser or add your own getch, system("pause") or input loop */// 用到的库文件#include <stdio.h> // printf();scanf()#include <stdlib.h> // exit()#includ...
2018-03-07 22:14:32
1215
原创 《数据结构》(C语言版)——栈的应用举例
/* run this program using the console pauser or add your own getch, system("pause") or input loop */// 用到的库文件#include <stdio.h> // printf();scanf()#include <stdlib.h> // exit()#includ...
2018-03-07 17:27:16
4130
原创 《数据结构》(C语言版)——栈的链式表示
/* run this program using the console pauser or add your own getch, system("pause") or input loop */// 用到的库文件#include <stdio.h> // printf();scanf()#include <stdlib.h> // exit()#includ...
2018-02-24 11:24:17
541
原创 《数据结构》(C语言版)——线性表的静态单链表存储结构
/* run this program using the console pauser or add your own getch, system("pause") or input loop *///用到的库文件#include <stdio.h> //printf();scanf()#include <stdlib.h> //exit()#include &...
2018-02-20 23:15:46
654
原创 《数据结构》(C语言版)——栈的顺序存储表示
/* run this program using the console pauser or add your own getch, system("pause") or input loop */// 用到的库文件#include <stdio.h> // printf();scanf()#include <stdlib.h> // exit()#includ...
2018-02-18 22:27:14
636
原创 《数据结构》(C语言版)——双向链表
/* run this program using the console pauser or add your own getch, system("pause") or input loop */// 用到的库文件#include <stdio.h> // printf();scanf()#include <stdlib.h> // exit()#includ...
2018-02-12 16:25:41
447
原创 《数据结构》(C语言版)——循环链表
/* run this program using the console pauser or add your own getch, system("pause") or input loop */// 用到的库文件#include <stdio.h> // printf();scanf()#include <stdlib.h> // exit()#includ...
2018-02-09 14:51:25
422
原创 《数据结构》(C语言版)——线性表的动态分配顺序存储结构
//P21 线性表的 顺序表示和实现//函数结果状态代码#define TRUE 1#define FALSE 0#define OK 1#define ERROR 0#define INFEASIBLE -1#define OVERFLOW -2//Status是函数的类型,其值是函数结果状态代码typedef int Status;//用到的库文件#include /
2018-01-26 17:25:23
8555
4
原创 《数据结构》(C语言版)——线性表的单链表存储结构
/* run this program using the console pauser or add your own getch, system("pause") or input loop *///用到的库文件#include //printf() ;scanf()#include //exit()#include //malloc()#include //srand((u
2018-01-26 17:19:53
2772
原创 Python基础教程代码与注释P103 6.5 作用域 P105 6.6 递归
# -*- coding: cp936 -*-#P103 6.5 作用域 # vars函数返回 变量和所对应的值所形成的“不可见”的字典。称为 命名空间 或者 作用域x = 1; scope = vars()print scope['x'], scope['x'] + 1 # 函数调用时会创建一个新的作用域def foo(): x = 42 #局部变量 loca
2018-01-20 17:12:25
304
原创 Python基础教程代码与注释P92 6.4 参数魔法
# -*- coding: cp936 -*-#P92 6.4 参数魔法 6.4.2 我能改变参数吗def try_to_change(n): n = 'Mr. Gumby' #局部作用域(local scope)name = 'Mr. Entity'try_to_change(name)print name # 列表作参数时,发生变化def change(n):
2018-01-18 22:45:24
557
原创 Python基础教程代码与注释P89 6.1 懒惰即美德 P90 6.3 创建函数
# -*- coding: cp936 -*-#P89 6.1 懒惰即美德 # 输出菲波那契数列前10个数字fibs = [0, 1]for i in range(8): fibs.append(fibs[-2] + fibs[-1])print fibs # 动态输出fibs = [0, 1]num = input('How many Fibonacci nu
2018-01-18 16:34:11
329
原创 Python基础教程代码与注释P82 5.6 列表推导式——轻量级循环
# -*- coding: cp936 -*-#P82 5.6 列表推导式——轻量级循环print [x*x for x in range(10)] #0~9的平方print [x*x for x in range(10) if x % 3 == 0] #0~9的平方数中能被3整除的数print [(x, y) for x in range(3) for y in range(3)]
2018-01-16 20:08:51
297
原创 Python基础教程代码与注释P77 5.5 循环
# -*- coding: cp936 -*-#P77 5.5 循环#5.5.1 while循环x = 1while x <= 100: print x x += 1name = ''while not name: name = raw_input('Please enter your name:')print 'Hello, %s!' % name#5
2018-01-16 20:07:19
419
原创 Python基础教程代码与注释P69 5.4 条件和条件语句
# -*- coding: cp936 -*-#P69 5.4 条件和条件语句#5.4.1 这就是布尔变量的作用print Trueprint Falseprint True == 1print False == 0print True + False +42print bool('I think, theretore I am')print bool(42)# False N
2018-01-16 20:06:15
244
原创 Python基础教程代码与注释P67 5.2 赋值魔法
# -*- coding: cp936 -*-#P67 5.2 赋值魔法#5.2.1 序列解包x, y, z = 1, 2, 3 #多个赋值操作print x, y, zx, y = y, x #交换两个变量值print x, y, z#序列解包(递归解包):将多个值的序列解开,放到变量的序列中。values = 1, 2, 3print valuesx,
2018-01-16 18:41:21
251
原创 Python基础教程代码与注释P65 5.1 print和import的更多信息
# -*- coding: cp936 -*-#P65 5.1 print和import的更多信息#5.1.1 使用逗号输出print 'Age:', 42 #多个表达式,用逗号隔开name = 'Gumby'salutation = 'Mr.'greeting = 'Hello,'print greeting, salutation, nameprint greeting
2018-01-15 20:30:52
227
原创 Python基础教程代码与注释P55 4.1 字典的使用 4.2.1 dict函数 4.2.3 字典的格式化字符串 4.2.3 字典的格式化字符串
# -*- coding: cp936 -*-#P55 4.1 字典的使用#假定有一个列表如下names = ['Alice', 'Beth', 'Cecil', 'Dee-Dee', 'Earl']#人名列表#对应的分机电话号码如下numbers = ['2341', '9102', '3158', '0142', '5551'] #分机电话号码,应表示为数字字符串#index 从
2018-01-15 20:02:11
255
原创 Python基础教程代码与注释P46 3.3 字符串格式化:完整版 3.4 字符串方法
# -*- coding: cp936 -*-#P46 3.3 字符串格式化:完整版#元组中的每一个元素单独格式化,每个值需要一个对应的转换说明符print '%s plus %s equals %s' % (1, 1, 2)#print '%s plus %s equals %s' % 1, 1, 2 #Lacks parentheses缺少括号#3.3.1 简单转换print '
2018-01-15 18:56:19
306
原创 Python基础教程代码与注释P44 3.1 基本字符串操作 3.2 字符串格式化:精简版
# -*- coding: cp936 -*-#P44 3.1 基本字符串操作#标准序列操作(索引、分片、乘法、判断成员资格、求长度、取最小值和最大值)适用于字符串website = 'http://www.python.org'website[-3:] = 'com' #字符串不可变,非法操作raw_input("Press ")# -*- coding: cp936 -*-#P
2018-01-13 20:37:15
254
原创 在虚拟机VMware Workstation中如何安装多分卷ISO的操作系统
昨天在安装CentOS时,在安装过程中遇到这个问题,后经多次试验,可按以下步骤进行解决:1.不关闭正在安装出现上述图片中问题的系统,鼠标单击摘要视图,再编辑虚拟机设置。2.鼠标单击Hardware——CD/DVD(IDE)——Connected——Use ISO image file:——Browse。注意在此步骤中,一定要把Device status里的Connected
2018-01-13 20:09:37
3113
原创 Python基础教程代码与注释P41 2.4 元组:不可变序列
# -*- coding: cp936 -*-#P41 2.4 元组:不可变序列print 1, 2, 3 #仅用逗号分隔print (1, 2, 3) #圆括号括起来print () #空元组print #42, #仅一个值的元组print (42,) #仅一个值的元组print 3*(40+2)print 3*(
2018-01-10 22:58:20
173
原创 Python基础教程代码与注释P36 2.3 列表 2.3.3 列表方法
# -*- coding: cp936 -*-#P34 2.3 列表 2.3.3 列表方法lst = [1, 2, 3]lst.append(4) #append 在列表末尾追加新的对象print lstprint ['to', 'be', 'or', 'not', 'to', 'be'].count('to')x = [[1, 2], 1, 1, [2, 1, [1, 2]]
2018-01-10 22:57:11
358
原创 Python基础教程代码与注释P34 2.3 列表 2.3.1 list函数 2.3.2 基本的列表操作
# -*- coding: cp936 -*-#P34 2.3 列表 2.3.1 list函数print list('hello') #根据字符串创建列表#''.join(list)#P34 2.3 列表 2.3.2 基本的列表操作x = [1, 1, 1]x[1] = 2 #元素赋值 使用索引标记为某个特定的、位置明确的元素赋值print xnames
2018-01-07 22:05:59
210
原创 Python基础教程代码与注释P27 2.2 通用序列操作
# -*- coding: cp936 -*-#P27 2.2 通用序列操作 2.2.1 索引#根据给定的年月日以数字形式打印出日期months = [ #序列 'January', #索引为0 'February', #索引为1 'March', #... 'April', 'May', 'June', 'July',
2018-01-07 19:36:38
437
原创 Python基础教程代码与注释P26 2.1 序列概览
# -*- coding: cp936 -*-#Python包含6种内建的序列:列表、元组、字符串、Unicode字符串、buffer对象、xrange对象#列表可以修改,元组则不能。#用序列表示数据库中一个人的信息edward = ['Edward Gumby', 42]john = ['John Smith', 42]database = [edward,john]print
2018-01-07 19:34:53
195
原创 Python基础教程代码与注释P22 1.11.5 长字符串、原始字符串和Unicode
# -*- coding: cp936 -*-#1.长字符串 跨多行 ''' """print '''This is a very long string.It continues here.Adn it's not over yet."Hello,world!"Still here.'''# 普通字符串 用反斜线\跨多行print "Hello, \world!"#2.原始字
2018-01-05 20:02:37
308
原创 Python基础教程代码与注释helloworld
#感觉所有编程语言都是输出Hello,world!,突然想到了一个笑话:本人文采有限,就Ctrl+c和Ctrl+v了。#某程序员退休后决定练习书法,于是重金购买文房四宝。一日,饭后突生雅兴,一番研墨拟纸,并点上上好檀香。定神片刻,泼墨挥毫,郑重地写下一行字:hello world!print 'Hello,world!'name = raw_input("What is your na
2018-01-05 17:08:36
469
C语言程序设计 谭浩强著 2000年1月第1版 全书代码 加个人注释
2018-01-05
C语言程序设计 谭浩强著 2000年1月第1版 第6至第12章源代码 加个人注释
2018-01-05
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人