Reverse a linked list

Write a program to reverse a linkedlist.

All Strings of N bits


Write a program to print All Strings of N bits:
E.g; for n = 3 -- > 000 100 010 ... 111.

Find the repeated element

Given n elements find all the elements that appear morethan n/2 times.
Solve the same for elements appear n/4 times.

Should not use more than const memory and O(n) time.

Prime pairs

Pairs of primes separated by a single number are called prime pairs.
Examples are 17 and 19.
Prove that the number between a prime pair is always divisible by 6 (assuming both numbers in the pair are greater than 6).

Sort the array with 0s and 1s

You are given an Array of N size. It contains 0s and 1s only. You have to arrange all 0s before all 1s and you are not allowed to travel more than once through the array.

Find a cycle in a linked list..

How would you find a cycle in a linked list?

Store all receiving samples..

Given that you are receiving samples from an instrument at a constant rate, and you have constant storage space, how would you design a storage algorithm that would allow me to get a representative readout of data, no matter when I looked at it? In other words, representative of the behavior of the system to date.

Multiply by 7..

Multiple by 8 without using multiplication or addition. Now do the same with 7.

Count number of 1s..

Count the number of set bits in a number. Now optimize for speed. Now optimize for size.

Circular linked list..

Implement an algorithm to insert a node into a circular linked list without traversing it.