Re: [algogeeks] Re: Static variable

2011-08-31 Thread muthu raj
can u tell y negative values are gettin printed? when recursive calls return y is condition checking done again? *Muthuraj R IV th Year , ISE PESIT , Bangalore* On Wed, Aug 31, 2011 at 9:14 AM, Sanjay Rajpal srn...@gmail.com wrote: Thank u swathi for making me clear about static variables.

Re: [algogeeks] Re: Given an array A[] and a integer num. Find four no.s in the array whose sum is equal to given num.

2011-08-28 Thread muthu raj
@Dave: Explain your O(n3) solution please *Muthuraj R IV th Year , ISE PESIT , Bangalore* On Sat, Aug 27, 2011 at 11:10 PM, Mohit Goel mohitgoel291...@gmail.comwrote: This code may also work .give any counter examples... #includeiostream using namespace std; void find_sum(int

Re: [algogeeks] Some bit manipulation help

2011-08-28 Thread muthu raj
Can anyone explain logic of the above code ? *Muthuraj R IV th Year , ISE PESIT , Bangalore* On Sun, Aug 28, 2011 at 2:16 AM, Dheeraj Sharma dheerajsharma1...@gmail.com wrote: yeah..dat we all know..bt wat actually this code is doing..this is wat am thinking!!! On Sun, Aug 28, 2011 at

Re: [algogeeks] Re: inorder predecessor

2011-08-28 Thread muthu raj
here is my approach. flag=0; void inorder(node *root , int value , node *predecessor) { if(root) { inorder(root-left,value , predecessor); if(root-value!=value) // store the last node traversed as predessor until you get the node we are searching { predecessor = root; }

Re: [algogeeks] Re: 2 Binary trees are isomorphic?

2011-08-28 Thread muthu raj
In Amazon written test Isomorphic trees were defined as those in which a series of flips can transform one tree to another. *Muthuraj R IV th Year , ISE PESIT , Bangalore* On Sun, Aug 28, 2011 at 11:52 AM, bugaboo bharath.sri...@gmail.com wrote: @Navneet, What you are talking about are

Re: [algogeeks] Re: Amazon Ques

2011-08-22 Thread muthu raj
No need to count the number of nodes. Since its implemented as a linked list traverse the list with two two pointers one incremented one node next and other incremented two nodes next simultaneously. void delete_MiddleStack(node **h) { if(*h==NULL) return; node *p,*q; p=*h;

Re: [algogeeks] Re: Amazon Ques

2011-08-22 Thread muthu raj
u had read the question... it is simple.. push to new stack and then pop back... number of elements count need to be there On Mon, Aug 22, 2011 at 7:44 PM, muthu raj muthura...@gmail.com wrote: No need to count the number of nodes. Since its implemented as a linked list traverse the list

Re: [algogeeks]

2011-08-21 Thread muthu raj
Segregate the Odd and even nodes in the list by traversing in O(n). Then print the resulting list in O(n). So no additional space required and solution in O(n) time also :) *Muthuraj R IV th Year , ISE PESIT , Bangalore* On Fri, Aug 19, 2011 at 9:48 AM, priya ramesh

Re: [algogeeks] GS apti ques!

2011-08-17 Thread muthu raj
Sorry The probability of machine being active is 1-0.212=0.788 *Muthuraj R IV th Year , ISE PESIT , Bangalore* On Wed, Aug 17, 2011 at 5:10 PM, muthu raj muthura...@gmail.com wrote: Even i got 0.212 *Muthuraj R IV th Year , ISE PESIT , Bangalore* On Wed, Aug 17, 2011 at 4:42 PM

Re: [algogeeks] GS apti ques!

2011-08-17 Thread muthu raj
Even i got 0.212 *Muthuraj R IV th Year , ISE PESIT , Bangalore* On Wed, Aug 17, 2011 at 4:42 PM, Romil ... vamosro...@gmail.com wrote: Kumar's approach would not do perhaps. I simply eliminated the undesired cases. Those include the one when none of them is active and when only one

Re: [algogeeks] c question

2011-08-14 Thread muthu raj
The problem is because of \n in the prnintf statement. When new line is there in first printf it flushes the standard buffer and so in child the output of printf is not present in second program. *Muthuraj R IV th Year , ISE PESIT , Bangalore* On Sat, Aug 13, 2011 at 9:29 PM, Ankur Khurana

[algogeeks] Assignment!!

2011-08-14 Thread muthu raj
What is the difference between the following statements. int a=1,2,3 ; and int a; a=1,2,3; first one is an error while second one is not. Can Any one tell me y ? *Muthuraj R IV th Year , ISE PESIT , Bangalore* -- You received this message because you are subscribed to the Google

Re: [algogeeks] Re: Microsoft written!!!

2011-08-10 Thread muthu raj
@coder dumca: If u apply DFS u will get a brother and not cousin. And yes it works only for some cases. *Muthuraj R IV th Year , ISE PESIT , Bangalore* On Wed, Aug 10, 2011 at 2:24 PM, coder dumca coder.du...@gmail.com wrote: apply BFS the node after the particular node(whode cousin to be

Re: [algogeeks] Re: Microsoft written!!!

2011-08-10 Thread muthu raj
at 3:26 PM, muthu raj muthura...@gmail.com wrote: @coder dumca: If u apply DFS u will get a brother and not cousin. And yes it works only for some cases. *Muthuraj R IV th Year , ISE PESIT , Bangalore* On Wed, Aug 10, 2011 at 2:24 PM, coder dumca coder.du...@gmail.comwrote: apply BFS

[algogeeks] Microsoft written!!!

2011-08-09 Thread muthu raj
Write a C code to find Leftmost right cousin at the same level. For ex: 10 /\ 2 3 /\ /\ 8 56 9 Leftmost right cousin of 5 is 6. Leftmost right cousin of 3 is NULL *Muthuraj R IV th Year , ISE PESIT , Bangalore* -- You received this message because you are subscribed to the

Re: [algogeeks] pls help

2011-08-09 Thread muthu raj
pls explain how u got 27? *Muthuraj R IV th Year , ISE PESIT , Bangalore* On Wed, Aug 10, 2011 at 1:13 AM, sagar pareek sagarpar...@gmail.com wrote: in ques 1 i considered leaves as nodes... if we consider only internal nodes then it have 27 On Wed, Aug 10, 2011 at 1:12 AM, sagar pareek

Re: [algogeeks] Directi Question

2011-08-06 Thread muthu raj
Microsoft written: What is the probability of getting atleast one 6 in 3 attempts of a dice? *Muthuraj R IV th Year , ISE PESIT , Bangalore* On Sat, Aug 6, 2011 at 7:34 AM, shady sinv...@gmail.com wrote: Hi, A fair dice is rolled. Each time the value is noted and running sum is

Re: [algogeeks] Re: Printf

2011-08-05 Thread muthu raj
physical adress is never acessible.Those who claim physical adress pls support ur answers. *Muthuraj R IV th Year , ISE PESIT , Bangalore* On Fri, Aug 5, 2011 at 4:57 PM, Kamakshii Aggarwal kamakshi...@gmail.comwrote: logical address On Fri, Aug 5, 2011 at 2:20 PM, Amol Sharma

Re: [algogeeks] MS

2011-08-05 Thread muthu raj
Yeah Kadanes algorithm. It can be done in O(n); *Muthuraj R IV th Year , ISE PESIT , Bangalore* On Fri, Aug 5, 2011 at 6:49 PM, Naren s sweetna...@gmail.com wrote: http://people.csail.mit.edu/bdean/6.046/dp/ -- You received this message because you are subscribed to the Google Groups

Re: [algogeeks] My senior's Interview Experience at Microsoft who got selected and offered a 16lacks package

2011-08-04 Thread muthu raj
Can any one explain the working of %[A telephonnic girl] *Muthuraj R IV th Year , ISE PESIT , Bangalore* On Thu, Aug 4, 2011 at 12:25 PM, Nitish Garg nitishgarg1...@gmail.comwrote: The input for the above code was hello world. So the output would be hello. As the input will stop on reading

Re: [algogeeks] My senior's Interview Experience at Microsoft who got selected and offered a 16lacks package

2011-08-04 Thread muthu raj
@poised: Since it is read only memory junk will be the output if and only if we enter any string containing characters not inside []. If we try entering something present within [] i am getting segmentation fault. *Muthuraj R IV th Year , ISE PESIT , Bangalore* On Thu, Aug 4, 2011 at

Re: [algogeeks] Microsoft Internship

2011-08-03 Thread muthu raj
, muthu raj muthura...@gmail.com wrote: 1) subjective question: To find the first repetitive character how can you use bits because you cannot keep track of first repeated character and also if a character is present more than twice for ex thrice its mask shows 1 indicating it has occured once

Re: [algogeeks] Malloc()

2011-08-03 Thread muthu raj
Malloc implementation isnt simple as above. It involves system call sbrk() to request memory to operating system and a suitable data structure to allocate and deallocate memory from available memory blocks. Proper implementation of malloc is given in Kerningha ritchie text book :) *Muthuraj R IV

Re: [algogeeks] Re: Amazon Aptitude questions

2011-08-03 Thread muthu raj
5) Sample space=24C2= 276 N(S) = 12 C 2 + 12 C 2 =132 Probability= 132/276= 11/23 *Muthuraj R IV th Year , ISE PESIT , Bangalore* On Wed, Aug 3, 2011 at 10:36 PM, Prakash D cegprak...@gmail.com wrote: assume there are 6 1's and 6 0's if two are selected together randomly% the possible

Re: [algogeeks] Microsoft Internship

2011-08-02 Thread muthu raj
1) subjective question: To find the first repetitive character how can you use bits because you cannot keep track of first repeated character and also if a character is present more than twice for ex thrice its mask shows 1 indicating it has occured once. So please tell how to implement in O(1)

Re: [algogeeks] Re: Direct - i ques

2011-07-31 Thread muthu raj
Use a circular linked list with elements being inserted in sorted order. Inserting minimum element : struct node *p; p is a pointer to last node in the circular singly linked list. newmin-next=p-next; p-next=newmin; Deleting minimum element: struct node *temp; temp=p-next; p-next=p-next-next;

Re: [algogeeks] Re: Interview ques

2011-07-31 Thread muthu raj
By declaring the function a static final f(). *Muthuraj R IV th Year , ISE PESIT , Bangalore* On Sun, Jul 31, 2011 at 7:28 AM, himanshu kansal himanshukansal...@gmail.com wrote: sry i thinki misspelled d ques d ques was how will you protect a derived class to override

Re: [algogeeks] Re: Interview ques

2011-07-31 Thread muthu raj
being overridden. *Muthuraj R IV th Year , ISE PESIT , Bangalore* On Sun, Jul 31, 2011 at 7:38 AM, himanshu kansal himanshukansal...@gmail.com wrote: i think there is no keyword known as final in c++.maybe u are talking with respect to java On Sun, Jul 31, 2011 at 8:03 PM, muthu raj

Re: [algogeeks] Re: Interview ques

2011-07-31 Thread muthu raj
On Sun, Jul 31, 2011 at 8:03 PM, muthu raj muthura...@gmail.com wrote: By declaring the function a static final f(). *Muthuraj R IV th Year , ISE PESIT , Bangalore* On Sun, Jul 31, 2011 at 7:28 AM, himanshu kansal himanshukansal...@gmail.com wrote: sry i thinki misspelled d ques

Re: [algogeeks] Re: Interview ques

2011-07-31 Thread muthu raj
; } }; int main() { B ob; ob.f(); return 0; } in this output is abc.. so overriding occured On Sun, Jul 31, 2011 at 8:41 PM, muthu raj muthura...@gmail.comwrote: Using friend functions we can only invoke already defined private functions. We cannot override or prevent

Re: [algogeeks] Facebook Intern F2F Interview

2011-07-28 Thread Muthu Raj
Please elaborate upon the question a little more :) *Muthuraj R. 4TH Year BE.** Information Science Dept* *PESIT, Bengaluru . * On Thu, Jul 28, 2011 at 4:21 PM, KK kunalkapadi...@gmail.com wrote: bool foo(int x) // Implement this function where 0 = x = 100 It should return true x% of

Re: [algogeeks] [offtopic] Something to share for those preparing for Amazon Campus Interviews!

2011-07-28 Thread Muthu Raj
Thnks a lot neha :) *Muthuraj R. 4TH Year BE.** Information Science Dept* *PESIT, Bengaluru . * On Thu, Jul 28, 2011 at 6:01 PM, Neha Sharan neharick...@gmail.com wrote: @rahul:what kind of questons were asked in aptitude test? On Thu, Jul 28, 2011 at 5:54 PM, Rahul Menon

Re: [algogeeks] Re: Facebook Intern F2F Interview

2011-07-28 Thread Muthu Raj
ya me toowas readin % as modulus :) *Muthuraj R. 4TH Year BE.** Information Science Dept* *PESIT, Bengaluru . * On Thu, Jul 28, 2011 at 9:13 PM, sunny agrawal sunny816.i...@gmail.comwrote: Okay... i was reading % as Modulus operator :( did u gave the solution Nikhil posted , i think

Re: [algogeeks] C-question

2011-07-27 Thread Muthu Raj
I am getting the proper output :) 1 0 1 0 1 1 0 1 *Muthuraj R. 4TH Year BE.** Information Science Dept* *PESIT, Bengaluru . * On Wed, Jul 27, 2011 at 11:19 PM, Vijay Khandar vijaykhand...@gmail.comwrote: #includestdio.h #includeconio.h int f(int n) { if(n=1) { printf( %d,n); }