sb
BAN USER- 0of 0 votes
AnswersPh.Intvw 2
- sb in United States for AWS
coding: find a given value/node in a BST
node find(node *n, int x)
follow up :
find a value that is closest (arithmetically) from a given value/node, same signature as above| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Algorithm - 0of 0 votes
AnswersPh.Intvw 2
- sb in United States for AWS
write code to calculate number of words in a large text file
file i/o language specific implementation details not required
what are the corner cases? cover all the corner cases like beginning/ending with space, multiple spaces etc| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Algorithm - 0of 0 votes
AnswersPh.Intvw 2
- sb in United States for AWS
Modify the Stack DS to implement constant time Min lookup| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Algorithm - 0of 0 votes
AnswersPh.Intvw 2
- sb in United States for AWS
OODesign: Design a parking lot| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Algorithm - 0of 0 votes
AnswersPh.Intvw 1
- sb in United States for AWS
Write code to print all the paths in a binary tree, whose values sum up to the value given
root and the sum given
signature: void sum (Node *node, int sum)
follow up question: now change the algo to the same thing for any arbitrary path
arbitrary path: can start from anywhere (not necessarily root) - can end anywhere (not necessarily leaf)| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Algorithm - 0of 0 votes
AnswersPh.Intvw 1
- sb in United States for AWS
What data structure will you use to design a phonebook
What is its time complexity for retrieving, adding etc
right answer: a hashtable with key contactname and value being the head pointer to a list of contacts with that contact name [multiple contacts with same name]| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Algorithm - 0of 0 votes
AnswersCode merge sort
- sb in United States
How will you test this function| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer Algorithm - 0of 0 votes
AnswerTalk about sorting algorithms.
- sb in United States
Explain quick sort and merge sort in details| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer Algorithm
how about this:
pass 1: count number of nodes
now we know the middle node(s)
pass 2: sum + = value (ascii in case of characters) of all nodes before middle node(s)
sum + = value (ascii in case of characters) of all nodes after middle node(s) * -1
if sum=0 then palindrome
time: O(n)
no extra DS other than one integer or long(to be safe)
The link gives the answer of kth largest from a max heap ... doesn't seem much complicated ... traverse the heap for 1st k values and compare. (would be same for kth smallest in a min-heap) But what if the question was 'kth smallest from max-heap' (a heap by default is max heap unless mentioned otherwise). is it still possible in O(k)? please give an algo if possible
- sb December 21, 2011
read Gayle's book for the right answer lol
- sb December 23, 2011