| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1168 人关注过本帖
标题:一道国外教材的算法题
只看楼主 加入收藏
sdnd2000
Rank: 1
等 级:新手上路
帖 子:24
专家分:0
注 册:2008-4-10
收藏
 问题点数:0 回复次数:2 
一道国外教材的算法题
Given an array A[0..n-1] and a small constant k. Suppose that array A at the beginning is " nearly sorted" such that for every element A[i] at most k elements to the left of A[i] are greater than A[i]. We define such a sequence to be k-near-sorted. For example the following sequence is 2-near-sorted:
[8,1,2,7,3,4,5,6]

a. Write an efficient algorithm for completely sorting an array A which is k-near-sorted.
b. What is the time complexity of the algorithm in terms of n and k.
c. illustrate the algorithm for the sequence below, where k=2.
[8,1,2,7,3,4,5,6]
题目是说的什么意思啊,我都没看明白
搜索更多相关主题的帖子: 教材 算法 国外 
2008-04-13 11:00
sdnd2000
Rank: 1
等 级:新手上路
帖 子:24
专家分:0
注 册:2008-4-10
收藏
得分:0 
刚才才读明白,给大家翻一下,大家也帮忙看看怎么做的
k-near-sorted是一个已经基本有序数列,每个元素的左侧最多有k个元素比该元素大,
1 给出有效算法对该k-near-sorted数列排序
2 对于给定的n,k计算时间复杂度
3 用你的算法解释下面的序列,k=2
2008-04-13 12:17
sdnd2000
Rank: 1
等 级:新手上路
帖 子:24
专家分:0
注 册:2008-4-10
收藏
得分:0 
没人会吗....
2008-04-13 21:34
快速回复:一道国外教材的算法题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.021738 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved