码迷,mamicode.com
首页 >  
搜索关键字:merge k sorted lists    ( 11722个结果
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
排序算法-冒泡、插入、归并、希尔、快速、选择--代码总结
冒泡排序代码: #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
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
LeetCode:Remove Duplicates from Sorted List
Given a sorted linked list, delete all duplicates such that each element appear onlyonce.For example,Given1->1->2, return1->2.Given1->1->2->3->3, retu...
分类:其他好文   时间:2014-07-21 09:08:29    阅读次数:209
Convert Sorted Array to Binary Search Tree
/** * Definition for binary tree * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; ...
分类:其他好文   时间:2014-07-21 00:11:12    阅读次数:254
STL 源码剖析 算法 stl_algo.h -- inplace_merge
inplace_merge(应用于有序区间) -------------------------------------------------------------------- 描述:如果两个连接在一起的序列[first, middle)和 [middle, last]都已排序, 那么 inplace_merge 可将它们结合成单一一个序列,并仍有序。 源码: template inline void inplace_merge(Bidi...
分类:其他好文   时间:2014-07-20 23:27:42    阅读次数:368
poj1094Sorting It All Out
题目链接: 啊哈哈,选我 题目: Sorting It All Out Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 26897   Accepted: 9281 Description An ascending sorted s...
分类:其他好文   时间:2014-07-20 23:22:58    阅读次数:301
STL 源码剖析 算法 stl_algo.h -- merge sort
merge sort ---------------------------------------------------------------------- 描述:归并排序 思路: 1.将区间对半分割 2.对左、右段分别排序 3.利用inplace_merge将左、右段合并成为一个完整的有序序列 复杂度:O(log n) 源码: template void mergesort(BidirectionalIter first, Bidirecti...
分类:其他好文   时间:2014-07-20 23:05:52    阅读次数:245
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!