Hi,
 Can you tell me how to solve the following 2 problems

Problem 1
Given a number (>5) print the prime closest to it.If there are 2
numbers that are closest,print the larger one.

Input
The first line contains the number of test cases

Each test case will contain a number

Output
Output the nearest prime

Example
Input:
2
14
99
Output:
13
101


Problem 4
Determine the height of the Binary Search Tree
that can be formed from the given sequence (this permutation)

Input
The first line contains the number of test cases n

Each test case will contain two lines.
The first line contains the number of integers in the sequence.
The next line contains the sequence of numbers separated by spaces.

Output
Output the height

Example
Input:
1
7

5 3 7 2 4 6 8
Output:
2 


Regards
Terry
http://groups.google.co.in/group/iopc-solutions/


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/algogeeks
-~----------~----~----~----~------~----~------~--~---

Reply via email to