[algogeeks] Re: New Generation Lossless Data Representations

2010-08-13 Thread LawCounsels
On Aug 11, 6:30 am, LawCounsels lawcouns...@aol.com wrote: Warm Greetings : here is link to download a 'mathematics structure' encoding of a complete random 4,074 bits long file (a random chosen part of Mark Nelson's AMillionRandomDigits.bin challenge) www dot box dot net/shared/eyy2v28dbf

[algogeeks] Re: Dynamic Programming Problem on Strings

2010-08-13 Thread vikas kumar
what about printing these strings onto terminal. can printing of the string is also similar. I tried to develop the algo but got messed up.can some one help? On Aug 8, 2:53 am, Amir hossein Shahriari amir.hossein.shahri...@gmail.com wrote: @ankur: dp[i][j] number of (prefix) strings that have i

[algogeeks] Copy Constructor

2010-08-13 Thread amit
why copy constructor must pass by reference? -- 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] Re: Median of two arrays..

2010-08-13 Thread sachin
If the ranges of the arrays are 1..n 1..m, then we can solve it this way if ((m+n)1){ we can go with the method same as rahul patil's and in the condition we can use count=(m+n)/2+1, the median will be stored in res. } else{ we can go with the method same as rahul patil's and in the

[algogeeks] Generate all bit strings of length n

2010-08-13 Thread Raj N
Hi, Can someone gimme the code to generate all possible bit strings of length n recursively ? -- 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

[algogeeks] Line Seprating the points

2010-08-13 Thread amit
Within a 2D space, there is a batch of points(no duplicate) in the region (0,0),(0,1),(1,0),(1,1), try to find a line which can divide the region to 2 parts with half points in each .the input will be an array of points and the length of the array. struct point{ int x; int y; }; -- You received

[algogeeks] Re: Line Seprating the points

2010-08-13 Thread Dave
Pick a random point (x0,y0) in the plane that is not equal to any of the given points (x_i,y_i). For each i, calculate the slope m_i of the line that passes through (x0,y0) and (x_i,y_i). Find the median M of the slopes. If there are two or more slopes equal to M, start over with a new random

[algogeeks] Re: codechef problem

2010-08-13 Thread gaurav
first k digits (unsigned long) floor (pow(10.0,modf(n*log((double)n),dummy)+k-1) log is on d base 10 last k digits int func(int n,int k){ int m=1; for(;k0;k--) m*=10; r=1; t=n%m; while(n){ if(n%2) r=r * t%m; t=t * t%m; n=1; } return r; } -- You received this message because

Re: [algogeeks] Generate all bit strings of length n

2010-08-13 Thread Chonku
Start with number 1. It will have a binary representation of 00...1 (Total of n-bits) Keeping adding 1 to it until you reach a number with all 1's in its binary representation. On Thu, Aug 12, 2010 at 2:00 PM, Raj N rajn...@gmail.com wrote: Hi, Can someone gimme the code to generate all

[algogeeks] System.out.println(2.0-1.10)

2010-08-13 Thread navin
this statement System.out.println(2.0-1.10); produces 0.8999 can anyone explain. Mathematically result has to be 0.9 but it gives 0.8999 why? Thanks. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this

[algogeeks] Re: Generate all bit strings of length n

2010-08-13 Thread sourav
consider a link list l which can contain nodes representing the bits GenerateBitStrings(int length) { if (length == 0) { //print all values in link list l } Add 1 to l call GenerateBitString(length-1) Remove the 1 that was added. Add 0 to l call GenerateBitString(length-1)

Re: [algogeeks] Copy Constructor

2010-08-13 Thread Raj N
This has already been discussed a lot many times. Please check older posts !! On Thu, Aug 12, 2010 at 3:44 AM, amit amitjaspal...@gmail.com wrote: why copy constructor must pass by reference? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group.

Re: [algogeeks] Re: Median of two arrays..

2010-08-13 Thread Raj N
Can someone tell me what do you mean by median of 2 arrays ? Is it that the sorted arrays are merged and finding the median of resulting one? On Fri, Aug 13, 2010 at 1:32 AM, sachin sachin_mi...@yahoo.co.in wrote: If the ranges of the arrays are 1..n 1..m, then we can solve it this way

Re: [algogeeks] System.out.println(2.0-1.10)

2010-08-13 Thread Mihai Donțu
On Friday 13 August 2010 16:40:41 navin wrote: this statement System.out.println(2.0-1.10); produces 0.8999 can anyone explain. Mathematically result has to be 0.9 but it gives 0.8999 why? Thanks. A classic floating point problem. A quick search in Google gave me

Re: [algogeeks] Re: Median of two arrays..

2010-08-13 Thread Nikhil Agarwal
Check this code int med1,med2; void func(int a[], int x1, int x2, int b[], int y1, int y2){ int midx,midy; if((y2-y1+1)==2) { med1=max(a[x1],b[y1]); med2=min(a[x2],b[y2]); return; } midx=(x1+x2)/2; midy=(y1+y2)/2; if(a[midx]b[midy]){ x2=x2-(midy-y1); y1=midy; }else{y2=y2-(midx-x1); x1=midx;