摘要: reference: http://www.eecs.yorku.ca/course_archive/2013-14/W/2011/lectures/09%20Loop%20Invariants%20and%20Binary%20Search.pdf 阅读全文
posted @ 2015-07-14 17:31 Hygeia 阅读(109) 评论(0) 推荐(0) 编辑
摘要: 题目: Given an integer array of size n, find all elements that appear more than ⌊ n/3 ⌋ times. The algorithm should run in linear time and in O(1) space 阅读全文
posted @ 2015-07-14 15:36 Hygeia 阅读(152) 评论(0) 推荐(0) 编辑
摘要: 题目:Given an array of sizen, find the majority element. The majority element is the element that appears more than⌊ n/2 ⌋times.You may assume that the ... 阅读全文
posted @ 2015-07-14 13:43 Hygeia 阅读(144) 评论(0) 推荐(0) 编辑