How to find the sum of prime numbers between 1 and 1.
I don't expected traversal of the whole range and find primes and sum
uping
Any other logic is there?? i think we need deep mathematics for this .
--
You received this message because you are subscribed to the Google Groups
Algorithm
@Adam
input : root node address of the tree and root address of the node to
be searched.
assume depth of the tree is also given.
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algoge...@googlegroups.com.
@ Yan Wang
superb idea !
how much will be time space complexity?
but actually i was expecting any solution without modifying the tree.
If a tree {value,lptr,rptr} is given then we have to create another
tree or temp-array
to represent parent.
any sort of recursion will help??
--
You received
How to print the path from root to a specific node in a binary tree??
I want to store the path in a array[] of node*.
can it b done in O(n) or less?
Remember it's not BST.
1
/ \
2 3
/ \ / \
4 5 67
/ \/ \
thanks to all
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this
Hi ,
I am working on a project where i need to call Google search form a
Java servlet program.1 string containing the query is supposed to pass
to the Google search engine and results must display through my
program .I am also trying to copy the top results and some text(first
2-3 lines what
what is actually spiral traversal ??? can any please give sample tree
and spiral traversal .
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send
Array of 2n length is given {a1,a2,a3,...,an,b1,b2,b3,...,bn}
we have to make the array like as {a1,b1,a2,b2,a3,b3,...,an,bn}
without using extra buffer space.
here a solution i came up with
http://codepad.org/ub5Ie4sI
I know this was discussed before .
But i want to know the time complexity of
why u have chosen that 23 ?
why dividing by 3 ?
don't understand the logic.
Please explain so that it become understandable.
On 7/31/10, Dave dave_and_da...@juno.com wrote:
Use the rejection method...
int rand7()
{
int i;
do
i = 5 * rand5() + rand5() - 3;
while( i 23
@rahul
how to convert bst ot doubly linked list.
I m understanding the logic but not able to code
give a pseudo code to understand.
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to
for(i=sizeof(int)*8-1;i=0;i--)
{
if((numberi)1)
{
number=number^(1i);
break;
}
}
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to
how to implement xor list ? i.e. doubly linked list using single
pointer .
I don't understand how we can write code insertion deletion
(beginning,end,middle )
traversing ( forward and backward )
Please give a easy code(C) to understand.
--
You received this message because you are subscribed
An array contains the set of positive integer. Find the largest number
c such that c=a+b where a,b,c are distinct number of the set?
[Consider , reducing complexity]
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send
@Gene
Please explain the recursive function and the first if condition i
m not getting it.
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group,
I was talking about this approach.
for( left_top_i=0 ; left_top_irow_no ; left_top_i++ )
for( left_top_j=0 ; left_top_jcol_size ; left_top_j++ )
for( bottom_right_i=left_top_i ; bottom_right_irow_size ;
bottom_right_i++ )
for( bottom_right_j=left_top_j ; bottom_right_jrow_size ;
bottom_right_j++
i don't understand what this statement will do ?
scanf(%2d%3d,a,b);
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to
p=(char *)a;
this statement assigns value of 7 to p after type converting to char*,
so as p is a pointer it points to memory location 7
p[b] will give to the value at location 9 same as *(p+b) = *(7 + 2)
just like array
p[b] will give the address of that location i.e. 9 which is char*
so we type
@ souravsain
Don't understand your solution.
if u type convert to char how u can say that msb is in higher memory address?
i think (char) will alway give the value of the lsb.
How u r checking endian ness?
normal endian ness check program
main()
{
int i=1;
char *p=(char*)i;
if(*p==1)
printf(Small
@jalaj jaiswal
given array contain 3,6 both r unique.
Is this the exact question?
if array is 6,3,4,1,4,5,6,1,5 than we can solve using xor properties.
int a,b=5;
a=b^b; //value of a is 0 convert in binery form and do u will get
a=0^a;//value of a is a itselt
Program:
Don't understand the question.
explain differently.
On 6/14/10, siddharth srivastava akssps...@gmail.com wrote:
I have this code snippet:
This code snippet defines a boundary coordinates on the screen wrt to the
center(of the screen).
if( x x_center )
x_border = x_center -
1.
i think if the total no of bits is within no of bits in a int , the
size will b same as int .
here total bits 3 32 (bits in int according to gcc, in Turbo c its 16)
so size of structure will be 4(in gcc), 2 (in TC)
if total no of bits is 40 (suppose) than size will be 8(in GCC) , 4(in TC)
Its not a tough question.Basic arithmetics/algebra question.
ACB
Suppose speed of train from A =x
Suppose speed of train from B =y
They meet at C
1st train take a sec to reach C from B
CB=ax
2nd train take b sec to reach C from A
CA=bx
Time taken for
0,1,01000,00100,00010,1,10100,10010,10001,01010,01001,00101,10101
no of sequence =13
so its coming in fibo no.
no of sequence =fibo(n+2)if you exclude 0 from fibo no
no of sequence =fibo(n+3)if you include 0 in fibo no
On Fri, Jun 11, 2010 at 1:55 PM, Debajyoti Sarma
sarma.debajy...@gmail.comwrote
and Engineering
IIT Bombay
http://www.cse.iitb.ac.in/~rohitfeb14http://www.cse.iitb.ac.in/%7Erohitfeb14
On Wed, Jun 9, 2010 at 2:37 PM, Debajyoti Sarma
sarma.debajy...@gmail.com wrote:
First 20 fibo no as follows with binary form
0 = 0
1 = 1
1 = 1
2 = 10
3 = 11
5 = 101
8
First 20 fibo no as follows with binary form
0 = 0
1 = 1
1 = 1
2 = 10
3 = 11
5 = 101
8 = 1000
13 = 1101
21 = 10101
34 = 100010
55 = 110111
89 = 1011001
144 = 1001
233 = 11101001
377 = 10001
610 = 1001100010
987 = 011011
1597 = 1100001
2584 = 10111000
4181 =
because,
only the perfect square number has odd number of factors.
so, toggling will make those door to remain open.
Like open-close-open-close-open (odd no of toggle)
On 5/31/10, sharad kumar aryansmit3...@gmail.com wrote:
@veera:only the perfect square numbers will be open
1,4,9,16,25...100
26 matches
Mail list logo