Re: [algogeeks] O(n) solution is there or not!!

2012-08-21 Thread pankajsingh
@carl-Sorry was making suffix array by naive approx in the link http://en.wikipedia.org/wiki/Suffix_array .there are more optimized algos for it...!! thanks -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to

[algogeeks]

2012-08-21 Thread Wladimir Tavares
Somebody could explain to me why this happen: x = (131); printf(%d\n,x); if(x0) x = -x; printf(%d\n,x); Output: -2147483648 -2147483648 Wladimir Araujo Tavares *Federal University of Ceará http://lia.ufc.br/%7Ewladimir/ Homepage http://lia.ufc.br/%7Ewladimir/ |

Re: [algogeeks]

2012-08-21 Thread Wladimir Tavares
int Wladimir Araujo Tavares *Federal University of Ceará http://lia.ufc.br/%7Ewladimir/ Homepage http://lia.ufc.br/%7Ewladimir/ | Maratonahttps://sites.google.com/site/quixadamaratona/| * On Tue, Aug 21, 2012 at 1:28 PM, gmagog...@gmail.com gmagog...@gmail.comwrote: what type is x? Yanan

Re: [algogeeks]

2012-08-21 Thread Wladimir Tavares
int Wladimir Araujo Tavares *Federal University of Ceará http://lia.ufc.br/%7Ewladimir/ Homepage http://lia.ufc.br/%7Ewladimir/ | Maratonahttps://sites.google.com/site/quixadamaratona/| * On Tue, Aug 21, 2012 at 1:28 PM, gmagog...@gmail.com gmagog...@gmail.comwrote: what type is x? Yanan

[algogeeks] Re:

2012-08-21 Thread Dave
@Wladimirufc: You responded that the type is int. This data type (usually) is 32 bits in length, and stores integers in the twos-complement number system. See http://en.wikipedia.org/wiki/Two%27s_complement for an explanation of this number system. In this number system, the bits (numbered 0

Re: [algogeeks] Re:

2012-08-21 Thread gmagog...@gmail.com
@dave Nice explanation! Yanan Cao On Tue, Aug 21, 2012 at 10:32 AM, Dave dave_and_da...@juno.com wrote: @Wladimirufc: You responded that the type is int. This data type (usually) is 32 bits in length, and stores integers in the twos-complement number system. See

[algogeeks] JAVA PROGRAM ERROR

2012-08-21 Thread Rajesh Kumar
class StringTimes { public static void main(String args[]) { String str=Hi; long i=2; String get; get=stringTimes(str,i); System.out.println(get); } public static String stringTimes(String str,long x) { int i; String set=str; for(i=0;in-1;i++) { set+=str; } return set; } } OUTPUT should

[algogeeks] question

2012-08-21 Thread megha agrawal
Can anyone suggest solution for this problem? You are given an unsigned integer.Write a function to print the next number which will be having same number of 1 bits present in given num. eg) 6(110) to 9(1001) -- You received this message because you are subscribed to the Google

Re: [algogeeks] question

2012-08-21 Thread Arun Kindra
a) count total no of bit set in given no b) increment the given no by one and count the no of bit set in it if it equal to the above count then return else increment the no till u get the count equals the above one. -- You received this message because you are subscribed to the Google Groups

Re: [algogeeks] JAVA PROGRAM ERROR

2012-08-21 Thread Rohit Singhal
what error it is showing On Wed, Aug 22, 2012 at 12:41 AM, Rajesh Kumar testalgori...@gmail.comwrote: class StringTimes { public static void main(String args[]) { String str=Hi; long i=2; String get; get=stringTimes(str,i); System.out.println(get); } public static String

Re: [algogeeks] Re:

2012-08-21 Thread Wladimir Tavares
I understand two complement but i don`t knew it this instruction x = -x was translate in x =(~x) + 1 thanks! Wladimir Araujo Tavares *Federal University of Ceará http://lia.ufc.br/%7Ewladimir/ Homepage http://lia.ufc.br/%7Ewladimir/ | Maratonahttps://sites.google.com/site/quixadamaratona/| *

[algogeeks] Re: question

2012-08-21 Thread Dave
@Megha: Answered in one line of code in the post https://groups.google.com/d/msg/algogeeks/Fa-5AQR3ACU/jlmjb_nEZCsJ, which also contains a link to an explanation of how the algorithm works. Dave On Tuesday, August 21, 2012 8:23:21 AM UTC-5, megha agrawal wrote: Can anyone suggest

Re: [algogeeks] Re:

2012-08-21 Thread Dave
@Wladimirufc: As I said, this is the functional equivalent. Most computer cpus would have a negate instruction which performs these operations in the chip's circuitry, or achieve the same result by subtraction from zero. Dave On Tuesday, August 21, 2012 4:58:14 PM UTC-5, wladimirufc wrote:

[algogeeks] Re: plz explain output y it is 1212

2012-08-21 Thread SK
Your program will give the compilation error because you escaped `` by putting \. If you remove the `` escape then it works fine. C has fixed set of escape character which it understand and if it is unable to understand then it remove the escape character(\) and keep the remaining part. In