[algogeeks] Implement division without using divide operator

2007-10-08 Thread megha
Hi all, I am looking for the program/algorithm to implement division without using divide operator? Any idea? Thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group,

[algogeeks] NxN matrix of positive and negetive integers?

2007-10-08 Thread megha
given N x N matrix of positive and negetive intergers. Write some code that finds the sub-matrix with teh maximum sum of its elements. Any ideas? Thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Algorithm

[algogeeks] Re: Implement division without using divide operator

2007-10-08 Thread Vinay Chilakamarri
How about recursive way: int funcNoDiv(int divisor, int dividend) { //base case if(divisor == dividend) { return 1; } else if( divisor dividend) { return 0; } else // divisor dividend { while(divisor = dividend) { divisor = divisor 1;

[algogeeks] Re: Implement division without using divide operator

2007-10-08 Thread Vinay Chilakamarri
Sorry but lets start with a quotient of 1 On 10/7/07, Vinay Chilakamarri [EMAIL PROTECTED] wrote: How about recursive way: int funcNoDiv(int divisor, int dividend) { //base case if(divisor == dividend) { return 1; } else if( divisor dividend) { return 0; }

[algogeeks] Re: NxN matrix of positive and negetive integers?

2007-10-08 Thread megha
Hi, I didnt understand...can you tell me more details? thanks, On Oct 8, 2:27 am, Jun [EMAIL PROTECTED] wrote: You can first solve the 1-dimension similar problem using DP. That's, find the maximum sum of continuous sub sequence of an array. Then you can apply this to 2-dimension problem.

[algogeeks] Re: Implement division without using divide operator

2007-10-08 Thread megha
Yes can u please explain the algorithm... On Oct 7, 11:55 pm, Ajinkya Kale [EMAIL PROTECTED] wrote: @Vinay : Can you please explain the algorithm of your code.. On 10/7/07, Vinay Chilakamarri [EMAIL PROTECTED] wrote: How about recursive way: int funcNoDiv(int divisor, int

[algogeeks] Re: Implement division without using divide operator

2007-10-08 Thread Vinay Chilakamarri
hey there i did play around with bit shifting sometime ago and was able to do that.. but yeah i guess the one i posted is a bit different from what i actually did before and is not applicable here. here is what we can do int funcNoDiv(int divisor, int dividend) { if(divisor == dividend) {

[algogeeks] Re: Implement division without using divide operator

2007-10-08 Thread Vinay Chilakamarri
in the previous logic, dont forget to address a negative divisor, dividend and alternative cases like those... it shud be pretty easy On 10/8/07, Vinay Chilakamarri [EMAIL PROTECTED] wrote: hey there i did play around with bit shifting sometime ago and was able to do that.. but yeah i guess

[algogeeks] Re: Google Interview Question: find shortest summary containing all key words

2007-10-08 Thread Andrey
I have to admit that I was wrong in my previous post. I stated that if we have all words in the enumerated we can operate with them better (faster) but it is true. Enumeraing of the words makes no sence.. Similar objections to using a hash table to assign integers to words. If collisions are