anshulzunke
BAN USER- 0of 0 votes
AnswersHow many types of class loaders do you know in java
- anshulzunke in India| Report Duplicate | Flag | PURGE
Tribal Fusion Software Engineer / Developer Java - 0of 0 votes
AnswerWhat is request forwarding and request redirect
- anshulzunke in India| Report Duplicate | Flag | PURGE
Tribal Fusion Software Engineer / Developer - 0of 0 votes
AnswerYou have two hashmaps HM1 and HM2 where key = Id(long) value = timestamp. You need to give a program to return a list of Ids combined from both the hashmaps such that they are sorted as per their timestamps
- anshulzunke in India| Report Duplicate | Flag | PURGE
Tribal Fusion Software Engineer / Developer Java - 0of 0 votes
AnswersHow will you make your own Hashmap class?
- anshulzunke in India| Report Duplicate | Flag | PURGE
Tribal Fusion Software Engineer / Developer Java - 0of 0 votes
AnswersPreOrder traversal without recusion
- anshulzunke in -| Report Duplicate | Flag | PURGE
Myntra Software Engineer / Developer Algorithm - 0of 0 votes
AnswersWhich is greated 3^20 or 2^30
- anshulzunke in India| Report Duplicate | Flag | PURGE
Urban Touch Software Engineer / Developer Brain Teasers - 0of 0 votes
AnswerDifference between MYISAM and NoDB Mysql
- anshulzunke in India| Report Duplicate | Flag | PURGE
Urban Touch Software Engineer / Developer Database
Trie but the problem is are you going to edit 2 tries wheneer u add or del an entry in the ph book
- anshulzunke September 16, 2011thanks manoj this 1 seems a better solution
- anshulzunke September 16, 2011I dont think it will work when you are removing the element. In case the element to be deleted is the max itself you need to find NEW_MAX again taking O(N)
- anshulzunke September 16, 2011There are algorithms for it OS books.
4 prevention as far as i can remember is, bring a process 4m ready to running state only when all the resources to b needed by the process is free and if it is so then allocate the resources to the process and put it in the running queue
I had given a Java Code.
Just a suggestion If u have applied Java as ur key skill u shuld always write java code instead of traditional C code for Algo
Uniqueness is the key here. If you get a solution for checking uniqueness of N elements between max and min then u have done ur job.
For the uniqueness only i had suggested having another array but again space complexity would be O(N)
BTW i had given the exact same answer and both Interviewer and i knew it wasnt the right answer. Infact i had gone a step further by finding the Max and compared it with the max coming in the series
Max = min + (n - 1)* 1
The approach is surely right but i dont think answer will be correct
It wont work.
I had given u an example. Both the series have same Sum and Min Value but 1 is consecutive and other is not
1 2 3 4 5
1 3 3 3 5
Are you sure this will work??
- anshulzunke September 16, 2011Yes.
Though Sorting is 1 solution that clicked me instantly but interviewer rejected the obvious sol.
I had given the same answer and interviewer replied "Are you sure this gonna work for all cases?"
- anshulzunke September 16, 2011Isnt it tht Yahoo started asking bit basic textual questions
- anshulzunke September 15, 2011I gave 2 solutions
1. sort the array
2. use another array of booleans and then check uniqueness of each number but space complexity O(N)
3. i thought of it but could nt complete. Using the arithemetic progression formulas
i dont think this would give you write solution if duplicacy is allowed among the numbers
- anshulzunke September 15, 2011I will go with sort the sqrt(n) elements and then merge the elements with n-sqrt(n) elements
- anshulzunke September 15, 2011I think linked list will be better
- anshulzunke September 12, 2011Node find(int num Node root)
{
if(rooyt == null)
return null
if(root.value== num)
return node
else
{
if(root.leftChild != null)
return find(root.leftChild)
if(root.rightChild != null)
return find(root.rightChild)
}
}
Now the problem will be if the Name/Surnames are not unique.
- anshulzunke September 12, 2011Trie.
i can make key of in the tree which is not a single key but rather 3 keys. 1 for name another for address and one more for surname
Lets say my number is 8888888 then this will be saved in Anshul as well as Zunke and also with Address. All the three will have an identifier with which attribute the number has been saved in the node i.e whether the key is as per name surname or address
THANKS
- anshulzunke September 12, 2011thanks. Yes thats right. It will b O(nlogn)
- anshulzunke September 12, 2011thanks Jin for correcting :)
- anshulzunke September 12, 2011i too had the same solution. Hash table could also b a sol but since the words would b huge and there is infinite range of words so hashtable is not in picture
- anshulzunke September 11, 2011if i have understood the question rightly then O(n) solution is there.
Make BST of the array. It will take O(N)
then traverse it Inorder and give every1 a rank. Again O(N)
now traverse in prefix order and get all the ranks you will get in the order the numbers were set in Array again O(N)
Over all O(N)
I think adding synchronized keyword before put and get will do. We wont require having semaphores etc after that.
- anshulzunke September 08, 2011For Q3 i am not getting the question
- anshulzunke September 08, 2011
ur solution makes sense may b this could get into problem of overflow if the series is bit long
- anshulzunke September 16, 2011