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-12-19 06:31:06
阅读次数:
202
今天学习了c语言的一些库函数用法。比如:strcpy(),strlen(),strchr(),strcmp(),strcat(),strstr()。下面是我写的一些代码和结果。1.strlen#include<stdio.h>
#include<string.h>
intmain()
{
chara[10]="12345";
printf("%d\n",strlen(a));
system("pause");
r..
分类:
其他好文 时间:
2015-12-18 19:08:24
阅读次数:
174
??
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.peek() -- Get the front element.em...
分类:
其他好文 时间:
2015-12-13 22:01:55
阅读次数:
255
Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations:getandset.get(key)- Get the valu...
分类:
系统相关 时间:
2015-12-12 12:28:53
阅读次数:
171
题目连接https://leetcode.com/problems/implement-strstr/Implement strStr()DescriptionImplement strStr().Returns the index of the first occurrence of needle...
分类:
其他好文 时间:
2015-12-11 22:06:13
阅读次数:
146
题目:Given an Iterator class interface with methods:next()andhasNext(), design and implement a PeekingIterator that support thepeek()operation -- it ess...
分类:
其他好文 时间:
2015-12-11 06:54:13
阅读次数:
155
28、Implement strStr()-------KMP算法(*)题目这道题目其实就是实现KMP算法,并且该算法也是比较经典的算法,需要很好的掌握:贴上几个介绍字符串匹配的算法说明链接http://www.cnblogs.com/Su-30MKK/archive/2012/09/17/2688...
分类:
其他好文 时间:
2015-12-10 21:23:58
阅读次数:
140
题目:Given two 1d vectors, implement an iterator to return their elements alternately.For example, given two 1d vectors:v1 = [1, 2]v2 = [3, 4, 5, 6]By c...
分类:
其他好文 时间:
2015-12-10 13:32:40
阅读次数:
217
https://leetcode.com/problems/implement-stack-using-queues/class Stack {public: queue q1,q2; // Push element x onto stack. void push(int x) {...
分类:
其他好文 时间:
2015-12-08 18:15:48
阅读次数:
113
Implement strStr().Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.Subscribeto see which comp...
分类:
其他好文 时间:
2015-12-07 20:45:06
阅读次数:
202