Re: [algogeeks] MS ques
@Vicky Piyush's algo is based on a little trick to determine divisibility by 3. Number of bits set in odd position - Number of bits set in even position 'll be divisible by 3 For example, take 9. 1001. No. of bits set in odd position - number of bits set in even position is 0. Hence divisible by 3. For 21, 10101. Difference is 3.. SO just keep count of the number of bits set in odd position and even position as the stream progresses and ur done... On Tue, Jul 19, 2011 at 10:35 PM, SAMM somnath.nit...@gmail.com wrote: find the difference between the set bits in the odd and even position, if this diff is divisible by 3, then it is the multiple of 3.. On 7/20/11, ~*~VICKY~*~ venkat.jun...@gmail.com wrote: @Piyush Sinha: Can u plz state an example? I don get ur algo On Wed, Jul 20, 2011 at 12:52 AM, SAMM somnath.nit...@gmail.com wrote: The above method is good , I was going to suggest another algo it takes the same complexity but lengthy so I am not posting my algo... On 7/19/11, Piyush Sinha ecstasy.piy...@gmail.com wrote: Divisibility of 3 of numbers in base 2 can be seen same as divisibility of numbers by 11 in base 10... maintain two variable even_sum odd_sum, both initialized to 0 when an odd location in the number is set increment odd_sum when an even location in the number is set increment even_sum if(abs(even_sum-odd_sum)%3==0) number is divisible by 3... Hence keep the track of even_sum and odd_sum as the bits are getting appended.. Hope I am clear... :) On 7/19/11, sudhanshu pandey sud.nit...@gmail.com wrote: use automata theory. draw dfa for divisibility by 3.. On Tue, Jul 19, 2011 at 11:23 PM, siva viknesh sivavikne...@gmail.comwrote: Given an infinite stream of bits with bits being appended at the highest significant position. Give an algorithm to say whether the number formed by sequence of bits that had been processed till then , is divisible by 3 or not ? My sol: have a variable sum...find the sum of bitswhenever u add a bit do sum+=bit value ... check whether sum%3==0. Is my solution ok?? anyother good solutions ?? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- SUDHANSHU PANDEY --only fair thing in this world is a chance-- -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- *Piyush Sinha* *IIIT, Allahabad* *+91-7483122727* * https://www.facebook.com/profile.php?id=10655377926 NEVER SAY NEVER * -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Somnath Singh -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Cheers, Vicky -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Somnath Singh -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group
Re: [algogeeks] MS ques
use automata theory. draw dfa for divisibility by 3.. On Tue, Jul 19, 2011 at 11:23 PM, siva viknesh sivavikne...@gmail.comwrote: Given an infinite stream of bits with bits being appended at the highest significant position. Give an algorithm to say whether the number formed by sequence of bits that had been processed till then , is divisible by 3 or not ? My sol: have a variable sum...find the sum of bitswhenever u add a bit do sum+=bit value ... check whether sum%3==0. Is my solution ok?? anyother good solutions ?? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- SUDHANSHU PANDEY --only fair thing in this world is a chance-- -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] MS ques
Divisibility of 3 of numbers in base 2 can be seen same as divisibility of numbers by 11 in base 10... maintain two variable even_sum odd_sum, both initialized to 0 when an odd location in the number is set increment odd_sum when an even location in the number is set increment even_sum if(abs(even_sum-odd_sum)%3==0) number is divisible by 3... Hence keep the track of even_sum and odd_sum as the bits are getting appended.. Hope I am clear... :) On 7/19/11, sudhanshu pandey sud.nit...@gmail.com wrote: use automata theory. draw dfa for divisibility by 3.. On Tue, Jul 19, 2011 at 11:23 PM, siva viknesh sivavikne...@gmail.comwrote: Given an infinite stream of bits with bits being appended at the highest significant position. Give an algorithm to say whether the number formed by sequence of bits that had been processed till then , is divisible by 3 or not ? My sol: have a variable sum...find the sum of bitswhenever u add a bit do sum+=bit value ... check whether sum%3==0. Is my solution ok?? anyother good solutions ?? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- SUDHANSHU PANDEY --only fair thing in this world is a chance-- -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- *Piyush Sinha* *IIIT, Allahabad* *+91-7483122727* * https://www.facebook.com/profile.php?id=10655377926 NEVER SAY NEVER * -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] MS ques
The above method is good , I was going to suggest another algo it takes the same complexity but lengthy so I am not posting my algo... On 7/19/11, Piyush Sinha ecstasy.piy...@gmail.com wrote: Divisibility of 3 of numbers in base 2 can be seen same as divisibility of numbers by 11 in base 10... maintain two variable even_sum odd_sum, both initialized to 0 when an odd location in the number is set increment odd_sum when an even location in the number is set increment even_sum if(abs(even_sum-odd_sum)%3==0) number is divisible by 3... Hence keep the track of even_sum and odd_sum as the bits are getting appended.. Hope I am clear... :) On 7/19/11, sudhanshu pandey sud.nit...@gmail.com wrote: use automata theory. draw dfa for divisibility by 3.. On Tue, Jul 19, 2011 at 11:23 PM, siva viknesh sivavikne...@gmail.comwrote: Given an infinite stream of bits with bits being appended at the highest significant position. Give an algorithm to say whether the number formed by sequence of bits that had been processed till then , is divisible by 3 or not ? My sol: have a variable sum...find the sum of bitswhenever u add a bit do sum+=bit value ... check whether sum%3==0. Is my solution ok?? anyother good solutions ?? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- SUDHANSHU PANDEY --only fair thing in this world is a chance-- -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- *Piyush Sinha* *IIIT, Allahabad* *+91-7483122727* * https://www.facebook.com/profile.php?id=10655377926 NEVER SAY NEVER * -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Somnath Singh -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] MS Ques
Reversing linked list works.. A followup question will be without using the reversal...For that we should first traverse the longest linked list such a way that it's remaining length is equal to other linked list and multiply using recursion.. After that based on carry.. you should repeat again for leading nodes in larger linked list.. hope i made my point clear.. On Mon, Jul 18, 2011 at 2:39 AM, Piyush Sinha ecstasy.piy...@gmail.comwrote: check my code below...it works for all cases * **node *MUL(node *h1,node *h2) { node *h3,*p,*r; h1 = reverse(h1); h2 = reverse(h2); h3 = multiply(h1,h2-data); h2 = h2-next; p = h3; while(h2) { r = multiply(h1,h2-data); p-next = add(p-next,r); p = p-next; h2 = h2-next; } h3 = reverse(h3); return h3; } **node *multiply(node *h,int x) { node *head = NULL; node *p; int mul,carry=0; while(h) { if(!head) { head = (node *)malloc(sizeof(node)); mul = (x*(h-data)); carry = mul/10; mul=mul%10; head-data=mul; head-next = NULL; p = head; } else { p-next = (node *)malloc(sizeof(node)); p = p-next; p-next = NULL; mul = (x*(h-data)); p-data = (mul%10)+carry; carry = mul/10; } h = h-next; } if(carry) { p-next = (node *)malloc(sizeof(node)); p = p-next; p-next = NULL; p-data = carry; } return head; } node * add(node *h1,node *h2) { node *h3 = NULL; node *p; int sum,carry = 0; while(h1) { sum = h1-data+h2-data+carry; carry = sum/10; sum = sum%10; if(h3==NULL) { h3 = (node *)malloc(sizeof(node)); h3-data = sum; h3-next = NULL; p =h3; } else { p-next = (node *)malloc(sizeof(node)); p = p-next; p-next = NULL; p-data = sum; } h1 = h1-next; h2 = h2-next; } while(h2) { p-next= (node *)malloc(sizeof(node)); p = p-next; p-next = NULL; sum = h2-data + carry; carry = sum/10; sum = sum%10; p-data = sum; h2 = h2-next; } if(carry) { p-next = (node *)malloc(sizeof(node)); p = p-next; p-next = NULL; p-data = carry; } return h3; } * On Mon, Jul 18, 2011 at 2:34 AM, aditi garg aditi.garg.6...@gmail.comwrote: and 6 is carry forwarded??? next node wud be 6*7=42+6=48 8 and 4 carry? On Mon, Jul 18, 2011 at 2:28 AM, hary rathor harry.rat...@gmail.comwrote: sorry 7*9=63 put 3 in list 3 -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Aditi Garg Undergraduate Student Electronics Communication Divison NETAJI SUBHAS INSTITUTE OF TECHNOLOGY Sector 3, Dwarka New Delhi 9718388816 -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- *Piyush Sinha* *IIIT, Allahabad* *+91-7483122727* * https://www.facebook.com/profile.php?id=10655377926 NEVER SAY NEVER * -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] ms ques
Offcourse destructor is needed or smart pointer will do for dynamic memory allocation.local variable r stored in stack it is been handled in run time . On 7/18/11, sivaviknesh s sivavikne...@gmail.com wrote: Implement a C++ garbage collector efficiently..any ideas ??? ..shud we need to do something with destructor??? -- Regards, $iva -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Somnath Singh -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] ms ques
Use smart pointers from boost library. On Mon, Jul 18, 2011 at 10:24 PM, sivaviknesh s sivavikne...@gmail.comwrote: Implement a C++ garbage collector efficiently..any ideas ??? ..shud we need to do something with destructor??? -- Regards, $iva -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] ms ques
1st convert base 5 to base 10 and then base 10 to base 9 On Mon, Jul 18, 2011 at 11:54 PM, sivaviknesh s sivavikne...@gmail.comwrote: convert a number in base 5 to base 9 -- Regards, $iva -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] ms ques
is there any direct conversion possible like from 2 to 16 ?? On Mon, Jul 18, 2011 at 11:56 PM, Nishant Mittal mittal.nishan...@gmail.com wrote: 1st convert base 5 to base 10 and then base 10 to base 9 On Mon, Jul 18, 2011 at 11:54 PM, sivaviknesh s sivavikne...@gmail.comwrote: convert a number in base 5 to base 9 -- Regards, $iva -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Varun Pahwa B.Tech (IT) 7th Sem. Indian Institute of Information Technology Allahabad. Ph : 09793899112 Official Email :: rit2008...@iiita.ac.in Another Email :: varunpahwa.ii...@gmail.com People who fail to plan are those who plan to fail. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] ms ques
Use logarithms and the properties that follow. Let the number be n Find log to the base 5 of n =*X*= *log*(n)/*log*(5) here *log* refers to base 10 Find log to the base 9 = *X*/(log to the base 5 of 9) Done! On 18 July 2011 23:58, varun pahwa varunpahwa2...@gmail.com wrote: is there any direct conversion possible like from 2 to 16 ?? On Mon, Jul 18, 2011 at 11:56 PM, Nishant Mittal mittal.nishan...@gmail.com wrote: 1st convert base 5 to base 10 and then base 10 to base 9 On Mon, Jul 18, 2011 at 11:54 PM, sivaviknesh s sivavikne...@gmail.comwrote: convert a number in base 5 to base 9 -- Regards, $iva -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Varun Pahwa B.Tech (IT) 7th Sem. Indian Institute of Information Technology Allahabad. Ph : 09793899112 Official Email :: rit2008...@iiita.ac.in Another Email :: varunpahwa.ii...@gmail.com People who fail to plan are those who plan to fail. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] ms ques
we can use auto_ptr class defined in std to implement garbage collector.. by using reference count method On Mon, Jul 18, 2011 at 10:45 PM, Vivek Srivastava srivastava.vivek1...@gmail.com wrote: Use smart pointers from boost library. On Mon, Jul 18, 2011 at 10:24 PM, sivaviknesh s sivavikne...@gmail.comwrote: Implement a C++ garbage collector efficiently..any ideas ??? ..shud we need to do something with destructor??? -- Regards, $iva -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] MS Ques
p=L1 q=L2 while(p!=NULL q!=NULL) {int r; r-=p-info*q-info; p=p-next; q=q-next; insert(L3,r); } insert is the normal insert operation of linked list On Mon, Jul 18, 2011 at 1:15 AM, swetha rahul swetharahu...@gmail.comwrote: Hi, Given 2 linked lists L1 and L2 create a linked list that gives the multiplication of the above 2 linked lists. Eg: L1 =1-5 L2 =1-0 Ans must be 1-5-0 -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Aditi Garg Undergraduate Student Electronics Communication Divison NETAJI SUBHAS INSTITUTE OF TECHNOLOGY Sector 3, Dwarka New Delhi 9718388816 -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] MS Ques
aditi : problem your code 1 .you are not putting single digit in third list but whole multiplication of two digit 2. forward add carry to next result ; 3. keep mind that list size may not be equal 4. list is singly so start processing from right side you need reverse them -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] MS Ques
@Hary i dint understand wat do u mean by saying list is sinle so strt processing from rightcan u gv an example with the list containing more than 1 node and show me wat wud be the output On Mon, Jul 18, 2011 at 2:13 AM, hary rathor harry.rat...@gmail.com wrote: aditi : problem your code 1 .you are not putting single digit in third list but whole multiplication of two digit 2. forward add carry to next result ; 3. keep mind that list size may not be equal 4. list is singly so start processing from right side you need reverse them -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Aditi Garg Undergraduate Student Electronics Communication Divison NETAJI SUBHAS INSTITUTE OF TECHNOLOGY Sector 3, Dwarka New Delhi 9718388816 -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] MS Ques
int means 1-5-6-7 2-7-9 means you will multiply 7*9 result 9 insert in 3rd list so start from end of list not from start now do you under stand -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] MS Ques
r v not supposed to actually mutiply?? 7*9 y shud v place 9 in the third list?? On Mon, Jul 18, 2011 at 2:25 AM, hary rathor harry.rat...@gmail.com wrote: int means 1-5-6-7 2-7-9 means you will multiply 7*9 result 9 insert in 3rd list so start from end of list not from start now do you under stand -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Aditi Garg Undergraduate Student Electronics Communication Divison NETAJI SUBHAS INSTITUTE OF TECHNOLOGY Sector 3, Dwarka New Delhi 9718388816 -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] MS Ques
sorry 7*9=63 put 3 in list 3 -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] MS Ques
and 6 is carry forwarded??? next node wud be 6*7=42+6=48 8 and 4 carry? On Mon, Jul 18, 2011 at 2:28 AM, hary rathor harry.rat...@gmail.com wrote: sorry 7*9=63 put 3 in list 3 -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Aditi Garg Undergraduate Student Electronics Communication Divison NETAJI SUBHAS INSTITUTE OF TECHNOLOGY Sector 3, Dwarka New Delhi 9718388816 -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] MS Ques
check my code below...it works for all cases * **node *MUL(node *h1,node *h2) { node *h3,*p,*r; h1 = reverse(h1); h2 = reverse(h2); h3 = multiply(h1,h2-data); h2 = h2-next; p = h3; while(h2) { r = multiply(h1,h2-data); p-next = add(p-next,r); p = p-next; h2 = h2-next; } h3 = reverse(h3); return h3; } **node *multiply(node *h,int x) { node *head = NULL; node *p; int mul,carry=0; while(h) { if(!head) { head = (node *)malloc(sizeof(node)); mul = (x*(h-data)); carry = mul/10; mul=mul%10; head-data=mul; head-next = NULL; p = head; } else { p-next = (node *)malloc(sizeof(node)); p = p-next; p-next = NULL; mul = (x*(h-data)); p-data = (mul%10)+carry; carry = mul/10; } h = h-next; } if(carry) { p-next = (node *)malloc(sizeof(node)); p = p-next; p-next = NULL; p-data = carry; } return head; } node * add(node *h1,node *h2) { node *h3 = NULL; node *p; int sum,carry = 0; while(h1) { sum = h1-data+h2-data+carry; carry = sum/10; sum = sum%10; if(h3==NULL) { h3 = (node *)malloc(sizeof(node)); h3-data = sum; h3-next = NULL; p =h3; } else { p-next = (node *)malloc(sizeof(node)); p = p-next; p-next = NULL; p-data = sum; } h1 = h1-next; h2 = h2-next; } while(h2) { p-next= (node *)malloc(sizeof(node)); p = p-next; p-next = NULL; sum = h2-data + carry; carry = sum/10; sum = sum%10; p-data = sum; h2 = h2-next; } if(carry) { p-next = (node *)malloc(sizeof(node)); p = p-next; p-next = NULL; p-data = carry; } return h3; } * On Mon, Jul 18, 2011 at 2:34 AM, aditi garg aditi.garg.6...@gmail.comwrote: and 6 is carry forwarded??? next node wud be 6*7=42+6=48 8 and 4 carry? On Mon, Jul 18, 2011 at 2:28 AM, hary rathor harry.rat...@gmail.comwrote: sorry 7*9=63 put 3 in list 3 -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Aditi Garg Undergraduate Student Electronics Communication Divison NETAJI SUBHAS INSTITUTE OF TECHNOLOGY Sector 3, Dwarka New Delhi 9718388816 -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- *Piyush Sinha* *IIIT, Allahabad* *+91-7483122727* * https://www.facebook.com/profile.php?id=10655377926 NEVER SAY NEVER * -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] MS Ques
Can we do it using suffix trees and apply DFS on it?? On Tue, Jul 5, 2011 at 11:45 PM, swetha rahul swetharahu...@gmail.comwrote: Hi, Write a function which takes two char * s as inputs, one is a regular expression pattern and the other is a test string and check whether the test string is of the given regular expression pattern. The regular expression pattern can contain all lower-case letter, asterisk and question mark. As usual asterisk stands for 0 or more number of chars and ? for any one char. E.g. Regular Expression: a*b?c Test String: aaavcxbmbcxmbkc Result: TRUE Test String: abc Result: FALSE Test String: abzx Result: TRUE What is d best way 2 do this... -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- *Piyush Sinha* *IIIT, Allahabad* *+91-8792136657* *+91-7483122727* *https://www.facebook.com/profile.php?id=10655377926 * -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] MS Ques
just thinking aloud.. find substrings connected by ? like b,c, ensure that b?c is found, if not return false if found find 'a' like prefix in earlier part of the string.. Best Regards Ashish Goel Think positive and find fuel in failure +919985813081 +919966006652 On Wed, Jul 6, 2011 at 12:02 AM, Piyush Sinha ecstasy.piy...@gmail.comwrote: Can we do it using suffix trees and apply DFS on it?? On Tue, Jul 5, 2011 at 11:45 PM, swetha rahul swetharahu...@gmail.comwrote: Hi, Write a function which takes two char * s as inputs, one is a regular expression pattern and the other is a test string and check whether the test string is of the given regular expression pattern. The regular expression pattern can contain all lower-case letter, asterisk and question mark. As usual asterisk stands for 0 or more number of chars and ? for any one char. E.g. Regular Expression: a*b?c Test String: aaavcxbmbcxmbkc Result: TRUE Test String: abc Result: FALSE Test String: abzx Result: TRUE What is d best way 2 do this... -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- *Piyush Sinha* *IIIT, Allahabad* *+91-8792136657* *+91-7483122727* *https://www.facebook.com/profile.php?id=10655377926 * -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] ms ques
http://samples.msdn.microsoft.com/ietestcenter/ On Fri, May 27, 2011 at 9:40 AM, radha krishnan radhakrishnance...@gmail.com wrote: Check whether this is storing Google Search Results ? ? ?? ? ? ? ? ?? [HONEY POTTING] On Fri, May 27, 2011 at 10:07 PM, UTKARSH SRIVASTAV usrivastav...@gmail.com wrote: test cases for internet explorer -- *UTKARSH SRIVASTAV CSE-3 B-Tech 2nd Year @MNNIT ALLAHABAD* -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.