码迷,mamicode.com
首页 >  
搜索关键字:sorted    ( 5925个结果
[leetcode]Remove Duplicates from Sorted Array
Remove Duplicates from Sorted ArrayGiven a sorted array, remove the duplicates in place such that each element appear onlyonceand return the new lengt...
分类:其他好文   时间:2014-07-22 22:48:14    阅读次数:224
Search Insert Position leetcode java
Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in or...
分类:编程语言   时间:2014-07-22 00:39:35    阅读次数:263
LeetCode "Merge Sorted Array"
My first reaction: move all A elements back by n positions, and start everything from A[0] and B[0]. But a smarter idea is to start everything from th...
分类:其他好文   时间:2014-07-22 00:35:36    阅读次数:189
【leetcode刷题笔记】Search in Rotated Sorted Array II
Follow up for "Search in Rotated Sorted Array":What ifduplicatesare allowed?Would this affect the run-time complexity? How and why?Write a function to...
分类:其他好文   时间:2014-07-22 00:35:34    阅读次数:238
排序算法-冒泡、插入、归并、希尔、快速、选择--代码总结
冒泡排序代码: #include #include using namespace std; template void bubbleSort(ItemType theArray[], int n) { bool sorted = false; // False when swaps occur int pass = 1; while (!sorted && (pass...
分类:其他好文   时间:2014-07-22 00:32:35    阅读次数:363
【leetcode】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-07-22 00:13:35    阅读次数:154
LeetCode :: Convert Sorted Array (link list) to Binary Search Tree [tree]
1.Given an array where elements are sorted in ascending order, convert it to a height balanced BST. 2.Given a singly linked list where elements are sorted in ascending order, convert it to a heig...
分类:其他好文   时间:2014-07-21 23:45:53    阅读次数:264
Search in Rotated Sorted Array leetcode java
题目:Suppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2).You are given a target ....
分类:编程语言   时间:2014-07-21 14:37:05    阅读次数:266
Search for a Range leetcode java
题目: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....
分类:编程语言   时间:2014-07-21 11:14:07    阅读次数:203
LeetCode "Merge Two Sorted Lists"
Simply care about the boundary cases:class Solution {public: ListNode *mergeTwoLists(ListNode *l1, ListNode *l2) { if (l1 && !l2) return l1;...
分类:其他好文   时间:2014-07-21 11:07:04    阅读次数:206
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!