3139a1m
BAN USER- 5of 5 votes
AnswersWrite a program to replace each element of an array with a number present on the right side of the element such that the number is least greater than the element. If there is no greater number replace it with -1
- 3139a1m in India
e.g : 8, 58, 71, 18, 31, 32, 63, 92, 43, 3, 91, 93, 25, 80, 28
ans : 18, 63, 80, 25, 32, 43, 80, 93, 80, 25, 93, -1, 28, -1, -1
I gave the obvious o(n^2) solution. He asked to optimize it.| Report Duplicate | Flag | PURGE
Adobe SDE1 Algorithm - 0of 0 votes
AnswersWrite a program to replace each element of an array with a number present on the right side of the element such that the number is least greater than the element. If there is no greater number replace it with -1
- 3139a1m in India
e.g : 8, 58, 71, 18, 31, 32, 63, 92, 43, 3, 91, 93, 25, 80, 28
ans : 18, 63, 80, 25, 32, 43, 80, 93, 80, 25, 93, -1, 28, -1, -1| Report Duplicate | Flag | PURGE
Adobe SDE1 Algorithm - 0of 0 votes
AnswersDifference between virtual memory and main memory?
- 3139a1m in India
How virtual memory works??| Report Duplicate | Flag | PURGE
Amazon Intern - 2of 2 votes
AnswersOutput the leftmost element of each level of a tree
- 3139a1m in India| Report Duplicate | Flag | PURGE
Amazon Intern - 0of 0 votes
AnswersName a data structure that can replicate a cache and why do you think so
- 3139a1m in United States| Report Duplicate | Flag | PURGE
Adobe Intern - 0of 0 votes
Answershow to solve this ((3000000!)/(30!)^100000)%(any prime no.) in C++
- 3139a1m in India| Report Duplicate | Flag | PURGE
Adobe Intern C++
Here is the comparison between hashmap and trie for a spell checker
1)Time complexity => o(length of the word) for trie always .For hashmap it will be mostly o(1) but it can be more than that also .Moreover we are reading the word in a spell checker so it trie will be better.
2)Space complexity => Hashmap will take more space because in Trie there will be words which are present in the path to other words which will save space e.g "for" will be present in the path of "formula" which will save space
- 3139a1m June 24, 2014