码迷,mamicode.com
首页 >  
搜索关键字:sorted    ( 5925个结果
leetcode Remove Duplicates from Sorted List
Remove Duplicates from Sorted List Given a sorted linked list, delete all duplicates such that each element appear only once. For example, Given 1->1->2, return 1->2. Given 1->1->2->3->3, return 1->2->3. 很简单,先判断第一个位置否为空,不为空的话再判断下 个位置是否为空,如果都为空那么就不用操作了。 如果两...
分类:其他好文   时间:2014-10-05 20:16:08    阅读次数:202
Search for a Range
Given a sorted array of integers, find the starting and ending position of a given target value.Your algorithm's runtime complexity must be in the ord...
分类:其他好文   时间:2014-10-05 17:36:28    阅读次数:213
leetcode - Convert Sorted List to Binary Search Tree
Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST. /** * Definition for singly-linked list. * struct ListNode { * int val; * Lis...
分类:其他好文   时间:2014-10-03 17:21:45    阅读次数:167
HDU - 5008 Boring String Problem (后缀数组+二分+RMQ)
Problem Description In this problem, you are given a string s and q queries. For each query, you should answer that when all distinct substrings of string s were sorted lexicographically, which ...
分类:其他好文   时间:2014-10-03 16:56:54    阅读次数:249
leetcode - Convert Sorted Array to Binary Search Tree
Given an array where elements are sorted in ascending order, convert it to a height balanced BST. /** * Definition for binary tree * struct TreeNode { * int val; * TreeNode *left; * ...
分类:其他好文   时间:2014-10-03 15:40:04    阅读次数:186
Search in Rotated Sorted Array
Suppose a sorted array is rotated at some pivot unknown to you beforehand.ie:0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2you are given a target value to s...
分类:其他好文   时间:2014-10-02 12:50:32    阅读次数:330
Merge k Sorted Lists
[leetcode]Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity....
分类:其他好文   时间:2014-10-02 11:43:22    阅读次数:165
LeetCode: Merge k Sorted Lists
Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity1. Naive Solution思路:直接的想法依次找出列表中的最小项串接起来。 复杂度分析:时间复杂度...
分类:其他好文   时间:2014-10-02 01:18:11    阅读次数:163
LeetCode Convert Sorted List to Binary Search Tree 解题报告
从给定的有序链表生成一颗平衡二叉树。 解题思路:最容易想到的就是利用数组生成二叉树的方法,找到中间节点作为二叉树的root节点,然后分别对左右链表递归调用分别生成左子树和右子树。时间复杂度O(N*lgN)...
分类:其他好文   时间:2014-10-01 23:36:31    阅读次数:243
Remove Duplicates from Sorted Array I&&II
Given a sorted array, remove the duplicates in place such that each element appear onlyonceand return the new length.Do not allocate extra space for a...
分类:其他好文   时间:2014-10-01 19:08:51    阅读次数:163
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!