Given a graph (any type - Directed acyclic graph or undirected graphs with loops), find a minimal set of vertices which affect all the edges of the graph.
An edge is affected if the edge is either originating or terminating from that vertex.
You have 8*8 square grid with left-bottom and right-top squares removed. (thus there are only 62 squares remaining in the grid). You are given 31 tiles each of 2*1. You have to put the tiles on the grid without breaking any of the tiles (so that all squares of the grid are covered). How will you do that?
Hint: It is impossible to do that, prove :)
Generalize the result for 2n*2n grid. What is the case with (2n+1)*(2n+1) grid and (2n)*(2m+1) grid?
given a triangle ABC, how would you use only a compass and a straight edge to find a point P such that triangles ABP, ACP & BCP have equal perimeters?(Assume that ABC is constructed so that a solution does exist)
#
Say we have a data structure as follows:
enum {RED,BLUE,GREEN};
struct Ball
{
/*...*/
int color;
};
int ColorOfBall(Ball b)
{
return b.color;
}
Ball arr[SIZE];
The array arr consists of balls of with one of the three colours
(Red,Green,Blue). Now we need to sort the array in such a way that all
the Red coloured balls come first, followed by blue and then green.
The restriction is that call to function ColorOfBall is a very costly
operation. You have to use it as less as possible. (In other words we
would be looking for the solution with least number of calls to the
function ColorOfBall.)
There is an array A[N] of N numbers. You have to compose an array Output[N] such that Output[i] will be equal to multiplication of all the elements of A[N] except A[i]. For example Output[0] will be multiplication of A[1] to A[N-1] and Output[1] will be multiplication of A[0] and from A[2] to A[N-1].
Solve it without division operator and in O(n).