Vimal
Senior Software
Engineer
Senior Software
Engineer
is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.
CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.
Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.
Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.
How about treating all the pieces of jigsaw as polygons?
- Vimal May 03, 2007Write a function to Combine the polygons which are neighbors of each other.
At the end of program we will have only one polygon and the jigsaw will be solved.
The structure of the jigsaw can be
typedef struct
{
int x;
int y;
}Point;
typedef struct
{
int no_of_vertices;
Point *vertices;
}Polygon;
typedef struct
{
int num_pieces;
Polygon * pieces;
}JigSaw;
the O(n^2) algo can be
main()
{
//Initalise the jigsaw here.
Jigsaw Jig;
while(Jig.num_pieces != 1)
{
Polygon first = Jig.pieces[0];
for(int i=1;i<n;i++)
{
if(AreNeighbors(Jig.pieces[i],Jig.pieces[0])
{
Combine(Jig.pieces[i],Jig.pieces[0],&Jig);
//Combine function will combine the two polygons
//It will also remove the Jig.piece[i] from Jig and
//reduce num_pieces by 1.
// We can use convx hull algo to combine the two polygons.
}
}
}