Problem Definition:Implement strStr().Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.Solutio...
分类:
其他好文 时间:
2015-07-24 22:07:26
阅读次数:
83
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 the key if the...
分类:
系统相关 时间:
2015-07-24 18:31:55
阅读次数:
126
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-07-24 17:57:34
阅读次数:
180
源码:https://github.com/cheesezhe/Coursera-Machine-Learning-Exercise/tree/master/ex5Introduction:In this exercise, you will implement regularized linear...
分类:
系统相关 时间:
2015-07-24 15:40:53
阅读次数:
468
就是简单的用strstr函数对字符串进行处理。另解:暴力(就是用strstr函数对字符串进行处理)另解:暴力(普通的字符串处理 。关键是strstr函数):#include#includestruct Bing{ char name[210]; int num;}bing[510];st...
分类:
其他好文 时间:
2015-07-23 21:44:48
阅读次数:
131
参考:algorithm LRU, how many bits needed for implement this algorithm?问题:在cpu缓存中使用的LRU替换算法需要多少位呢?解决方法:
对于n路相连的缓存来说,LRU每个缓存块需要的位数为log2(n),那么每个set需要的位数就为n*log2(n)。(原文:Assuming you mean a 4-way set-associa...
分类:
编程语言 时间:
2015-07-23 17:57:11
阅读次数:
505
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-07-23 13:42:34
阅读次数:
106
1 import java.util.*; 2 3 //docs about generic version of class: https://docs.oracle.com/javase/tutorial/java/generics/types.html 4 public class...
分类:
其他好文 时间:
2015-07-23 06:47:27
阅读次数:
156
2.7 Implement a function to check if a linked list is a palindrome.LeetCode上的原题,参见我之前的博客Palindrome Linked List 回文链表。
分类:
其他好文 时间:
2015-07-22 22:22:58
阅读次数:
108
Implement Stack using QueuesTotal Accepted:9609Total Submissions:31710My SubmissionsQuestionSolutionImplement the following operations of a stack usin...
分类:
其他好文 时间:
2015-07-22 18:19:15
阅读次数:
90