摘要: #------面向对象------# (1)什么时候用面向对象 ----答:1.代码量大,功能多。2.处理比较复杂角色之间的关系 #------创建一个对象------# 类名() 实例化 __new__()创造了一个对象的空间,还可以做一些简单的初始化。 #------创建一个类-------# class Leiming 语法级别,Python解释器读到就会创建一个类 type 是所... 阅读全文
posted @ 2018-08-01 21:59 小学弟- 阅读(162) 评论(0) 推荐(0) 编辑
摘要: 算法的核心就在这一句上了:p[i] = min(p[2*id-i], p[id] + id - i); #include #include #include #include #include #include #include #include #include #include #include #include #include using name... 阅读全文
posted @ 2018-08-01 14:04 小学弟- 阅读(129) 评论(0) 推荐(0) 编辑
摘要: Problem Description 给定两个字符串string1和string2,判断string2是否为string1的子串。 Input 输入包含多组数据,每组测试数据包含两行,第一行代表string1(长度小于1000000),第二行代表string2(长度小于1000000),string1和string2中保证不出现空格。 Output 对于每组输入数据,若string2是... 阅读全文
posted @ 2018-08-01 13:59 小学弟- 阅读(147) 评论(0) 推荐(0) 编辑
摘要: 它的优点是:利用字符串的公共前缀来减少查询时间,最大限度地减少无谓的字符串比较,查询效率比哈希树高。 它有3个基本性质: 根节点不包含字符,除根节点外每一个节点都只包含一个字符; 从根节点到某一节点,路径上经过的字符连接起来,为该节点对应的字符串; 每个节点的所有子节点包含的字符都不相同。 #include #include #include using namespace std; ... 阅读全文
posted @ 2018-08-01 13:58 小学弟- 阅读(229) 评论(0) 推荐(0) 编辑
摘要: 1、应尽量避免在 where 子句中使用!=或操作符,否则将引擎放弃使用索引而进行全表扫描。 2、对查询进行优化,应尽量避免全表扫描,首先应考虑在 where 及 order by 涉及的列上建立索引。 3、应尽量避免在 where 子句中对字段进行 null 值判断,否则将导致引擎放弃使用索引而进行全表扫描。如: select id from t where num is null 可... 阅读全文
posted @ 2018-08-01 08:48 小学弟- 阅读(246) 评论(0) 推荐(0) 编辑
摘要: 比如,斐波那契数列:1,1,2,3,5,8,13,21,34.... 用列表生成式写不出来,但是我们可以用函数把它打印出来: def fib(number): n, a, b = 0, 0, 1 while n 注意: ... 阅读全文
posted @ 2018-08-01 08:42 小学弟- 阅读(4813) 评论(0) 推荐(0) 编辑
摘要: class Teacher: OPERATE_DIC = [ ('创建课程', 'create_course'), ('创造学生', 'create_student'), ('创建课程', 'create_course'), ('查看学生信息', 'check_student_info'), ] def _... 阅读全文
posted @ 2018-08-01 08:07 小学弟- 阅读(120) 评论(0) 推荐(0) 编辑