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-22 23:12:13
阅读次数:
426
题目:
Given a sorted (increasing order) array, write an algorithm to create a binary tree with minimal height.
翻译:
给定一个有序数组(递增),写程序构建一棵具有最小高度的二叉树。
思路:
要使二叉树的高度最小,则要尽量使其左右子树的节点数目相当,自然就考虑到将其构造成为二叉排序树,且将有序数组的中间大的数作为根节点,这样得到的二叉树的高度便是最小的。...
分类:
其他好文 时间:
2014-05-01 17:48:45
阅读次数:
321
Merge k Sorted Lists
Total Accepted: 9746 Total
Submissions: 41674My Submissions
Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity....
分类:
其他好文 时间:
2014-05-01 17:11:32
阅读次数:
234
题目: There are two sorted arrays A and B of size m
and n respectively. Find the median of the two sorted arrays. The overall run
time complexity should...
分类:
其他好文 时间:
2014-04-29 10:32:46
阅读次数:
359
description:given two sorted singly list, merge
them into one using constant additional spacealgorithm:we will reference the two
linked list as list1 ...
分类:
其他好文 时间:
2014-04-28 00:32:52
阅读次数:
711