• 博客园logo
  • 会员
  • 周边
  • 新闻
  • 博问
  • 闪存
  • 众包
  • 赞助商
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
ArgenBarbie
博客园    首页    新随笔    联系   管理    订阅  订阅
04 2016 档案
115. Distinct Subsequences *HARD* -- 字符串不连续匹配

摘要:Given a string S and a string T, count the number of distinct subsequences of T in S. A subsequence of a string is a new string which is formed from t 阅读全文
posted @ 2016-04-30 12:43 ArgenBarbie 阅读(201) 评论(0) 推荐(0)
html中用变量作为django字典的键值

摘要:若字典为dic={'name': Barbie, 'age': 20},则在html中dic.name为Barbie,dic.age为20。 但若字典为dic={'Barbie': 1, 'Roger': 2, 'Kitty': 3},要在html中用变量name表示名字,则不能直接用dic.nam 阅读全文
posted @ 2016-04-28 23:55 ArgenBarbie 阅读(2185) 评论(0) 推荐(0)
331. Verify Preorder Serialization of a Binary Tree -- 判断是否为合法的先序序列

摘要:One way to serialize a binary tree is to use pre-order traversal. When we encounter a non-null node, we record the node's value. If it is a null node, 阅读全文
posted @ 2016-04-21 19:20 ArgenBarbie 阅读(266) 评论(0) 推荐(0)
310. Minimum Height Trees -- 找出无向图中以哪些节点为根,树的深度最小

摘要:For a undirected graph with tree characteristics, we can choose any node as the root. The result graph is then a rooted tree. Among all possible roote 阅读全文
posted @ 2016-04-21 19:04 ArgenBarbie 阅读(411) 评论(0) 推荐(0)
297. Serialize and Deserialize Binary Tree *HARD*

摘要:Serialization is the process of converting a data structure or object into a sequence of bits so that it can be stored in a file or memory buffer, or 阅读全文
posted @ 2016-04-21 17:41 ArgenBarbie 阅读(209) 评论(0) 推荐(0)
235.236. Lowest Common Ancestor of a Binary (Search) Tree -- 最近公共祖先

摘要:235. Lowest Common Ancestor of a Binary Search Tree Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the 阅读全文
posted @ 2016-04-21 16:04 ArgenBarbie 阅读(203) 评论(0) 推荐(0)
222. Count Complete Tree Nodes -- 求完全二叉树节点个数

摘要:Given a complete binary tree, count the number of nodes. Definition of a complete binary tree from Wikipedia:In a complete binary tree every level, ex 阅读全文
posted @ 2016-04-21 15:30 ArgenBarbie 阅读(162) 评论(0) 推荐(0)
208. Implement Trie (Prefix Tree) -- 键树

摘要:Implement a trie with insert, search, and startsWith methods. Note:You may assume that all inputs are consist of lowercase letters a-z. 阅读全文
posted @ 2016-04-21 14:52 ArgenBarbie 阅读(183) 评论(0) 推荐(0)
173. Binary Search Tree Iterator -- 迭代器

摘要:Implement an iterator over a binary search tree (BST). Your iterator will be initialized with the root node of a BST. Calling next() will return the n 阅读全文
posted @ 2016-04-21 13:11 ArgenBarbie 阅读(129) 评论(0) 推荐(0)
124. Binary Tree Maximum Path Sum *HARD* -- 二叉树中节点和最大的路径的节点和

摘要:Given a binary tree, find the maximum path sum. For this problem, a path is defined as any sequence of nodes from some starting node to any node in th 阅读全文
posted @ 2016-04-21 11:15 ArgenBarbie 阅读(176) 评论(0) 推荐(0)
114. Flatten Binary Tree to Linked List -- 将二叉树转成链表(in-place单枝树)

摘要:Given a binary tree, flatten it to a linked list in-place. For example,Given The flattened tree should look like: If you notice carefully in the flatt 阅读全文
posted @ 2016-04-21 10:53 ArgenBarbie 阅读(178) 评论(0) 推荐(0)
108. Convert Sorted Array to Binary Search Tree 109. Convert Sorted List to Binary Search Tree -- 将有序数组或有序链表转成平衡二叉排序树

摘要:108. Convert Sorted Array to Binary Search Tree Given an array where elements are sorted in ascending order, convert it to a height balanced BST. 109. 阅读全文
posted @ 2016-04-21 10:14 ArgenBarbie 阅读(178) 评论(0) 推荐(0)
101. Symmetric Tree -- 判断树结构是否对称

摘要:Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center). For example, this binary tree is symmetric: But the fol 阅读全文
posted @ 2016-04-20 11:10 ArgenBarbie 阅读(452) 评论(0) 推荐(0)
99. Recover Binary Search Tree -- 找到二叉排序树中交换过位置的两个节点

摘要:Two elements of a binary search tree (BST) are swapped by mistake. Recover the tree without changing its structure. Note:A solution using O(n) space i 阅读全文
posted @ 2016-04-20 10:54 ArgenBarbie 阅读(347) 评论(0) 推荐(0)
malloc的实现

摘要:http://blog.jobbole.com/75656/ 原型:void* malloc(size_t size); 功能:在系统中分配一段连续的可用的内存。 要求: malloc分配的内存大小至少为size参数所指定的字节数 malloc的返回值是一个指针,指向一段可用内存的起始地址 多次调用 阅读全文
posted @ 2016-04-20 10:01 ArgenBarbie 阅读(371) 评论(0) 推荐(0)
97. Interleaving String *HARD* -- 判断s3是否为s1和s2交叉得到的字符串

摘要:Given s1, s2, s3, find whether s3 is formed by the interleaving of s1 and s2. For example,Given:s1 = "aabcc",s2 = "dbbca", When s3 = "aadbbcbcac", ret 阅读全文
posted @ 2016-04-20 00:02 ArgenBarbie 阅读(303) 评论(0) 推荐(0)
追寻伯利恒二叉树 -- 不用栈不用递归

摘要:http://www.acmerblog.com/inorder-tree-traversal-without-recursion-and-without-stack-5988.html 用叶子节点的空指针来记录当前节点的位置,然后一旦遍历到了叶子节点,发现叶子节点的右指针指向的是当前节点,那么就认 阅读全文
posted @ 2016-04-19 15:34 ArgenBarbie 阅读(363) 评论(0) 推荐(0)
页表机制

摘要:分页转换功能由驻留在内存中的表来描述,该表称为页表(page table),存放在物理地址空间中。页表可看做简单的220个物理地址数组。线性到物理地址的映射功能可以简单地看做进行数组查找。线性地址的高20位构成这个数组的索引值,用于选择对应页面的物理(基)地址。线性地址的低12位给出了页面中的偏移量 阅读全文
posted @ 2016-04-17 17:09 ArgenBarbie 阅读(7720) 评论(0) 推荐(1)
线性地址到物理地址的映射

摘要:http://book.51cto.com/art/200812/103230.htm 分页机制是80x86内存管理机制的第二部分。它在分段机制的基础上完成虚拟(逻辑)地址到物理地址转换的过程。分段机制把逻辑地址转换成线性地址,而分页则把线性地址转换成物理地址。分页可以用于任何一种分段模型。处理器分 阅读全文
posted @ 2016-04-17 16:28 ArgenBarbie 阅读(1222) 评论(0) 推荐(0)
缓存

摘要:缓存就是数据交换的缓冲区(称作Cache),当某一硬件要读取数据时,会首先从缓存中查找需要的数据,如果找到了则直接执行,找不到的话则从内存中找。由于缓存的运行速度比内存快得多,故缓存的作用就是帮助硬件更快地运行。 缓存是指可以进行高速数据交换的存储器,它先于内存与CPU交换数据,因此速率很快。L1  阅读全文
posted @ 2016-04-17 16:15 ArgenBarbie 阅读(322) 评论(0) 推荐(0)
缓存算法(页面置换算法)-FIFO、LFU、LRU

摘要:1. FIFO -- 先进先出 如果一个数据最先进入缓存中,则应该最早淘汰掉。也就是说,当缓存满的时候,应当把最先进入缓存的数据给淘汰掉。 实现: 利用一个双向链表保存数据,当来了新的数据之后便添加到链表末尾,如果Cache存满数据,则把链表头部数据删除,然后把新的数据添加到链表末尾。在访问数据的时 阅读全文
posted @ 2016-04-17 15:17 ArgenBarbie 阅读(10121) 评论(0) 推荐(0)
数据库分区分表

摘要:http://blog.163.com/zhubinbin0516@126/blog/static/12257726201051735823602/ 一、分区表、分区索引概念 为了满足而非常大的数据库的管理,需要创建和使用分区表和分区索引,分区表允许将数据分成成为分区甚至子分区的更小的、更好管理的块 阅读全文
posted @ 2016-04-17 11:55 ArgenBarbie 阅读(1097) 评论(0) 推荐(0)
SQL向一个表中批量插入&&删除大量数据

摘要:插入: 1. 数据从另一个表中获取 (1)两表结构不一样insert into tb1 需要的列名 select 按照前面写上需要的列名 from tb2(2)两表结构一样insert into tb1 * select * from tb2 2. 数据直接输入 (1) INSERT INTO My 阅读全文
posted @ 2016-04-17 11:32 ArgenBarbie 阅读(3243) 评论(0) 推荐(0)
程序的内存空间 堆空间和栈空间的区别

摘要:一个由C/C++编译的程序占用的内存分为以下几个部分: 1、栈区(stack): 由编译器自动分配释放,其操作方式类似于数据结构的栈。 用于存放函数的参数值,用户程序临时创建的局部变量等,即函数括号"{}"中定义的变量(但不包括static声明的变量,static意味着在数据段中存放变量)。除此之外 阅读全文
posted @ 2016-04-17 10:11 ArgenBarbie 阅读(3361) 评论(0) 推荐(0)
大小端存储

摘要:字节的高位与低位举个例子,int a = 0x12345678 ; 那么左边12就是高位字节,右边的78就是低位字节,从左到右,由高到低,(注意,高低乃相对而言,比如56相对于78是高字节,相对于34是低字节)。 大端模式,是指数据的高字节保存在内存的低地址中,而数据的低字节保存在内存的高地址中,这 阅读全文
posted @ 2016-04-17 09:44 ArgenBarbie 阅读(290) 评论(0) 推荐(0)
管道 && 消息队列 && 共享内存

摘要:http://blog.csdn.net/piaoairy219/article/details/17333691 1. 管道 管道的优点是不需要加锁。 缺点是默认缓冲区太小,只有4K。 一个管道只适合单向通信,如果要双向通信需要建立两个。 只适合父子进程间通信,而且不适合多个子进程,因为消息会乱。 阅读全文
posted @ 2016-04-17 09:08 ArgenBarbie 阅读(402) 评论(0) 推荐(0)
TCP/IP的四元组、五元组、七元组

摘要:四元组是: 源IP地址、目的IP地址、源端口、目的端口 五元组是: 源IP地址、目的IP地址、协议号、源端口、目的端口 七元组是: 源IP地址、目的IP地址、协议号、源端口、目的端口、服务类型、接口索引 阅读全文
posted @ 2016-04-16 23:26 ArgenBarbie 阅读(1403) 评论(0) 推荐(0)
TCP握手及状态图

摘要:为什么需要“三次握手”? 为了解决“网络中存在延迟的重复分组”的问题,即为了防止已失效的连接请求报文段突然又传送到了服务端,因而产生错误。 例:“已失效的连接请求报文段”的产生在这样一种情况下:client发出的第一个连接请求报文段并没有丢失,而是在某个网络结点长时间的滞留了,以致延误到连接释放以后 阅读全文
posted @ 2016-04-16 22:40 ArgenBarbie 阅读(436) 评论(0) 推荐(0)
内部排序算法

摘要:http://blog.csdn.net/xiazdong/article/details/8462393 http://blog.csdn.net/hguisu/article/details/7776068 注:本文中算法实现来自参考网页2,貌似有错误,仅供思路参考! 排序有内部排序和外部排序, 阅读全文
posted @ 2016-04-16 17:28 ArgenBarbie 阅读(834) 评论(0) 推荐(0)
单例模式

摘要:单例模式是一种常用的软件设计模式。在它的核心结构中只包含一个被称为单例的特殊类。通过单例模式可以保证系统中一个类只有一个实例而且该实例易于外界访问,从而方便对实例个数的控制并节约系统资源。如果希望在系统中某个类的对象只能存在一个,单例模式是最好的解决方案。 动机: 对于系统中的某些类来说,只有一个实 阅读全文
posted @ 2016-04-16 15:51 ArgenBarbie 阅读(168) 评论(0) 推荐(0)
static

摘要:http://blog.csdn.net/hackbuteer1/article/details/7487694 C++的static有两种用法:面向过程程序设计中的static和面向对象程序设计中的static。前者应用于普通变量和函数,不涉及类;后者主要说明static在类中的作用。一、面向过程 阅读全文
posted @ 2016-04-16 15:42 ArgenBarbie 阅读(203) 评论(0) 推荐(0)
拷贝构造函数

摘要:http://blog.csdn.net/lwbeyond/article/details/6202256 一. 什么是拷贝构造函数 首先对于普通类型的对象来说,它们之间的复制是很简单的,例如: 而类对象与普通对象不同,类对象内部结构一般较为复杂,存在各种成员变量。下面看一个类对象拷贝的简单例子: 阅读全文
posted @ 2016-04-16 14:54 ArgenBarbie 阅读(180) 评论(0) 推荐(0)
MySql中Blob与Text的区别

摘要:BLOB是一个二进制大对象,可以容纳可变数量的数据。有4种BLOB类型:TINYBLOB、BLOB、MEDIUMBLOB和LONGBLOB。它们只是可容纳值的最大长度不同。 有4种TEXT类型:TINYTEXT、TEXT、MEDIUMTEXT和LONGTEXT。这些对应4种BLOB类型,有相同的最大 阅读全文
posted @ 2016-04-16 11:58 ArgenBarbie 阅读(803) 评论(0) 推荐(0)
唯一索引 && 主键索引

摘要:唯一索引唯一索引不允许两行具有相同的索引值。 如果现有数据中存在重复的键值,则大多数数据库都不允许将新创建的唯一索引与表一起保存。 当新数据将使表中的键值重复时,数据库也拒绝接受此数据。例如,如果在 employee 表中的职员姓氏(lname) 列上创建了唯一索引,则所有职员不能同姓。 主键索引主 阅读全文
posted @ 2016-04-16 11:11 ArgenBarbie 阅读(298) 评论(0) 推荐(0)
部分函数依赖 && 完全函数依赖

摘要:部分函数依赖:若x->y 并且,存在X的真子集x1,使得x1->y,则 y部分依赖于x。 完全函数依赖:若x->y并且,对于x的任何一个真子集x1,都不存在x1->y,则称y完全依赖于x。例子:{a,b}->{c} 同时{a}->{c}或者{b}->{c},则{c}部分依赖于{a,b}。 一般,1: 阅读全文
posted @ 2016-04-16 10:44 ArgenBarbie 阅读(1905) 评论(0) 推荐(0)
范式

摘要:http://blog.csdn.net/famousdt/article/details/6921622 范式:英文名称是 Normal Form,它是英国人 E.F.Codd(关系数据库的老祖宗)在上个世纪70年代提出关系数据库模型后总结出来的,范式是关系数据库理论的基础,也是我们在设计数据库结 阅读全文
posted @ 2016-04-16 10:43 ArgenBarbie 阅读(468) 评论(0) 推荐(0)
BST树、B树、B+树、B*树

摘要:1. BST树 即二叉搜索树: 1.所有非叶子结点至多拥有两个儿子(Left和Right); 2.所有结点存储一个关键字; 3.非叶子结点的左指针指向小于其关键字的子树,右指针指向大于其关键字的子树; 如: B树的搜索,从根结点开始,如果查询的关键字与结点的关键字相等,那么就命中;否则,如果查询关键 阅读全文
posted @ 2016-04-16 10:11 ArgenBarbie 阅读(282) 评论(0) 推荐(0)
哈希表

摘要:http://blog.csdn.net/wangxu_zju_2010/article/details/7489548 Hash 表是使用 O(1) 时间进行数据的插入删除和查找,但是 hash 表不保证表中数据的有序性,这样在 hash 表中查找最大数据或者最小数据的时间是 O(N) 。 1 寻 阅读全文
posted @ 2016-04-16 09:48 ArgenBarbie 阅读(238) 评论(0) 推荐(0)
线段树

摘要:1. 1077 : RMQ问题再临-线段树 http://hihocoder.com/problemset/problem/1077 2. #1078 : 线段树的区间修改(LazyTag) http://hihocoder.com/problemset/problem/1078 3. #1080 阅读全文
posted @ 2016-04-12 16:21 ArgenBarbie 阅读(153) 评论(0) 推荐(0)
最近公共祖先

摘要:1. 离线算法 http://hihocoder.com/problemset/problem/1067 并查集 2. 在线算法 http://hihocoder.com/problemset/problem/1069 最近公共祖先无非就是两点连通路径上高度最小的点 求每个结点所在层数,先序遍历树记 阅读全文
posted @ 2016-04-07 19:21 ArgenBarbie 阅读(310) 评论(0) 推荐(0)
93. Restore IP Addresses

摘要:Given a string containing only digits, restore it by returning all possible valid IP address combinations. For example:Given "25525511135", return ["2 阅读全文
posted @ 2016-04-06 14:40 ArgenBarbie 阅读(139) 评论(0) 推荐(0)
92. Reverse Linked List II

摘要:Reverse a linked list from position m to n. Do it in-place and in one-pass. For example:Given 1->2->3->4->5->NULL, m = 2 and n = 4, return 1->4->3->2- 阅读全文
posted @ 2016-04-04 23:18 ArgenBarbie 阅读(117) 评论(0) 推荐(0)
阿里巴巴 内推 面试

摘要:1. 第一个面试官貌似是个产品经理。 先是让我照着简历把所有内容具体讲了一遍,然后又在问细节。 看了我手机上的玩嗨。问我什么时候加入,是否从一开始参与编程。 问了哈佛项目用Python具体做了哪些事情,把简历上写的都解释了一遍。 多线程。 软件开发周期(需求分析,系统设计,软件开发,测试(单元测试, 阅读全文
posted @ 2016-04-03 10:29 ArgenBarbie 阅读(605) 评论(0) 推荐(0)
hulu

摘要:一、 一开始因为没收到含有共享文档链接的邮件,所以简单自我介绍,聊了几句项目。问了: 1. 玩嗨如果数据库结构变化要怎么办 2. 哈佛项目是否为官方渠道 一直没收到邮件,面试官读网址给我,进到共享文档界面。 共享文档编程: 1. 单链表的快速排序 我先求了长度,他说不用求长度。 第一个元素为枢轴,然 阅读全文
posted @ 2016-04-03 10:15 ArgenBarbie 阅读(306) 评论(0) 推荐(0)

博客园  ©  2004-2026
浙公网安备 33010602011771号 浙ICP备2021040463号-3