Re: [algogeeks] Amazon Question

2011-11-13 Thread UTKARSH SRIVASTAV
@Surinder give some proof or logic On Sun, Nov 13, 2011 at 10:25 AM, surender sanke surend...@gmail.comwrote: @nitin yes i meant the same, if each different character have equal number of frequency like abcabcabc a's -3, b's - 3 c's- 3 then resultant string size is 2 else 1 surender On

Re: [algogeeks] Amazon Interview Question

2011-11-13 Thread Anika Jain
I think smallest will be having just one character . it can be a or b or c. On Sat, Nov 12, 2011 at 3:07 PM, Snoopy Me thesnoop...@gmail.com wrote: Given a string consisting of a,b and c's, we can perform the following operation: Take any two adjacent distinct characters and replace it with

[algogeeks] an os question

2011-11-13 Thread Anika Jain
You have written some code/program and delivered it to d customer. Now u dont have the source code with u. The program is not working fine at the customer's place. How will u catch the bug?(remember u dont have the source code wid u). This is an OS question. I dont know the answer. It was asked

Re: [algogeeks] Amazon Question

2011-11-13 Thread Anika Jain
its coming out be either 1 or 2 in all cases On Sun, Nov 13, 2011 at 1:55 PM, UTKARSH SRIVASTAV usrivastav...@gmail.comwrote: @Surinder give some proof or logic On Sun, Nov 13, 2011 at 10:25 AM, surender sanke surend...@gmail.comwrote: @nitin yes i meant the same, if each different

[algogeeks] Re: an os question

2011-11-13 Thread vikas
that is normal in embedded systems, what you should do is , put the logs in the particular module, which can be enabled by choice. Another option is to store the stack traces. using such techniques , you will be able to find the problem, at least you will be able to reach near to it. On Nov 13,

[algogeeks] Re: Median of 2D matrix

2011-11-13 Thread Gene
Exactly. Thanks. On Nov 8, 7:02 pm, yq Zhang zhangyunq...@gmail.com wrote: Vikas, The cost of removing elements from the matrix is O(N) it self. So by removing N^2/2 elements, the complexity of your algo should be N^3. However there are well-known algo for median in O(N) time in this case

[algogeeks] Re: Median of 2D matrix

2011-11-13 Thread Gene
I think he means the K-Median selection algorithm (which is what Hopcroft et al call it). This is O(n), where n is the number of elements, but here n = N^2. We can do better than O(N^2) as we have discussed. On Nov 8, 4:00 pm, Anup Ghatage ghat...@gmail.com wrote: I googled around and

[algogeeks] Re: free() function

2011-11-13 Thread sumit mahamuni
On Nov 11, 9:16 pm, saurabh singh saurab...@gmail.com wrote: well that would be tough for the compiler to predict things that will happen during run time.Its the job of garbage collector to do that. well compiler cant predict what will happen at runtime. On Fri, Nov 11, 2011 at 8:36

Re: [algogeeks] Re: free() function

2011-11-13 Thread Debabrata Das
process heap is organized as chunk of free memory need not be contiguous and during freeing what free() does is update it's book keeping records and it's bins array so that next time if asked for new space may return the same space however it doesn't wipe the freed data but few run time directive

[algogeeks] Re: free() function

2011-11-13 Thread Gene
Not meaning any disrespect, this argument is about as wrong as it gets in computer science. Predicting when memory will be free in a running program at compile time is called an _undecidable problem_. This means it's totally impossible to write a C / C++ compiler that will produce an executable

Re: [algogeeks] Re: an os question

2011-11-13 Thread Debabrata Das
take online process dump and analyze, would be good if you retain the symbol table in the binary.. On Sun, Nov 13, 2011 at 7:55 PM, vikas vikas.rastogi2...@gmail.com wrote: that is normal in embedded systems, what you should do is , put the logs in the particular module, which can be enabled

Re: [algogeeks] Re: an os question

2011-11-13 Thread UTKARSH SRIVASTAV
strace or ltrace On Sun, Nov 13, 2011 at 7:55 PM, vikas vikas.rastogi2...@gmail.com wrote: that is normal in embedded systems, what you should do is , put the logs in the particular module, which can be enabled by choice. Another option is to store the stack traces. using such techniques ,

Re: [algogeeks] difference btw int *a[] and int (*a)[]

2011-11-13 Thread Anup Ghatage
First is an array of pointers to integers. Second is a pointer to a function that returns an integer. On Mon, Nov 14, 2011 at 12:11 AM, rj7 r4ra...@gmail.com wrote: Could someone pls tell me the difference between int *a[] and int (*a) [] -- You received this message because you are

Re: Re: [algogeeks] Re: an os question

2011-11-13 Thread saurabh8c
Reverse engineering.you have to dive into the object dumps.in case its an elf file your life is easy,you can use strace ltrace valgrind mtrace etc etc etc.no idea about win32 or other formats -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group.

Re: [algogeeks] Re: i cannot solve this written test question

2011-11-13 Thread Ramakant Sharma
start from rightmost digit find:i th positionsuch that ele[i]!=9 find j th position i ele[j]!=0 decrement jth position element and increment i th position element. . . ex:ele=134 i=0,---no j found i=1,j=0 ==143 ele=23998 i=0,---no j found i=1,---ele[i]=9 i=2,---ele[i]=9 i=3,j=0 ==24997 ele 8000100

[algogeeks] LCA of a Binary tree not a binary search tree

2011-11-13 Thread AMAN AGARWAL
Hi, Please tell me the solution of this question. write a program which find LCA of a binary tree. It is not a BST Regards, Aman, -- AMAN AGARWAL Success is not final, Failure is not fatal: It is the courage to continue that counts! -- You received this message because you are subscribed to

Re: [algogeeks] difference btw int *a[] and int (*a)[]

2011-11-13 Thread sumit mahamuni
hi, one is the array of integer pointers and the other is pointer to integer array. On Mon, Nov 14, 2011 at 12:11 AM, rj7 r4ra...@gmail.com wrote: Could someone pls tell me the difference between int *a[] and int (*a) [] -- You received this message because you are subscribed to the

Re: [algogeeks] difference btw int *a[] and int (*a)[]

2011-11-13 Thread sumit mahamuni
@anup: Dude u missed the second its int (*a)[] not pointer to function its the pointer to integer array On Mon, Nov 14, 2011 at 7:00 AM, Anup Ghatage ghat...@gmail.com wrote: First is an array of pointers to integers. Second is a pointer to a function that returns an integer. On Mon, Nov 14,

Re: [algogeeks] LCA of a Binary tree not a binary search tree

2011-11-13 Thread aritra kundu
struct node{ int data; struct node* left; struct node* right; }; struct node* lca(struct node* root,struct node* a,struct node* b){ if(!root) return NULL; if( root==a || root ==b) return root; struct node* left = lca(root-left,a,b); struct node* right =