Re: [algogeeks] MS interview

2011-09-17 Thread Abhishek Yadav
What should be the answer to above questions...? On Sat, Sep 17, 2011 at 5:01 AM, bharatkumar bagana bagana.bharatku...@gmail.com wrote: Memory management has following things.. 1.Relocation To maintain the free pages and when a page is to be swapped, we have to add that page into free page

Re: [algogeeks] Re: Closest ancestor of two nodes

2011-09-03 Thread Abhishek Yadav
this solution works if parent pointer is given. 1. Start moving up from both the nodes (if two nodes become equal, fine this is the common ancestor) till you reach the root node and in between count the number of nodes you covered in their path for both the nodes. Say 7 for node A and 10 for node

[algogeeks] Pattern Matching

2011-09-03 Thread Abhishek Yadav
Implement a function that receive a string S and a pattern containing wild characters ( * and ? only) in string P. Function return true if S matches the pattern P. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send

Re: [algogeeks] print level by level withoust recursion

2011-08-31 Thread Abhishek Yadav
can we use loops or GOTO statements On Wed, Aug 31, 2011 at 10:03 PM, manish kapur manishkapur.n...@gmail.comwrote: Given a binary Tree and a node pointer extra in a tree. print all the node level by level. You cannot use any Stack ,recursion and queue. -- You received this message

Re: [algogeeks] Help ! - Explain Sscanf

2011-08-30 Thread Abhishek Yadav
so what should be the correct question after writing % specifier. On Tue, Aug 30, 2011 at 11:48 PM, Sanjay Rajpal srn...@gmail.com wrote: yes % has to be there. Sanju :) On Tue, Aug 30, 2011 at 11:12 AM, sukran dhawan sukrandha...@gmail.comwrote: yes conversion specifier missing i

Re: [algogeeks] Re: elitmus test

2011-08-29 Thread Abhishek Yadav
can you share some DI questionsurgent On Sun, Aug 28, 2011 at 3:37 PM, Aditya Virmani virmanisadi...@gmail.comwrote: focus on quant di...verbal wud be easy...as in our college, thr were two papers, on which had gud level of quant qns...qns were nt tough to crack, but involved

Re: [algogeeks] Re: Adding Two no without using any operator...??

2011-08-28 Thread Abhishek Yadav
Very nice solution sourabh. On Sun, Aug 28, 2011 at 9:52 PM, Dave dave_and_da...@juno.com wrote: @Shravanthi: Write a and b in binary, and then apply the bitwise exclusive-or to them and you will see why. Dave On Aug 28, 9:24 am, Shravanthi U M shravanthium...@gmail.com wrote: if we give

Re: [algogeeks] Re: Intersection of characters

2011-08-25 Thread Abhishek Yadav
@Don: Can you please explain the 3rd for loop.the working of if statement??? On Thu, Aug 25, 2011 at 11:02 PM, Don dondod...@gmail.com wrote: Sure. It uses a hash table to keep track of which characters occur in each file. The hash table is 256 bits initialized to zero. When it encounters

Re: [algogeeks] C Trick

2011-08-24 Thread Abhishek Yadav
, 2011 at 7:32 PM, Sanjay Rajpal srn...@gmail.com wrote: @teja : use of comparison operator is not allowed. Sanju :) On Tue, Aug 23, 2011 at 6:42 AM, teja bala pawanjalsa.t...@gmail.comwrote: int a,b,c; c=(ab)?a:b; print(c); On Tue, Aug 23, 2011 at 6:37 PM, Abhishek Yadav algowithabhis

Re: [algogeeks] Re: C dot

2011-08-23 Thread Abhishek Yadav
Moreover they also asked what is .NET as if they heard it for the first timecome on...can you believe it...!!! On Tue, Aug 23, 2011 at 4:18 PM, Dheeraj Sharma dheerajsharma1...@gmail.com wrote: yeah..the interview was total nakli :D .. they always..take the toppers.. :) i mean..among the

[algogeeks] C Trick

2011-08-23 Thread Abhishek Yadav
Write a method which finds the maximum of two numbers You should not use if-else or any other comparison operator. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe

Re: [algogeeks] Re: Adobe Interview - 20/08/2011

2011-08-23 Thread Abhishek Yadav
@vikas: can you please put some light over interval graph to solve this problem or provide some useful links?? On Mon, Aug 22, 2011 at 6:47 PM, Decipher ankurseth...@gmail.com wrote: @vikas - Can u post ur answer using segment trees ?? -- You received this message because you are subscribed

Re: [algogeeks] c++

2011-08-21 Thread Abhishek Yadav
But if you try making a copy constructor of your own and check whether it is called or not.it does not. On Sun, Aug 21, 2011 at 12:21 PM, Sanjay Rajpal srn...@gmail.com wrote: I think it will not be an error. This is because X() will create a temporary object, and when the object is

Re: [algogeeks] c++

2011-08-21 Thread Abhishek Yadav
The code is correct..return X will make a temporary object and for that a constructor and corresponding destructor will be called and that object is returned. On Sun, Aug 21, 2011 at 12:24 PM, Puneet Chawla puneetchawla...@gmail.comwrote: It will show error On Sun, Aug 21, 2011 at 12:21 PM,

Re: [algogeeks] c++

2011-08-21 Thread Abhishek Yadav
what are you trying to say?...can you please explain? On Sun, Aug 21, 2011 at 1:35 PM, JAIDEV YADAV jaid...@gmail.com wrote: try to use X b = a ; b.fun() ; On Sun, Aug 21, 2011 at 1:33 PM, Abhishek Yadav algowithabhis...@gmail.com wrote: ok...may be i forgot , can you please tell me

Re: [algogeeks] c++

2011-08-21 Thread Abhishek Yadav
@jagannath: no its not i am totally confused. On Sun, Aug 21, 2011 at 5:57 PM, priya ramesh love.for.programm...@gmail.com wrote: it is not an error. check this code: I compiled it #includeiostream using namespace std; class X { public: X() { } }; main(){ } X fun() {

Re: [algogeeks] c++

2011-08-21 Thread Abhishek Yadav
@Thayumanavar: thanks for the link On Sun, Aug 21, 2011 at 10:33 PM, Thayumanavar S thayum...@gmail.comwrote: folks during temporary object creation constructor is called right..but constructor is called here only 2 times.. According to me,either copy constructor and constructor

[algogeeks] Google Question:Given a BST and a number, Find the closest node to that number in the BST.

2011-08-20 Thread Abhishek Yadav
Given a BST and a number, Find the closest node to that number in the BST. Give an algorithm for that. Let there be binary search tree having nodes with values 12,34,64,23,64,25,76,6 and the number given is 28, then the answer would be 25 as it is the closest node. -- You received this message

Re: [algogeeks] Google Question:Given a BST and a number, Find the closest node to that number in the BST.

2011-08-20 Thread Abhishek Yadav
difference is minimum after traversing the tree that is the element . u can getback the element using another element which keeps sign of the element so that original element can be obtained from diff On Sat, Aug 20, 2011 at 12:15 PM, Abhishek Yadav algowithabhis...@gmail.com wrote: Given a BST

Re: [algogeeks] Google Question:Given a BST and a number, Find the closest node to that number in the BST.

2011-08-20 Thread Abhishek Yadav
yes, the interviewer said that there is a solution in O(log n) On Sat, Aug 20, 2011 at 12:29 PM, sukran dhawan sukrandha...@gmail.comwrote: ur traversing the tree once so it shud be o(n).does the question demand 0(logn) ? On Sat, Aug 20, 2011 at 12:27 PM, Abhishek Yadav algowithabhis

Re: [algogeeks] Google Question:Given a BST and a number, Find the closest node to that number in the BST.

2011-08-20 Thread Abhishek Yadav
) find_min_ele(root-left, num); else find_min_ele(root-right, num); } ^^ Complexity : O(logn) On 20 August 2011 12:36, Abhishek Yadav algowithabhis...@gmail.comwrote: yes, the interviewer said that there is a solution in O(log n) On Sat, Aug 20, 2011 at 12:29 PM, sukran dhawan

Re: [algogeeks] Google Question:Given a BST and a number, Find the closest node to that number in the BST.

2011-08-20 Thread Abhishek Yadav
...@gmail.comwrote: is there anything wrong in my algo? do tell me. On 20 August 2011 12:56, Abhishek Yadav algowithabhis...@gmail.comwrote: Hey i tried it now and got to another solution O(log n) solution: 1. try searching for the number , if found,return the node, otherwise, you will ultimately

Re: [algogeeks] Google Question:Given a BST and a number, Find the closest node to that number in the BST.

2011-08-20 Thread Abhishek Yadav
: --predecessor --current node --successor. On Sat, Aug 20, 2011 at 1:13 PM, Abhishek Yadav algowithabhis...@gmail.com wrote: No your solution is correct tooits just that in your solution number of comparisons done with the original number are more, while in my solution they get down to 2

Re: [algogeeks] Challenge

2011-08-20 Thread Abhishek Yadav
yah this is a good approach...but one thing in worst case it would be m^2 instead of n^2 On Sat, Aug 20, 2011 at 3:22 PM, Sanjay Rajpal srn...@gmail.com wrote: Yes, thats right. I think we can do the following also : Lets us assume rows are sorted in increasing order. start from first row

Re: [algogeeks] Google Question:Given a BST and a number, Find the closest node to that number in the BST.

2011-08-20 Thread Abhishek Yadav
@atul yes sure why not... On Sat, Aug 20, 2011 at 1:39 PM, Naman Mahor naman.ma...@gmail.com wrote: i think there will be three candidate.. 1. TreeSuccessor(nd) 2. TreePredecessor(nd) 3. nd it self. On Sat, Aug 20, 2011 at 12:56 PM, Abhishek Yadav algowithabhis...@gmail.com wrote

Re: [algogeeks] query.. amazon question

2011-08-19 Thread Abhishek Yadav
...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Abhishek Yadav Comp Engg. NIT Kurukshetra -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks

Re: [algogeeks]

2011-08-19 Thread Abhishek Yadav
Hey try queue instead of stack On Fri, Aug 19, 2011 at 9:47 PM, sagar pareek sagarpar...@gmail.com wrote: traverse the list and print only odd numbers and if even number encounter store it in a stack and later on print it On Fri, Aug 19, 2011 at 9:29 PM, sukran dhawan

[algogeeks] Re: array question

2011-08-17 Thread Abhishek Yadav
Thats right...by doing xor this can't be done...hey sanjay please reconsider your answer. On Aug 17, 2:05 pm, sukran dhawan sukrandha...@gmail.com wrote: when u xor nos with odd number of times we will get back the same no.only even occurences will give 0.question is to find the no with even