去哪儿网个2014校招笔试题 技术岗实习生
2014-03-29 14:05
253 查看
1、(开发,前端,测试必选)Create a function for searchOrinsertIndex(int[] sortedArray, int givenValue)
the first parameter is asorted array and duplicates in array
the second parameter is a random int
The function return the index if givenValue is found.If not,return the index where it would be if it were insert in order.
Example:
[1,2,3,4,5] , 6 ------------ 5
[1,2,3,4,5] , 1 ------------- 0
[1,2,7,10] , 8 ------------- 3
[1,2,7,10] , 7 ------------- 2
方法:折半查找,代码:
2、(开发必选)有两个文本文件,其中分别存放全校学生的基本信息和考试成绩:
score.txt-------------------------- info.txt-----------------------------------------
学号 学科 成绩 学号 学院 专业 姓名
1001 数据结构 85 1001 计算机学院 软件工程 刘玥
1001 线性代数 89 1002 生物工程 服装设计 孙立
1002 数据库 100 ……
1002 面料工艺 30
……
写一段程序请打印出每个学院每个系里总分第一名的同学的名字,挂科的不算
the first parameter is asorted array and duplicates in array
the second parameter is a random int
The function return the index if givenValue is found.If not,return the index where it would be if it were insert in order.
Example:
[1,2,3,4,5] , 6 ------------ 5
[1,2,3,4,5] , 1 ------------- 0
[1,2,7,10] , 8 ------------- 3
[1,2,7,10] , 7 ------------- 2
方法:折半查找,代码:
static int fun(int[] arr, int value) { int begin = 0; int end = arr.length - 1; while (end - begin >= 1) { int tempIndex = (begin + end) / 2; if (value == arr[tempIndex]) return tempIndex; if (value < arr[tempIndex]) { end = tempIndex; continue; } begin = tempIndex + 1; } if (begin < end) return begin; return end + 1; }
2、(开发必选)有两个文本文件,其中分别存放全校学生的基本信息和考试成绩:
score.txt-------------------------- info.txt-----------------------------------------
学号 学科 成绩 学号 学院 专业 姓名
1001 数据结构 85 1001 计算机学院 软件工程 刘玥
1001 线性代数 89 1002 生物工程 服装设计 孙立
1002 数据库 100 ……
1002 面料工艺 30
……
写一段程序请打印出每个学院每个系里总分第一名的同学的名字,挂科的不算
相关文章推荐
- 【笔试or面试】UC2014实习生招聘笔试题
- 腾讯2014实习生软件开发笔试
- 2014腾讯实习生笔试——蒙特卡洛算法求圆周率
- 2014阿里巴巴WEB前端实习生在线笔试题
- 去哪儿网的实习生笔试
- 阿里巴巴2014实习生前端招聘在线笔试题
- 2014微软实习生笔试题-String reorder
- 迅雷2014校招笔试题之多线程编程
- 百度2014校招笔试题(一)
- 多益网络2014校招的一道笔试题---左旋字符串
- 【收藏】2014各大网络公司校招笔试题
- 2014腾讯校招上海站笔试题
- 2014恒生电子实习生笔试数据库部分
- 【2014微软实习生笔试】1:字符排序
- 阿里巴巴2014校招笔试题
- 腾讯2014实习生笔试题--德梅齐里亚克砝码问题
- 2014校招笔试
- 2014阿里巴巴WEB前端实习生在线笔试题
- 微软2014校招笔试题-String reorder
- 阿里巴巴2014校招笔试题-2013年9月14日