Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

Re:请教高手一个面试题

Posted by zyl072 at 2008-10-23 18:04:05
In Reply To:请教高手一个面试题 Posted by:lastview at 2008-10-23 12:02:55
我觉得只能进行一点优化而已吧?

比如说,A B两个有序的数组,假如存在 (i>j)  A[i]-A[j]=i-j  则说明 A[i]->A[j] 一定是连续的数字段,这个时候一定包含了从A[i]到A[j] 的每一个元素,B数列也是一样.具体用法,目前也只想到用二分的方式来选取以A[i]为起始位置的连续的数字段. 当然这只能是针对一些连续的数字段的优化.在最坏的情况下,效率依然不怎么样~

> 两有序数组,长度分别m,n,求交。
> 
> 求世界上最快算法。比O(m+n)快的。

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator