@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
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
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
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
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...
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
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
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
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
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
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
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
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
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
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,
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
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
@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
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
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
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
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
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
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
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
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
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,
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
28 matches
Mail list logo