05 2019 档案

摘要:100. Same Tree 100. Same Tree Given two binary trees, write a function to check if they are the same or not. Two binary trees are considered the same 阅读全文
posted @ 2019-05-26 22:14 douzujun 阅读(250) 评论(0) 推荐(0) 编辑
摘要: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 阅读(425) 评论(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 阅读(361) 评论(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 阅读(473) 评论(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 阅读(173) 评论(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 阅读(156) 评论(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 阅读(287) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2019-05-17 00:28 douzujun 阅读(160) 评论(0) 推荐(0) 编辑
摘要:1. 构造函数 2. 析构函数 3. 拷贝构造函数 4. 赋值函数 5. 字符串连接 6. 判断相等和返回长度 7. string声明方式 8. c++字符串和c字符串的转换 9. string和int类型的转换 阅读全文
posted @ 2019-05-10 11:03 douzujun 编辑
摘要:1. 生成了一个线程,需要告诉编译器是否管理 必须告诉编译器是不管理还是管理,否则直接down了 1.1 可以通过join(),自己管理 如果遇到异常,没有调用join,自己可以写一个析构调用join() 1.2 通过detach(),不管理 detach适合不会出错,生命周期比整个程序短,不想管理 阅读全文
posted @ 2019-05-09 23:26 douzujun 阅读(775) 评论(0) 推荐(0) 编辑
摘要:1. 单例模式 类的所有静态变量都必须在类的外部初始化,格式是:类型名 类名::变量名=初始值;而不管它是私有的还是公有的。 阅读全文
posted @ 2019-05-09 20:00 douzujun 阅读(1095) 评论(0) 推荐(0) 编辑
摘要:1. 虚函数使用方法 2. 虚函数的使用 3. 纯虚函数 阅读全文
posted @ 2019-05-09 19:16 douzujun 编辑
只有注册用户登录后才能阅读该文。
posted @ 2019-05-09 17:20 douzujun 编辑
摘要:1. 需求 开发封闭原则:虽然在这个原则是用的面向对象开发,但是也适用于函数式编程,简单来说,它规定已经实现的功能代码不允许被修改,但可以被拓展,即: 封闭:已实现的功能代码块 开发:对拓展开发 2. 使用装饰器 2.1 未使用装饰器(原理) 正在验证权限 f1 2.2 使用装饰器 正在验证权限 f 阅读全文
posted @ 2019-05-08 21:22 douzujun 阅读(756) 评论(0) 推荐(1) 编辑
摘要:1. 闭包 阅读全文
posted @ 2019-05-08 19:56 douzujun 阅读(234) 评论(0) 推荐(0) 编辑
摘要:1. MySQL基本使用 1.1 数据库简介 Mysql: 关系型数据库,做网站 redis:当作缓存 mongodb:非关系型数据库,做爬虫 SQL语句: DQL:数据查询语言,用于对数据进行查询,如select DML:数据操作语言,对数据进行增加、修改、删除,如insert、update、de 阅读全文
posted @ 2019-05-08 13:48 douzujun 阅读(255) 评论(0) 推荐(0) 编辑
摘要:1. 上下文管理器 __enter__()方法返回资源对象,__exit__()方法处理一些清除资源 如:系统资源:文件、数据库链接、Socket等这些资源执行完业务逻辑之后,必须要关闭资源 2. 使用 @contextmanager 阅读全文
posted @ 2019-05-08 13:44 douzujun 阅读(199) 评论(0) 推荐(0) 编辑
摘要:1. 私有属性 名字重整 {'__weakref__': <attribute '__weakref__' of 'Test' objects>, '__init__': <function Test.__init__ at 0x00000000010C59D8>, '__doc__': None, 阅读全文
posted @ 2019-05-08 00:55 douzujun 阅读(655) 评论(0) 推荐(0) 编辑
摘要:1. 安装 2. 简单使用 3. 进阶 待续 阅读全文
posted @ 2019-05-07 20:26 douzujun 阅读(616) 评论(0) 推荐(0) 编辑
摘要:1. property属性 目的:简化逻辑流程 //test2 2. property属性的两种方式 装饰器 即:在方法上应用装饰器 类属性 即:在类中定义值为property对象的类属性 装饰器 即:在方法上应用装饰器 类属性 即:在类中定义值为property对象的类属性 2.1 装饰器方法 在 阅读全文
posted @ 2019-05-07 00:37 douzujun 阅读(367) 评论(0) 推荐(0) 编辑
只有注册用户登录后才能阅读该文。
posted @ 2019-05-06 21:02 douzujun 编辑
摘要:C的代码 打包成动态库之后 a改变了内容,没有改变指向,b改变了内容 更多: https://www.cnblogs.com/gaowengang/p/7919219.html 阅读全文
posted @ 2019-05-06 20:56 douzujun 阅读(1644) 评论(0) 推荐(0) 编辑
摘要:1. 遇到的问题 计算结果不一致!三个线程共享一份资源,有的加了有的没加。 2. 解决 2.1 法一:不共享变量 2.2 法二:原子操作变量类型(复杂,适合简单应用) b,c 线程共享了变量 counter2, 没有共享变量 totalValue,所以totalValue一样,counter2.co 阅读全文
posted @ 2019-05-05 21:09 douzujun 阅读(2991) 评论(0) 推荐(0) 编辑
摘要:1. 简介 2. 线程使用 2.1 demo 2.2 一个简单的应用 查看当前线程id: this_thread::get_id() 比较单线程和多线程工作的效率(如果工作不太消耗时间,多线程反而比单线程更耗时间) 阅读全文
posted @ 2019-05-04 23:52 douzujun 阅读(43333) 评论(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 阅读(808) 评论(0) 推荐(0) 编辑
摘要:1. 简单使用 阅读全文
posted @ 2019-05-03 15:41 douzujun 阅读(328) 评论(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 阅读(442) 评论(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 阅读(544) 评论(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 阅读(2994) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示