[algogeeks] reverse all the bits in a unsigned integer

2007-03-20 Thread hijkl
. How to reverse all the bits in a unsigned integer? an signed integer (you have to keep the sign of the integer)? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send

[algogeeks] find the closest common ancestor of node u and v?

2007-03-20 Thread hijkl
For the following definition of a binary tree node typedef struct _Node { _Node * Left; _Node * Rigth; _Node * Parent; } Node; Given 2 nodes u and v from a tree, find the closest common ancestor of u and v? Node* ClosestCommonAnces

[algogeeks] traverse the tree layer by layer.

2007-03-20 Thread hijkl
traverse the tree layer by layer. void BF_Traverse(Node* r) --~--~-~--~~~---~--~~ 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

[algogeeks] count the 1 bits in integer

2007-03-20 Thread hijkl
How to count the 1 bits in a integer? int Count1Bits(int i); How about this function is used very often? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send e

[algogeeks] print n bit numbers in binary format..

2007-03-20 Thread hijkl
Using 4 binary bits you can represent 16 numbers, from to . How can you print all these 16 numbers in binary format, i.e. "", "0001", "0010" You can choose whatever order to print. Now give you n bits, how can you print out all the n bit numbers in binary format? Can you write a r

[algogeeks] Re: 2D arrays

2007-03-17 Thread hijkl
int main() { int n=9,half; char a[9][9]; if(n%2 == 0) half = n/2; else half = n/2 + 1; for(int i=0; i wrote: > OK, I need to write an algorithm to populate a 2D array A(i,j) of size > n x n. There is 1 '*' in the 1s

[algogeeks] Re: Solutions to CORMEN uploaded in files section

2007-03-17 Thread hijkl
On Mar 9, 5:05 am, "infinite" <[EMAIL PROTECTED]> wrote: > Find solutions to cormen Algorithms book in files section that is just wonderful thanks a lot --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Algor

[algogeeks] Re: dynamic memory allocation in C

2007-03-13 Thread hijkl
hi Peri, you can't use this int number int array[number]; and also wat is the value of "number"? array size should be constant. example int array[10]; if you not sure about array size initially and need to assign at run time then you need to allocate it as dynamic. you can do something like thi

[algogeeks] Re: fibonacci numbers

2007-01-22 Thread hijkl
generate fibonacci numbers untill it exceeds given number x. i.e. n1=1; while(n<=x){ prev=n1; n1 = next fibonacci number; } n2= n1+prev; any comments?? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Algorithm

[algogeeks] Re: spiral matrix..

2007-01-20 Thread hijkl
question is to form a spiral metrix --~--~-~--~~~---~--~~ 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

[algogeeks] spiral matrix..

2006-12-05 Thread hijkl
this question was asked by Google.. "Write a program of spiral matrix" ie. it takes inputs and puts in to matrix as a spiral..example. given : 3 X 4 matrix your input in this order : 1 5 8 9 10 7 4 8 0 2 3 6 will generate following matrix 1 5 8 9 2 3 6 10 0 8 4 7 and big O notatio