Ebay Interview Report
- 0of 0 votes
AnswersGiven a binary tree with each node having a pointer to its parent, Write a function that can find the immediate right neighbor of a given node. Don't use BFS.
- JSDUDE June 27, 2013 in United States
Node* RightNeighbor(Node* node)
Note: Root of the tree is not given| Report Duplicate | Flag | PURGE
Ebay SDE1 Trees and Graphs - 0of 0 votes
AnswersThere is a file on a server. There are 3 access levels to this file: 1. Read\Write 2 Read 3. No access.
- JSDUDE June 27, 2013 in United States
A person can: 1. Copy a file. 2. Edit it on the server 3. Overwrite the existing file on the server
Write all the test cases for this scenario| Report Duplicate | Flag | PURGE
Ebay SDE1 test - 0of 0 votes
AnswersWrite a function to calculate the nth prime number:
- JSDUDE June 27, 2013 in United States
N = 0; Prime#: 2
N=1; Prim#: 3
What is the complexity of this alogirthm| Report Duplicate | Flag | PURGE
Ebay SDE1 Math & Computation - 1of 1 vote
AnswerFormula for nth PI is (-1^n)/(2n+1). Write an efficient way to calculate this.
- JSDUDE June 27, 2013 in United States
After i wrote a recursive and iterative solution, she wanted a faster solution. So i went to threading.
Eventually she said that if the value of n is a million and you can't have million threads how will you distribute:
Problem is as n increases the above computation becomes time consuming and hence cannot be simply split in ranges.
She hinted me towards: Queue of jobs, threads picking jobs and en-queuing the work| Report Duplicate | Flag | PURGE
Ebay SDE1 Math & Computation Threads - 0of 0 votes
AnswersYou are given a 2D array that is your sea. It has more than one ships which don't overlap each other. All ships are not necessarily of the same size.
- JSDUDE June 27, 2013 in United States
You are to improve on performance and space is no concern.
Write a program that takes in two co-ordinates:
If the attack co-ordinates did not have a ship, print "Missed"
If the attack co-ordinates have a ship, print "Attacked Ship <Name>"
If the attack co-ordinates have a the same part of the attacked ship, print "Already Attacked"
If the last piece of the un-attacked ship was attacked print: "Ship sunk".| Report Duplicate | Flag | PURGE
Ebay SDE1 Coding Data Structures - 1of 1 vote
AnswersDifference between concurrency and parallelism
- JSDUDE June 27, 2013 in United States
How has threading helped concurrency and parallelism?| Report Duplicate | Flag | PURGE
Ebay SDE1 Threads