[algogeeks] Re: function overloading query

2011-11-22 Thread MJ
Hi This type of function overloading works in c . Execute following code and it will call function fun as per the function parameter code snip-in - #includestdio.h void fun(const char *p) { printf(funsfsdafsf1\n); } void fun(char *P) { printf(fun2\n); } void

[algogeeks] Re: Problems 4-6 of CLRS: VLSI chip testing

2007-11-28 Thread MJ
I think its a problem similar to finding out one good chip and one bad chip in the given set. If you get a good chip then you can find out the bad chip. I think its a problem similar to finding a soilder which has a infected blood or so... there is some problem based I dont remember. I this

[algogeeks] Re: 答复: [algogeeks] Re: Array of int egers

2007-11-25 Thread MJ
!); else bitmap[array[i]] = marked; i++; } Thank You, Mayur On Nov 23, 3:25 pm, MJ [EMAIL PROTECTED] wrote: Hi James, As per your solution the variable pair can go negative and if Array[i] X, and in that case you can not use bitmap[pair] which will give an exception as we can

[algogeeks] Re: 答复: [algogeeks] Re: Array of int egers

2007-11-23 Thread MJ
Hi James, your approach is cool, The bitmap approach works in O(n), but as mention by dave, it take extra memory and initialization. If we dont want to use extra memory, can it be done in O(n)? Thank You MJ On Nov 21, 8:11 pm, Dave [EMAIL PROTECTED] wrote: Okay. This works better

[algogeeks] Re: 答复: [algogeeks] Re: Array of int egers

2007-11-23 Thread MJ
, 2:22 pm, MJ [EMAIL PROTECTED] wrote: Hi James, your approach is cool, The bitmap approach works in O(n), but as mention by dave, it take extra memory and initialization. If we dont want to use extra memory, can it be done in O(n)? Thank You MJ On Nov 21, 8:11 pm, Dave [EMAIL PROTECTED

[algogeeks] Re: NxN matrix

2007-11-23 Thread MJ
HI Chandra, As per the problem statement Given an array of 0's and 1's whenever you encounter an 0 make corresponding column and row elements 0. Does it mean make all the rows and column zero or only last row and column elemnt zero?? could you reframe the problem statement with more details

[algogeeks] Re: Array of integers

2007-11-19 Thread MJ
you can do it O(n) time if the input array is sorted. Find the min and max value of the array and then decide how many number can be eliminated based if they are greater than X. This problem get complecated if we consider the integers are +ve as well as -Ve intergers in an array. But any way

[algogeeks] Discussion on unique-elements-in-an-array

2007-11-19 Thread MJ
Heap sort has a function heapify which will build the heap. If you just modify this heapify algorithm to eliminate the repeated elemenst it will work in O(nLogn). Also this will work for any number of repeated elements. you can find this algo in hte Design analysis and algorithms by Corment in