[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 - #include void fun(const char *p) { printf("funsfsdafsf1\n"); } void fun(char *P) { printf("fun2\n"); } void main()

[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 case

[algogeeks] Re: NxN matrix

2007-11-27 Thread MJ
question goes like this (I also face this > > problem > > > earlier)... > > > > Given an array of 0s and 1s (whether the array can contain any other > > > element apart from 0 and 1 is not mentioned in the question posted, but > > to > > > make it h

[algogeeks] Re: Array of integers

2007-11-27 Thread MJ
add it with pair. Thanks James. Thank You, Mayur On Nov 26, 8:52 pm, "James Fang" <[EMAIL PROTECTED]> wrote: > Hi MJ, > > The negative "pair value" can be workarounded by normalizing the > pair to be in the [0,MAX_INT] range. > This c

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

2007-11-25 Thread MJ
gative > if( bitmap[pair] == marked )// if pair is - > ve value this operation is not allowed > found the answer! > else >mark bitmap[array[i]] > > Thank You, > Mayur > > On Nov 23, 2:22 pm, MJ <

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

2007-11-23 Thread MJ
Mayur On Nov 23, 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)? > >

[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 detail

[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 b

[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 Cha

[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 sor