上一页 1 ··· 7 8 9 10 11 12 13 14 15 ··· 26 下一页
摘要: 108. Convert Sorted Array to Binary Search Tree 108. Convert Sorted Array to Binary Search Tree Given an array where elements are sorted in ascending 阅读全文
posted @ 2019-05-26 18:34 douzujun 阅读(420) 评论(0) 推荐(0) 编辑
摘要: 538. Convert BST to Greater Tree 538. Convert BST to Greater Tree Given a Binary Search Tree (BST), convert it to a Greater Tree such that every key o 阅读全文
posted @ 2019-05-26 13:03 douzujun 阅读(358) 评论(0) 推荐(0) 编辑
摘要: 993. Cousins in Binary Tree 993. Cousins in Binary Tree In a binary tree, the root node is at depth 0, and children of each depth knode are at depth k 阅读全文
posted @ 2019-05-25 16:17 douzujun 阅读(472) 评论(0) 推荐(0) 编辑
摘要: 637. Average of Levels in Binary Tree 637. Average of Levels in Binary Tree Given a non-empty binary tree, return the average value of the nodes on ea 阅读全文
posted @ 2019-05-21 14:53 douzujun 阅读(171) 评论(0) 推荐(0) 编辑
摘要: 965. Univalued Binary Tree 965. Univalued Binary Tree A binary tree is univalued if every node in the tree has the same value. Return true if and only 阅读全文
posted @ 2019-05-19 13:30 douzujun 阅读(154) 评论(0) 推荐(0) 编辑
摘要: 938. Range Sum of BST Given the root node of a binary search tree, return the sum of values of all nodes with value between L and R (inclusive). The b 阅读全文
posted @ 2019-05-19 13:05 douzujun 阅读(284) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2019-05-17 00:28 douzujun 阅读(156) 评论(0) 推荐(0) 编辑
摘要: 1. 生成了一个线程,需要告诉编译器是否管理 必须告诉编译器是不管理还是管理,否则直接down了 1.1 可以通过join(),自己管理 如果遇到异常,没有调用join,自己可以写一个析构调用join() 1.2 通过detach(),不管理 detach适合不会出错,生命周期比整个程序短,不想管理 阅读全文
posted @ 2019-05-09 23:26 douzujun 阅读(772) 评论(0) 推荐(0) 编辑
摘要: 1. 单例模式 类的所有静态变量都必须在类的外部初始化,格式是:类型名 类名::变量名=初始值;而不管它是私有的还是公有的。 阅读全文
posted @ 2019-05-09 20:00 douzujun 阅读(1089) 评论(0) 推荐(0) 编辑
摘要: 1. 需求 开发封闭原则:虽然在这个原则是用的面向对象开发,但是也适用于函数式编程,简单来说,它规定已经实现的功能代码不允许被修改,但可以被拓展,即: 封闭:已实现的功能代码块 开发:对拓展开发 2. 使用装饰器 2.1 未使用装饰器(原理) 正在验证权限 f1 2.2 使用装饰器 正在验证权限 f 阅读全文
posted @ 2019-05-08 21:22 douzujun 阅读(750) 评论(0) 推荐(1) 编辑
摘要: 1. 闭包 阅读全文
posted @ 2019-05-08 19:56 douzujun 阅读(232) 评论(0) 推荐(0) 编辑
摘要: 1. MySQL基本使用 1.1 数据库简介 Mysql: 关系型数据库,做网站 redis:当作缓存 mongodb:非关系型数据库,做爬虫 SQL语句: DQL:数据查询语言,用于对数据进行查询,如select DML:数据操作语言,对数据进行增加、修改、删除,如insert、update、de 阅读全文
posted @ 2019-05-08 13:48 douzujun 阅读(251) 评论(0) 推荐(0) 编辑
摘要: 1. 上下文管理器 __enter__()方法返回资源对象,__exit__()方法处理一些清除资源 如:系统资源:文件、数据库链接、Socket等这些资源执行完业务逻辑之后,必须要关闭资源 2. 使用 @contextmanager 阅读全文
posted @ 2019-05-08 13:44 douzujun 阅读(196) 评论(0) 推荐(0) 编辑
摘要: 1. 私有属性 名字重整 {'__weakref__': <attribute '__weakref__' of 'Test' objects>, '__init__': <function Test.__init__ at 0x00000000010C59D8>, '__doc__': None, 阅读全文
posted @ 2019-05-08 00:55 douzujun 阅读(646) 评论(0) 推荐(0) 编辑
摘要: 1. 安装 2. 简单使用 3. 进阶 待续 阅读全文
posted @ 2019-05-07 20:26 douzujun 阅读(607) 评论(0) 推荐(0) 编辑
摘要: 1. property属性 目的:简化逻辑流程 //test2 2. property属性的两种方式 装饰器 即:在方法上应用装饰器 类属性 即:在类中定义值为property对象的类属性 装饰器 即:在方法上应用装饰器 类属性 即:在类中定义值为property对象的类属性 2.1 装饰器方法 在 阅读全文
posted @ 2019-05-07 00:37 douzujun 阅读(347) 评论(0) 推荐(0) 编辑
摘要: C的代码 打包成动态库之后 a改变了内容,没有改变指向,b改变了内容 更多: https://www.cnblogs.com/gaowengang/p/7919219.html 阅读全文
posted @ 2019-05-06 20:56 douzujun 阅读(1605) 评论(0) 推荐(0) 编辑
摘要: 1. 遇到的问题 计算结果不一致!三个线程共享一份资源,有的加了有的没加。 2. 解决 2.1 法一:不共享变量 2.2 法二:原子操作变量类型(复杂,适合简单应用) b,c 线程共享了变量 counter2, 没有共享变量 totalValue,所以totalValue一样,counter2.co 阅读全文
posted @ 2019-05-05 21:09 douzujun 阅读(2979) 评论(0) 推荐(0) 编辑
摘要: 1. 简介 2. 线程使用 2.1 demo 2.2 一个简单的应用 查看当前线程id: this_thread::get_id() 比较单线程和多线程工作的效率(如果工作不太消耗时间,多线程反而比单线程更耗时间) 阅读全文
posted @ 2019-05-04 23:52 douzujun 阅读(43263) 评论(4) 推荐(1) 编辑
摘要: 1. 简介 1. 序列式容器: array, vector, deque, list, forward_list 数组 或者 指针实现 2. 关联容器: set, map, multiset, multimap 二叉树 红黑树 O(logn)3. 无顺序容器: unordered_map, unor 阅读全文
posted @ 2019-05-03 17:05 douzujun 阅读(798) 评论(0) 推荐(0) 编辑
摘要: 1. 简单使用 阅读全文
posted @ 2019-05-03 15:41 douzujun 阅读(324) 评论(0) 推荐(0) 编辑
摘要: 1. 不要自己手动管理资源 2. 一个裸指针不要用两个shared_ptr管理,unique_ptr 3. 使用shared_ptr作为函数的接口,如果有可能用 const shared_ptr&的形式 4. shared_ptr weak_ptr和裸指针相比,会大很多,并且效率上会有影响,尤其在多 阅读全文
posted @ 2019-05-02 23:56 douzujun 阅读(436) 评论(0) 推荐(0) 编辑
摘要: 1. 几种智能指针 1. auto_ptr: c++11中推荐不使用他(放弃) 2. shared_ptr: 拥有共享对象所有权语义的智能指针 3. unique_ptr: 拥有独有对象所有权语义的智能指针 4. weaked_ptr: 到 std::shared_ptr 所管理对象的弱引用 1.1 阅读全文
posted @ 2019-05-02 21:40 douzujun 阅读(528) 评论(0) 推荐(0) 编辑
摘要: 1. 几种智能指针 1. auto_ptr: c++11中推荐不使用他(放弃) 2. shared_ptr: 拥有共享对象所有权语义的智能指针 3. unique_ptr: 拥有独有对象所有权语义的智能指针 4. weaked_ptr: 到 std::shared_ptr 所管理对象的弱引用 1.1 阅读全文
posted @ 2019-05-02 20:58 douzujun 阅读(2872) 评论(0) 推荐(0) 编辑
摘要: 参考学习:https://www.cnblogs.com/xuelisheng/p/9339924.html 1. 回调函数定义 回调函数就是一个通过函数指针调用的函数。 如果你把 函数的指针(地址)作为参数传递给另一个函数,当这个指针被用来调用其所指向的函数时,我们就说这是回调函数。 回调函数不是 阅读全文
posted @ 2019-04-30 19:52 douzujun 阅读(1334) 评论(0) 推荐(0) 编辑
摘要: 1. 几种智能指针 1. auto_ptr: c++11中推荐不使用他(放弃) 2. shared_ptr: 拥有共享对象所有权语义的智能指针 3. unique_ptr: 拥有独有对象所有权语义的智能指针 4. weaked_ptr: 到 std::shared_ptr 所管理对象的弱引用 1.1 阅读全文
posted @ 2019-04-29 23:55 douzujun 阅读(1113) 评论(0) 推荐(0) 编辑
摘要: 参考:https://www.cnblogs.com/cly-blog/p/5980546.html 阅读全文
posted @ 2019-04-29 23:31 douzujun 阅读(1357) 评论(0) 推荐(1) 编辑
摘要: 1. auto推断变量类型 2. auto遍历 3. 自定义类可使用auto 阅读全文
posted @ 2019-04-29 22:17 douzujun 阅读(180) 评论(0) 推荐(0) 编辑
摘要: 1. 在构造函数和析构函数中调用的虚函数并不具备虚函数的特性 因为基类的构造函数先构造, 析构函数后析构 阅读全文
posted @ 2019-04-29 19:41 douzujun 阅读(268) 评论(0) 推荐(0) 编辑
摘要: 1. 类属性、实例属性 类属性在内存中只保存一份 实例属性在每个对象中都要保持一份 obj.__class__.country="xxx": 可以修改类属性 2. 实例方法、静态方法和类方法 实例方法:由对象调用;至少一个self参数;执行实例方法时,自动将调用该方法的对象赋值给 self;(pyt 阅读全文
posted @ 2019-04-29 00:06 douzujun 阅读(297) 评论(0) 推荐(0) 编辑
上一页 1 ··· 7 8 9 10 11 12 13 14 15 ··· 26 下一页