码迷,mamicode.com
首页 >  
搜索关键字:complexity    ( 1097个结果
删除链表中的重复元素:不留&留一个
不留: [抄题]: 给定一个排序链表,删除所有重复的元素只留下原链表中没有重复的元素。 [思维问题]: [一句话思路]: [输入量]:空: 正常情况:特大:特小:程序里处理到的特殊情况:异常情况(不合法不合理的输入): [画图]: [一刷]: [总结]: [复杂度]:Time complexity: ...
分类:其他好文   时间:2017-12-22 22:51:34    阅读次数:117
【LeetCode】Search in Rotated Sorted Array II
Follow up for "Search in Rotated Sorted Array":What if duplicates are allowed?Would this affect the run-time complexity? How and why?Write a function ...
分类:其他好文   时间:2017-12-13 11:34:37    阅读次数:145
LeetCode-------merge-k-sorted-lists
题目: Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity. 题意:合并k个有序链表,分析和描述它的时间复杂度。 代码过来: 上面就是我对这道题的解析,其实 ...
分类:其他好文   时间:2017-12-11 21:11:05    阅读次数:141
LeetCode------sort-list
题目: Sort a linked list in O(n log n) time using constant space complexity. 题意:对一个单链表进行排序操作,要求时间复杂度为 O(n log n),看到这里很明显想到的是归并排序,直接上代码: 这道题解决起来并不难,在其中的难 ...
分类:其他好文   时间:2017-12-11 20:05:48    阅读次数:119
Leetcode version 2
148. Sort List 题目:Sort a linked list in O(n log n) time using constant space complexity. 题意:排序链表 思路I:merge sort 复杂度分析:时间复杂度O(nlgn),空间复杂度O(1) 1 /** 2 * ...
分类:其他好文   时间:2017-12-11 16:13:37    阅读次数:148
Paint House II
Time Complexity: O(N*K), Space Complexity: O(1) The idea is similar to the problem Paint House I, for each house and each color, the minimum cost of p ...
分类:其他好文   时间:2017-11-30 13:37:47    阅读次数:184
算法题 求时间复杂度
//题目:输入一个已经按升序排序过的数组和一个数字,在数组中查找两个数,使得它们的和正好是输入的那个数字。要求时间复杂度是O(n)。考虑多对同时满足的情况例如输入数组1、2、4、7、11、15和数字15。由于4+11=15,因此输出4和11。代码function time_complexity($a ...
分类:编程语言   时间:2017-11-13 23:04:14    阅读次数:190
LeetCode解题笔记 - 4. Median of Two Sorted Arrays
There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity sh ...
分类:其他好文   时间:2017-11-11 17:40:11    阅读次数:81
Leetcode 76: Minimum Window Substring
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 = "ADOBECOD ...
分类:Windows程序   时间:2017-11-11 11:29:22    阅读次数:227
Optimal Account Balancing
Backtracking: time complexity O(N!) Use HashMap to store the initial debts of each person, negative means the person sends money to others, positive m ...
分类:其他好文   时间:2017-11-08 13:17:47    阅读次数:231
1097条   上一页 1 ... 13 14 15 16 17 ... 110 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!