Give a sorted array of $n$ elements, what is the minimum number of comparisons needed to check whether a certain element occurs more than half of the time?
Details and Assumptions
No auxiliary data structure is allowed.
Which line of this implementation of a queue should be changed in order to obtain a stack?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 

Find the sum of all the prime numbers less than 1000 that are 1 more than a perfect square.
For example, 2 is a prime that is 1 more than the perfect square 1.