2016年6月12日

LRU Cache

摘要: 这是一道非常高频,非常经典的题目: 首先分析下题意: Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations: get  阅读全文

posted @ 2016-06-12 21:22 Sheryl Wang 阅读(129) 评论(0) 推荐(0) 编辑

Topological Sorting

摘要: 给定一个有向图,图节点的拓扑排序被定义为: 对于每条有向边A--> B,则A必须排在B之前 拓扑排序的第一个节点可以是任何在图中没有其他节点指向它的节点 找到给定图的任一拓扑排序. 拓扑排序一共有两种解法: 1.是kahn’s algorithm 2.DFS的做法(按结束顺序倒过来放入L中) kah 阅读全文

posted @ 2016-06-12 16:34 Sheryl Wang 阅读(211) 评论(0) 推荐(0) 编辑

导航