随笔分类 -  hybrid data structure

implement hash table
摘要:Implement hash table https://www.youtube.com/watch?v=shs0KM3wKv8&t=8s https://www.youtube.com/watch?v=KyUTuwz_b7Q https://www.geeksforgeeks.org/implem 阅读全文

posted @ 2018-11-09 11:46 猪猪🐷

457. Circular Array Loop
摘要:457. Circular Array Loop http://www.cnblogs.com/grandyang/p/7658128.html https://www.youtube.com/watch?v=VX2oZkDJeGA 阅读全文

posted @ 2018-11-08 16:27 猪猪🐷

225. 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. to 阅读全文

posted @ 2018-11-06 10:01 猪猪🐷

232. Implement Queue using Stacks
摘要:https://www.youtube.com/watch?v=ma1S6vtkw9I https://www.youtube.com/watch?v=jf0NTM_JS0w Implement the following operations of a queue using stacks. * push(x) -- Push element x to the back of queu... 阅读全文

posted @ 2018-11-06 10:01 猪猪🐷

716. Max Stack
摘要:Design a max stack that supports push, pop, top, peekMax and popMax. 1. push(x) -- Push element x onto stack. 2. pop() -- Remove the element on top of the stack and return it. 3. top() -- Get the el... 阅读全文

posted @ 2018-11-06 10:00 猪猪🐷

460 LFU Cache / O(1)
摘要:Design and implement a data structure for Least Frequently Used (LFU) cache. It should support the following operations: get and put. get(key) - Get the value (will always be positive) of the key if ... 阅读全文

posted @ 2018-11-06 09:59 猪猪🐷

432. All O`one Data Structure
摘要:Implement a data structure supporting the following operations: 1. Inc(Key) - Inserts a new key with value 1. Or increments an existing key by 1. Key is guaranteed to be a non-empty string. 2. Dec(K... 阅读全文

posted @ 2018-11-06 09:58 猪猪🐷

359. Logger Rate Limiter
摘要:Design a logger system that receive stream of messages along with its timestamps, each message should be printed if and only if it is not printed in the last 10 seconds. Given a message and a timesta... 阅读全文

posted @ 2018-11-06 09:58 猪猪🐷

622. Design Circular Queue
摘要:Design your implementation of the circular queue. The circular queue is a linear data structure in which the operations are performed based on FIFO (F 阅读全文

posted @ 2018-08-28 20:53 猪猪🐷

155. Min Stack
摘要:Design a stack that supports push, pop, top, and retrieving the minimum element in constant time. push(x) -- Push element x onto stack. pop() -- Remov 阅读全文

posted @ 2018-08-28 20:06 猪猪🐷

158. Read N Characters Given Read4 II - Call multiple times
摘要:The API: int read4(char *buf) reads 4 characters at a time from a file. The return value is the actual number of characters read. For example, it retu 阅读全文

posted @ 2018-08-17 00:13 猪猪🐷

157. Read N Characters Given Read4
摘要:The API: int read4(char *buf) reads 4 characters at a time from a file. The return value is the actual number of characters read. For example, it retu 阅读全文

posted @ 2018-08-17 00:12 猪猪🐷

170 Two Sum III - Data structure design
摘要:Design and implement a TwoSum class. It should support the following operations: add and find. add - Add the number to an internal data structure.find 阅读全文

posted @ 2018-08-10 15:25 猪猪🐷

146 LRU Cache
摘要:这个题的 node class, constructor, global vars , 怎么写 该注意 几点该注意的: use helper functions, add, and deleteNode, add : add node to the front, deleteNode: delete 阅读全文

posted @ 2018-08-10 15:18 猪猪🐷

381. Insert Delete GetRandom O(1) - Duplicates allowed
摘要:381. Insert Delete GetRandom O(1) - Duplicates allowed Design a data structure that supports all following operations in average O(1) time. Note: Duplicate elements are allowed. 1. insert(val): Ins... 阅读全文

posted @ 2018-08-10 14:44 猪猪🐷

380 Insert Delete GetRandom O(1)
摘要:380 Insert Delete GetRandom O(1) Design a data structure that supports all following operations in average O(1) time. 1. insert(val): Inserts an item val to the set if not already present. 2. remo... 阅读全文

posted @ 2018-08-10 14:41 猪猪🐷

导航