Amazon Interview Question for SDE-2s


Country: India




Comment hidden because of low score. Click to expand.
2
of 2 vote

R-trees are tree data structures used for spatial access methods, i.e., for indexing multi-dimensional information such as geographical coordinates, rectangles or polygons.

- Atul12 March 04, 2016 | Flag Reply
Comment hidden because of low score. Click to expand.
1
of 1 vote

like below to find the nearest node in binary tree, similar could be done to get the nearest location between to point (x,y) in tree and (x1,y1) the point you are looking from. use some vector algebra.

tree* findNearestNumnew(tree* root, int num){
	tree* cur = root;
	tree* minnode = NULL;
	int diff = INT_MAX;
	while (cur != NULL){
		if (diff > abs(cur->data - num)){
			diff = abs(cur->data - num);
			minnode = cur;
		}
		cur = (num < cur->data) ? cur->left : cur->right;
	}
	return minnode;
}

- praveen pandit March 06, 2016 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

R-trees are tree data structures used for spatial access methods, i.e., for indexing multi-dimensional information such as geographical coordinates, rectangles or polygons.

- atul1015 March 04, 2016 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

k-d binary tree are the suitable data structure to keep the geographical co-ordinates in k-dimensional plane. where k is 2,3.....n. for k=1 we have generic binary tree data structure.

- praveen pandit March 06, 2016 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

@praveen.In kd trees we can easily search a particular location(x,y). But could u please explain how to search nearest 10 locations?

- Ash.taunk3 March 06, 2016 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

@praveen.In kd trees we can easily search a particular location(x,y). But could u please explain how to search nearest 10 locations?

- Ash.taunk3 March 06, 2016 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

@praveen.
Yes it is easy to search a particular location(x,y) in K-d tree.(say k=2)
But could you please explain how to find nearest 10 locations from a particular location (x,y) ?

- ash.taunk3 March 06, 2016 | Flag Reply
Comment hidden because of low score. Click to expand.
-2
of 2 vote

integer, integer and integer. It is the best way to store their location info.

- Rocky Sharma March 04, 2016 | Flag Reply
Comment hidden because of low score. Click to expand.


Add a Comment
Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More

Videos

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.

Learn More

Resume Review

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.

Learn More

Mock Interviews

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.

Learn More