题目Given a string S and a string T, find the minimum window in S which will contain all the characters in T in complexity O(n).For example,
S = “ADOBECODEBANC”
T = “ABC”
Minimum window is “BANC”.Note...
Counting Sort1. Counting Sort doesn't work for negative number.2. Counting Sort assumes that each element is SMALL INTEGER.3. Time Complexity is O(Max...
分类:
其他好文 时间:
2015-02-23 16:40:52
阅读次数:
118
标题:Sort List通过率:21.3%难度:中等Sort a linked list inO(nlogn) time using constant space complexity.本题就是一个排序的问题,但是是针对单向链表去处理,那么问题关键就是怎么去处理链表,时间复杂度为nlogn,所以可以...
分类:
其他好文 时间:
2015-02-16 11:41:43
阅读次数:
146
================== Advice on signed types ================Avoid unnecessary complexity by minimizing your use of unsigned types.Specifically, dong't u...
分类:
其他好文 时间:
2015-02-16 11:33:27
阅读次数:
108
Given an integern, return the number of trailing zeroes inn!.Note:Your solution should be in logarithmic time complexity.Credits:Special thanks to@tsf...
分类:
其他好文 时间:
2015-02-16 06:48:23
阅读次数:
124
Sort a linked list in O(n log n) time using constant space complexity.
可以利用归并排序解决该问题。普通的归并排序算法时间复杂度为O(nlogn),空间复杂度为O(n),因为需要建立两个数组来存储原来数组的值,这两个数组的长度加起来恰好为原数组的长度。但是对于链表可以省去复制两个已经排好序的数组的操作,从而使空间复杂度...
分类:
其他好文 时间:
2015-02-15 23:08:39
阅读次数:
175
欢迎大家阅读参考,如有错误或疑问请留言纠正,谢谢
Merge k Sorted Lists
Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.
//堆可以用来解决这个问题。
//C++的STL中priority_queue,...
分类:
其他好文 时间:
2015-02-15 10:47:40
阅读次数:
134
欢迎大家阅读参考,如有错误或疑问请留言纠正,谢谢
Sort List
Sort a linked list in O(n log n) time using constant space complexity.
// 归并排序法:在动手之前一直觉得空间复杂度为常量不太可能,因为原来使用归并时,都是 O(N)的,需要复制出相等的空间来进行赋值归并。对于链表,实际...
分类:
其他好文 时间:
2015-02-14 17:34:48
阅读次数:
166
喵~不知不觉到了CUDA系列学习第五讲,前几讲中我们主要介绍了基础GPU中的软硬件结构,内存管理,task类型等;这一讲中我们将介绍3个基础的GPU算法:reduce,scan,histogram,它们在并行算法中非常常用,我们在本文中分别就其功能用处,串行与并行实现进行阐述。1. Task complexitytask complexity包括step complexity(可以并行成几个操作)...
分类:
编程语言 时间:
2015-02-13 16:37:05
阅读次数:
294
GitHut网站原文连接:http://githut.info/,其实这是一个非常简单的只有一个页面的网站。做的事情就是去通过GitHub Archive来获取到GitHub代码仓库的大数据然后进行分析,并把Github上用到的各种语言的信息整理出来并呈现给大家。GITHUTGitHut is an attempt to visualize and explore the complexity o...
分类:
编程语言 时间:
2015-02-12 18:34:58
阅读次数:
169