
2016笔试
周大侠
这个作者很懒,什么都没留下…
展开
-
各种排序算法实现及总结
本文主要比较一下各种排序的性能(平均时间复杂度和最差情况)和基本实现。 这个默认按照从小到大排列,输入的数据可以重复,假设输入的数组为A,下标从0到N-1注意在比较算法复杂度时,我们会关注键值的比较次数和交换次数。1、冒泡排序 冒泡排序如果不是因为名字比较好记,没有任何优势。它的思路是一趟又一趟的比较数组(或者链表也可以)中相邻的两个元素,如果前一个比后一个大,则交换。这样,每一轮之后,最大的那原创 2015-08-21 21:20:18 · 687 阅读 · 0 评论 -
[微软]题目3 : Fibonacci
时间限制:10000ms单点时限:1000ms内存限制:256MB描述Given a sequence {an}, how many non-empty sub-sequence of it is a prefix of fibonacci sequence.A sub-sequence is a sequence that can be derived from another seque原创 2015-09-29 21:26:30 · 703 阅读 · 0 评论 -
[微软]题目4 : Image Encryption
时间限制:10000ms单点时限:1000ms内存限制:256MB描述A fancy square image encryption algorithm works as follow:0. consider the image as an N x N matrix1. choose an integer k∈ {0, 1, 2, 3}2. rotate the square image k原创 2015-09-29 21:27:28 · 864 阅读 · 2 评论 -
[微软]题目1 : Farthest Point
题目1 : Farthest Point时间限制:5000ms单点时限:1000ms内存限制:256MB描述Given a circle on a two-dimentional plane.Output the integral point in or on the boundary of the circle which has the largest distance from th原创 2015-09-29 21:24:20 · 1032 阅读 · 0 评论 -
[微软]题目2 : Total Highway Distance
时间限制:10000ms单点时限:1000ms内存限制:256MB描述Little Hi and Little Ho are playing a construction simulation game. They build N cities (numbered from 1 to N) in the game and connect them by N-1 highways. It is原创 2015-09-29 21:25:48 · 1172 阅读 · 2 评论