![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
gfg
文章平均质量分 76
xiaomaolearnCoding
这个作者很懒,什么都没留下…
展开
-
Implement Stack Using Queue
We are given a Queue data structure that supports standard operations like enqueue() and dequeue(). We need to implement a Stack data structure using only instances of Queuethis question is from Gee原创 2015-01-14 03:25:45 · 609 阅读 · 0 评论 -
A data structure for n elements and O(1) operations
GFG上的一道数据结构的题:http://geeksquiz.com/data-structure-n-elements-o1-operations/设计一个数据结构插入删除和查找都是O(1),存储 0 - n-1最初想法是hashtable类似,基于链表,但是查找不可能为O(1), 看了gfg上的讲解才豁然开朗。Solution:就是用一个数组实现,因为要存的数已原创 2015-01-15 14:17:00 · 370 阅读 · 0 评论 -
Find common elements in three sorted arrays
Geeksforgeeeks上的一道题,原文http://www.geeksforgeeks.org/find-common-elements-three-sorted-arrays/iven three arrays sorted in non-decreasing order, print all common elements in these arrays.Exampl原创 2015-01-16 01:47:01 · 488 阅读 · 0 评论 -
Flood fill Algorithm – how to implement fill() in paint?
http://www.geeksforgeeks.org/flood-fill-algorithm-implement-fill-paint/画板fill功能的实现,看描述第一反应是bfs遍历即可,但是这个算法似乎更多用dfs来实现dfs实现:根据gfg上的codepublic static void floodFill(int[][] screen , int x, int原创 2015-01-18 13:06:29 · 784 阅读 · 0 评论 -
Lexicographically minimum string rotation
http://geeksquiz.com/lexicographically-minimum-string-rotation/lexicographically字典序,在文本分析和搜索中有不少应用,比如在查询语句的预处理时,可以通过求得 lexicographic minimum,类似的查询就可以命中缓存,只在排序的时候考虑一下关键词在文档里的距离。gfg上给了一种最基础的做法,就原创 2015-01-17 13:44:48 · 1706 阅读 · 0 评论 -
中序表达式求值
Geeksforgeek上题目 http://geeksquiz.com/program-evaluate-simple-expressions/You are given a string that represent an expression of digits and operands. E.g. 1+2*3, 1-2+4. You need to evaluate the s原创 2015-01-17 06:26:04 · 1113 阅读 · 0 评论