LeetCode 之 Pow(x, n),本文给出基于分治算法思想分析与二分实现表达式,最后,贴上C++详细源码实现。...
分类:
其他好文 时间:
2015-08-04 09:29:41
阅读次数:
166
4.5 Implement a function to check if a binary tree is a binary search tree.LeetCode上的原理,请参见我之前的博客Validate Binary Search Tree 验证二叉搜索树。
分类:
其他好文 时间:
2015-08-04 00:37:06
阅读次数:
97
Implement Queue using Stacks
Implement the following operations of a queue using stacks.
push(x) -- Push element x to the back of queue.pop() -- Removes the element from in front of queue.pe...
分类:
其他好文 时间:
2015-08-03 19:14:35
阅读次数:
133
Implement Stack using Queues
Implement the following operations of a stack using queues.
push(x) -- Push element x onto stack.pop() -- Removes the element on top of the stack.top() -- ...
分类:
其他好文 时间:
2015-08-03 19:13:06
阅读次数:
150
题目:Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers.If such arrangement is not poss...
分类:
编程语言 时间:
2015-08-03 16:46:51
阅读次数:
165
Implement an iterator over a binary search tree (BST). Your iterator will be initialized with the root node of a BST.Callingnext()will return the next...
分类:
其他好文 时间:
2015-08-03 13:01:20
阅读次数:
116
//自定义一个字符串字串查找标准库函数strstr()#include#includechar* myStrstr(char *str1,char *str2);int main(){ char *str1 = "hello worl world ld"; char *str2 = ...
分类:
编程语言 时间:
2015-08-02 23:11:37
阅读次数:
208
Implement the following operations of a stack using queues.push(x) -- Push element x onto stack.pop() -- Removes the element on top of the stack.top()...
分类:
其他好文 时间:
2015-08-02 21:24:47
阅读次数:
121
Implement a trie with insert, search,
and startsWith methods.
Note:
You may assume that all inputs are consist of lowercase letters a-z.
基本思路,
作一个26叉树。
本来想作一个27叉,用额外一叉,表示字符串的结束字符('\0'). 但...
分类:
其他好文 时间:
2015-08-02 20:06:06
阅读次数:
138
题目:
Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations: get and set.
get(key) - Get the value (will always be positive) of th...
分类:
系统相关 时间:
2015-08-02 16:52:50
阅读次数:
212