Re: [algogeeks] CAN ANYBODY HELP ME ?!! WİTH THİS ALGORİTHM

2018-11-06 Thread Rahul Rai
Let the glass be numbered 0 1 2 3... (2n - 1).
And the glass numbered 0 1 2 3...(n - 1)  are filled.
Pick every alternating ith filled glass starting from 1 indexed glass and
swap it with the (n - 1 - i)th unfilled glass.

Index 1 will swap with 2n - 2 indexed glass.
Index 3 will swap with 2n - 4 indexed glass.
.
.
.
So on.

Since the first glass is filled and there are 2n glasses(last glass being
indexed by 2n - 1) so the second glass (2n - 2 indexed glass) from the end
must be filled after processing.

On Tue, Nov 6, 2018, 16:24 mehmet ozturk  There are 2n glasses standing next to each other in a row, the first n of
> them are filled with
> a soda drink, while the remaining n glasses are empty. Make the glasses
> alternate in a filledempty-
> filled-empty pattern in the minimum no of glass moves.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to algogeeks+unsubscr...@googlegroups.com.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to algogeeks+unsubscr...@googlegroups.com.


[algogeeks] Doubt Related To Java

2011-08-11 Thread rahul rai
public class JoyOfHex {

public static void main(String[] args) {

System.out.println(

Long.toHexString(0x1L + 0xcafebabe));

}

}


I got the problem from Java Puzzlers Book

Here Is Their Explanation ::

Decimal literals have a nice property that is not shared by
hexadecimal or octal literals: Decimal literals are all positive [JLS
3.10.1]. To write a negative decimal constant, you use the unary
negation operator (-) in combination with a decimal literal. In this
way, you can write any int or long value, whether positive or
negative, in decimal form, and negative decimal constants are clearly
identifiable by the presence of a minus sign. Not so for hexadecimal
and octal literals. They can take on both positive and negative
values. Hex and octal literals are negative if their high-order bit is
set. In this program, the number 0xcafebabe is an int constant with
its high-order bit set, so it is negative. It is equivalent to the
decimal value -889275714.

The addition performed by the program is a mixed-type computation: The
left operand is of type long, and the right operand is of type int. To
perform the computation, Java promotes the int value to a long with a
widening primitive conversion [JLS 5.1.2] and adds the two long
values. Because int is a signed integral type, the conversion performs
sign extension: It promotes the negative int value to a numerically
equal long value.

The right operand of the addition, 0xcafebabe, is promoted to the long
value 0xcafebabeL. This value is then added to the left
operand, which is 0x1L. When viewed as an int, the high-order
32 bits of the sign-extended right operand are -1, and the high-order
32 bits of the left operand are 1. Add these two values together and
you get 0, which explains the absence of the leading 1 digit in the
program's output. Here is how the addition looks when done in
longhand. (The digits at the top of the addition are carries.)


111

  0xcafebabeL

+ 0x0001L

  0xcafebabeL






What I Do Not Understand Is That How Exactly Does  One Can See (Or
Guess)  A Hex Word --cafebabe-- and deduce that it's most significant
bit is one ergo it is going to represented as -ve :

Apologies  if I am missing something too naive

-- 
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 options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks]

2011-08-06 Thread rahul rai
http://www.rrsd.com/software_development/postmans_sort/cuj/cuj.htm

On 8/5/11, Gaurav Menghani gaurav.mengh...@gmail.com wrote:
 I agree with Dilip. It depends upon what type of input you have at hand.

 - Suppose you have an array having a million elements, where the
 elements are in the range 1-3, counting sort would be perfect.
 - However, if the range is from -10^18 to +10^18, counting sort, which
 requires O(R) memory, where R is the range of the elements, would be
 laughable. Here quick-sort or merge-sort would be better.

 Again, quick-sort is good for randomized inputs, such that the pivot
 lies roughly in the middle of every sub-array. For certain inputs, the
 performance of quick-sort degrades to O(N^2). For this reason, the
 default implementation of sort function in STL, uses 'Intro-Sort' [0]
 which is a combination of quick-sort and heap-sort (switches between
 the two depending upon the input)

 [0] http://en.wikipedia.org/wiki/Introsort

 On Fri, Aug 5, 2011 at 6:54 AM, dilip makwana dilipmakwa...@gmail.com
 wrote:
 But beware all linear sort algo have some prior constraints (such as range
 of input is predefined or such ...)
 So choose one properly 

 On 4 August 2011 23:12, Samba Ganapavarapu sambasiv...@gmail.com wrote:

 Merget Sort sorts  O(n log n) time,
 Counting sort, Radix sort sorts in O (n) time...


 On Thu, Aug 4, 2011 at 1:40 PM, Rohit jalan jalanha...@gmail.com wrote:

 Merge Sort

 On Thu, Aug 4, 2011 at 11:09 PM, parag khanna khanna.para...@gmail.com
 wrote:

 Which is fastest sorting method?

 --
 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 options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.



 --
 Regards :
 ROHIT JALAN
 B.E. Graduate,
 Computer Science Department,
 RVCE, Bangalore

 --
 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 options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.

 --
 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 options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.



 --
 Dilip Makwana
 VJTI
 BTech Computers Engineering
 2009-2013

 --
 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 options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




 --
 Gaurav Menghani

 --
 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 options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




-- 
Rahul

-- 
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 options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks]

2011-08-06 Thread rahul rai
Thats True , Even insertion and merge sorts are too ..

!!!


Rahul


On Sun, Aug 7, 2011 at 10:20 AM, Gaurav Menghani
gaurav.mengh...@gmail.comwrote:

 The Postman's sort is a variant of bucket sort that takes advantage
 of a hierarchical structure of elements, typically described by a set
 of attributes.

 It is just a variant of Bucket Sort.

 On Sun, Aug 7, 2011 at 12:42 AM, rahul rai raikra...@gmail.com wrote:
  http://www.rrsd.com/software_development/postmans_sort/cuj/cuj.htm
 
  On 8/5/11, Gaurav Menghani gaurav.mengh...@gmail.com wrote:
  I agree with Dilip. It depends upon what type of input you have at hand.
 
  - Suppose you have an array having a million elements, where the
  elements are in the range 1-3, counting sort would be perfect.
  - However, if the range is from -10^18 to +10^18, counting sort, which
  requires O(R) memory, where R is the range of the elements, would be
  laughable. Here quick-sort or merge-sort would be better.
 
  Again, quick-sort is good for randomized inputs, such that the pivot
  lies roughly in the middle of every sub-array. For certain inputs, the
  performance of quick-sort degrades to O(N^2). For this reason, the
  default implementation of sort function in STL, uses 'Intro-Sort' [0]
  which is a combination of quick-sort and heap-sort (switches between
  the two depending upon the input)
 
  [0] http://en.wikipedia.org/wiki/Introsort
 
  On Fri, Aug 5, 2011 at 6:54 AM, dilip makwana dilipmakwa...@gmail.com
  wrote:
  But beware all linear sort algo have some prior constraints (such as
 range
  of input is predefined or such ...)
  So choose one properly 
 
  On 4 August 2011 23:12, Samba Ganapavarapu sambasiv...@gmail.com
 wrote:
 
  Merget Sort sorts  O(n log n) time,
  Counting sort, Radix sort sorts in O (n) time...
 
 
  On Thu, Aug 4, 2011 at 1:40 PM, Rohit jalan jalanha...@gmail.com
 wrote:
 
  Merge Sort
 
  On Thu, Aug 4, 2011 at 11:09 PM, parag khanna 
 khanna.para...@gmail.com
  wrote:
 
  Which is fastest sorting method?
 
  --
  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 options, visit this group at
  http://groups.google.com/group/algogeeks?hl=en.
 
 
 
  --
  Regards :
  ROHIT JALAN
  B.E. Graduate,
  Computer Science Department,
  RVCE, Bangalore
 
  --
  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 options, visit this group at
  http://groups.google.com/group/algogeeks?hl=en.
 
  --
  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 options, visit this group at
  http://groups.google.com/group/algogeeks?hl=en.
 
 
 
  --
  Dilip Makwana
  VJTI
  BTech Computers Engineering
  2009-2013
 
  --
  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 options, visit this group at
  http://groups.google.com/group/algogeeks?hl=en.
 
 
 
 
  --
  Gaurav Menghani
 
  --
  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 options, visit this group at
  http://groups.google.com/group/algogeeks?hl=en.
 
 
 
 
  --
  Rahul
 
  --
  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 options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.
 
 



 --
 Gaurav Menghani

 --
 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 options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.



-- 
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

Re: [algogeeks] Aricent is coming..

2011-08-03 Thread rahul rai
this one is good too
http://www.ocf.berkeley.edu/~wwu/riddles/intro.shtml
Rahul


On Thu, Aug 4, 2011 at 9:23 AM, Akshay Rastogi akr...@gmail.com wrote:

 Any good site to prepare from besides cracktheinterview ??


 On Thu, Aug 4, 2011 at 9:22 AM, abhishek kumar 
 mailatabhishekgu...@gmail.com wrote:

 thanks..

  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To view this discussion on the web visit
 https://groups.google.com/d/msg/algogeeks/-/HvrvfCYJUsEJ.

 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 options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




 --
 AKSHAY RASTOGI
 BE(Hons) CS
 BITS PILANI , Pilani


  --
 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 options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


-- 
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 options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] C Question

2011-06-11 Thread rahul rai
To clear pointer basics and dwell deep into the subject please WORK
OUT THESE video series ALONGwith The assignments . .

http://see.stanford.edu/see/lecturelist.aspx?coll=2d712634-2bf1-4b55-9a3a-ca9d470755ee

On 6/8/11, Vishal Thanki vishaltha...@gmail.com wrote:
 Following declaration makes the x as a volatile pointer to an integer.

 int *volatile x;

 But what does following means?

 int **volatile x;

 ~Vishal

 --
 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 options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




-- 
Rahul

-- 
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 options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Algorithm or Program for convert word into number

2011-06-11 Thread rahul rai
I wonder if there is any practical use of this algorithm for real life
implementation . . Please let me know where you caught this problem

On 6/11/11, Abhishek Goswami zeal.gosw...@gmail.com wrote:
 Hi,
 Can anyone have algorithm or program for convert word into number

 Input.   Three hundred twenty three :  output 323

 InputTwenty  :  output -20

 --
 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 options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




-- 
Rahul

-- 
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 options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Algorithm or Program for convert word into number

2011-06-11 Thread rahul rai
Count the number of spaces in the sentence. If the last word is
{one/two .} the just do the calling on the speciab part of code
printing the rest of sentence

On 6/11/11, rahul rai raikra...@gmail.com wrote:
 I wonder if there is any practical use of this algorithm for real life
 implementation . . Please let me know where you caught this problem

 On 6/11/11, Abhishek Goswami zeal.gosw...@gmail.com wrote:
 Hi,
 Can anyone have algorithm or program for convert word into number

 Input.   Three hundred twenty three :  output 323

 InputTwenty  :  output -20

 --
 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 options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




 --
 Rahul



-- 
Rahul

-- 
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 options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: Google Question

2011-06-05 Thread rahul rai
I heard somewhere in some online video lecture that sites like tinyurl
change the address using more than base three {base 6 } and then apply
hash

On 6/4/11, bittu shashank7andr...@gmail.com wrote:
 well i can speak much on these question.as these algorithms are part
 of web crawler ..but do u mean we have to detect the duplicate files,
 by file having same size are duplicates..??

 also same question raised by me few days back Detecting Duplicate
 Documents but no one seems to interested u can  search previous
 threads..

 Thanks
 Shashank

 --
 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 options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




-- 
Rahul

-- 
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 options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks]

2011-05-07 Thread rahul rai
Your Black and white problem is a simple pattern detection /edge
detection problem , any course on Digital Image Processing will have a
number of algorithms for that and even detecting and counting similar
shapes throughout a Matrix

On 5/5/11, sourabh jakhar sourabhjak...@gmail.com wrote:
 -

 Given a white background with a black random shape scattering around.
 Describe and code an algorithm to count the number of black shapes. You can
 assume input to be an array of 3xMxN in RGB color space.
 2
 SOURABH JAKHAR,(CSE)(3 year)
 ROOM NO 167 ,
 TILAK,HOSTEL
 'MNNIT ALLAHABAD

 The Law of Win says, Let's not do it your way or my way; let's do it the
 best way.

 --
 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 options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




-- 
Rahul

-- 
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 options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Text book doubt

2011-04-29 Thread rahul rai
http://www.ocf.berkeley.edu/~wwu/riddles/cs.shtml#singleInstrComp

-- 
Rahul

-- 
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 options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Amazon Question

2011-04-29 Thread rahul rai
But does there exist a general method to do this for all binary trees
. . I mean if this answer  were true then all binary trees would be
complete :)

On 4/17/11, Sreeprasad Govindankutty sreeprasad...@gmail.com wrote:
 Yes this is the solution when the binary tree is complete binary tree

 Thanks and many regards,
 Sreeprasad Govindankutty



 On Sat, Apr 16, 2011 at 3:57 PM, Pratik Kathalkar dancewithpra...@gmail.com
 wrote:

 I think this solution is applicable if the binary tree is complete binary
 tree, isn't it?

 On Thu, Apr 14, 2011 at 12:52 AM, Harshit Gangal harshit.gan...@gmail.com
  wrote:

 it 2*node and 2*node+1, if binary tree is stored in an array


 On Thu, Apr 14, 2011 at 12:36 AM, Vishakha Parvatikar 
 vishakha.parvati...@gmail.com wrote:

 Given a binary tree, write a program to find the cousin nodes of the
 given node.

 --
 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 options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




 --
 Harshit Gangal
 Fourth Year Undergraduate Student
 Dept. of Computer Science
 JIIT, Noida , India

  --
 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 options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




 --
 Pratik Kathalkar
 CoEP
 BTech IT
 8149198343

   --
 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 options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


 --
 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 options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




-- 
Rahul

-- 
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 options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Amazon Question

2011-04-29 Thread rahul rai
But does there exist a general method to do this for all binary trees
. . I mean if this answer  were true then all binary trees would be
complete :) correct me if i think wrong

On 4/17/11, rahul rai raikra...@gmail.com wrote:
 But does there exist a general method to do this for all binary trees
 . . I mean if this answer  were true then all binary trees would be
 complete :)

 On 4/17/11, Sreeprasad Govindankutty sreeprasad...@gmail.com wrote:
 Yes this is the solution when the binary tree is complete binary tree

 Thanks and many regards,
 Sreeprasad Govindankutty



 On Sat, Apr 16, 2011 at 3:57 PM, Pratik Kathalkar
 dancewithpra...@gmail.com
 wrote:

 I think this solution is applicable if the binary tree is complete
 binary
 tree, isn't it?

 On Thu, Apr 14, 2011 at 12:52 AM, Harshit Gangal
 harshit.gan...@gmail.com
  wrote:

 it 2*node and 2*node+1, if binary tree is stored in an array


 On Thu, Apr 14, 2011 at 12:36 AM, Vishakha Parvatikar 
 vishakha.parvati...@gmail.com wrote:

 Given a binary tree, write a program to find the cousin nodes of the
 given node.

 --
 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 options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




 --
 Harshit Gangal
 Fourth Year Undergraduate Student
 Dept. of Computer Science
 JIIT, Noida , India

  --
 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 options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




 --
 Pratik Kathalkar
 CoEP
 BTech IT
 8149198343

   --
 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 options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


 --
 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 options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




 --
 Rahul



-- 
Rahul

-- 
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 options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Compiler Design Help

2011-04-16 Thread rahul rai
www.cse.iitd.ernet.in/~sak/courses/cdp/slides.pdf


there are a number of courses and free books on the net
but the above 3 are by far the most succinct and awesome for AN ONLINE
self learner

On 4/16/11, rahul rai raikra...@gmail.com wrote:
 http://dada.cs.washington.edu/dl/confxp/webviewer.html



 http://www.cs.washington.edu/education/courses/csep501/09au/

 the lecs are fast
 and some help might me needed in lectures 4

 On 4/16/11, sumit sharma sumit.sharma0...@gmail.com wrote:
 send me links too

 On Sat, Apr 16, 2011 at 10:37 PM, Gaurav Saxena
 grvsaxena...@gmail.comwrote:

 Please mail me also.


 On Sat, Apr 16, 2011 at 10:02 PM, Arvinth Deenadayalan 
 arvint...@gmail.com wrote:

 Please cc me also. Tia.

 On 4/16/11, rgap rgap...@gmail.com wrote:
  Send me links too, please
 
  On Apr 10, 3:14 am, rahul rai raikra...@gmail.com wrote:
  None has been published  . If you want i can give you a two links to
  video courses , and some set of solved questions . Which will be
  good
  for compiler design help
 
  On 4/10/11, Harshal hc4...@gmail.com wrote:
 
 
 
   someone please share the solution manual of compiler design by Aho
 (aka
   dragon book)... I would be very grateful. Thanks..
 
   --
   Harshal.
 
   --
   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 options, visit this group at
  http://groups.google.com/group/algogeeks?hl=en.
 
  --
  Rahul
 
  --
  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 options, visit this group at
  http://groups.google.com/group/algogeeks?hl=en.
 
 

 --
 Sent from my mobile device

 Arvinth KumarDD

 --
 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 options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




 --
 Thanks and Regards ,
 Gaurav Saxena

 --
 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 options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


 --
 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 options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




 --
 Rahul



-- 
Rahul

-- 
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 options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Compiler Design Help

2011-04-16 Thread rahul rai
http://dada.cs.washington.edu/dl/confxp/webviewer.html



http://www.cs.washington.edu/education/courses/csep501/09au/

the lecs are fast
and some help might me needed in lectures 4

On 4/16/11, sumit sharma sumit.sharma0...@gmail.com wrote:
 send me links too

 On Sat, Apr 16, 2011 at 10:37 PM, Gaurav Saxena
 grvsaxena...@gmail.comwrote:

 Please mail me also.


 On Sat, Apr 16, 2011 at 10:02 PM, Arvinth Deenadayalan 
 arvint...@gmail.com wrote:

 Please cc me also. Tia.

 On 4/16/11, rgap rgap...@gmail.com wrote:
  Send me links too, please
 
  On Apr 10, 3:14 am, rahul rai raikra...@gmail.com wrote:
  None has been published  . If you want i can give you a two links to
  video courses , and some set of solved questions . Which will be good
  for compiler design help
 
  On 4/10/11, Harshal hc4...@gmail.com wrote:
 
 
 
   someone please share the solution manual of compiler design by Aho
 (aka
   dragon book)... I would be very grateful. Thanks..
 
   --
   Harshal.
 
   --
   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 options, visit this group at
  http://groups.google.com/group/algogeeks?hl=en.
 
  --
  Rahul
 
  --
  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 options, visit this group at
  http://groups.google.com/group/algogeeks?hl=en.
 
 

 --
 Sent from my mobile device

 Arvinth KumarDD

 --
 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 options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




 --
 Thanks and Regards ,
 Gaurav Saxena

 --
 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 options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


 --
 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 options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




-- 
Rahul

-- 
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 options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Compiler Design Help

2011-04-11 Thread rahul rai
None has been published  . If you want i can give you a two links to
video courses , and some set of solved questions . Which will be good
for compiler design help

On 4/10/11, Harshal hc4...@gmail.com wrote:
 someone please share the solution manual of compiler design by Aho (aka
 dragon book)... I would be very grateful. Thanks..

 --
 Harshal.

 --
 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 options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




-- 
Rahul

-- 
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 options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Application of Prime Number . An Interesting For Geeks

2011-03-26 Thread rahul rai
http://en.wikipedia.org/wiki/Goldbach%27s_conjecture


mathematical proof on this wiki
!


On 3/24/11, bittu shashank7andr...@gmail.com wrote:
 yesterday one of the my friends asked this Q to me prove with
 correctness that
 Every even integer greater than 2 can be expressed as the sum of two
 primes
   e.g

   4 = 2 + 2
   6 = 3 + 3
 10 = 7 + 3 or 5 + 5
 14 = 3 + 11 or 7 + 7

 Explain   Derive The Time ,Space Complexity of Algorithm

 it seems to be that we have to find all possible prime factor of
 number  prints it its not big task , so by checking that number we
 have to generate the all prime factor of it seems O(n) ..Hope i m
 clear corrcet me if i am wrong here.??

 But  problem come when even number become bigger say 1 billion  10^9
 so for this choosing the a number as a prime factor has probability of
 1/ln(n)
 so say if for 1 billion number out of 21 only 1 is prime. .y question
 is we have to prove the time complexity for two
 choosing a number nearby such big number is 1/ln(n)..??

 with Heuristic justification it can be explained ro induction might
 help but guarantee here  but i need some
 mathematical proof for this


 Thank  Regards
 Shashank Mani
 CSE,BIT Mesra

 --
 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 options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




-- 
Rahul

-- 
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 options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] virtual memory

2011-03-09 Thread rahul rai
Security.  refer to CS .162 lectures{screencarts} of berkely

On 3/9/11, Sudhir mishra sudhir08.mis...@gmail.com wrote:
 virtual memory allows us to run processes of size more than RAM. Is there
 any other use of virtual memory?
 can ever achieve greatly.

 --
 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 options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




-- 
Rahul

-- 
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 options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] rahul rai wants to chat

2011-02-22 Thread rahul rai
I've been using Google Talk and thought you might like to try it out.
We can use it to call each other for free over the internet. Here's an
invitation to download Google Talk. Give it a try!

---

rahul rai wants to stay in better touch using some of Google's coolest new
products.

If you already have Gmail or Google Talk, visit:
http://mail.google.com/mail/b-77b1b82dee-f7befb398a-8W4WvuemvdhWhY4zOH4sOI0p5JY
You'll need to click this link to be able to chat with rahul rai.

To get Gmail - a free email account from Google with over 2,800 megabytes of
storage - and chat with rahul rai, visit:
http://mail.google.com/mail/a-77b1b82dee-f7befb398a-8W4WvuemvdhWhY4zOH4sOI0p5JY

Gmail offers:
- Instant messaging right inside Gmail
- Powerful spam protection
- Built-in search for finding your messages and a helpful way of organizing
  emails into conversations
- No pop-up ads or untargeted banners - just text ads and related information
  that are relevant to the content of your messages

All this, and its yours for free. But wait, there's more! By opening a Gmail
account, you also get access to Google Talk, Google's instant messaging
service:

http://www.google.com/talk/

Google Talk offers:
- Web-based chat that you can use anywhere, without a download
- A contact list that's synchronized with your Gmail account
- Free, high quality PC-to-PC voice calls when you download the Google Talk
  client

We're working hard to add new features and make improvements, so we might also
ask for your comments and suggestions periodically. We appreciate your help in
making our products even better!

Thanks,
The Google Team

To learn more about Gmail and Google Talk, visit:
http://mail.google.com/mail/help/about.html
http://www.google.com/talk/about.html

(If clicking the URLs in this message does not work, copy and paste them into
the address bar of your browser).

-- 
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 options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Tree problem(Amazon)

2011-02-07 Thread rahul rai
Are all the integers positive only ?

On 2/7/11, jalaj jaiswal jalaj.jaiswa...@gmail.com wrote:
 you are given a bst where each node has a int value , parent pointer , and
 left and right pointers , write a function to find a path with a given sum
 value. Path can go from left subtree tree , include root and go to right
 tree as well . we need to find these paths also .
 5
 / \

 110
 / \/ \
 0 2 6 11

 so to find 16 we say it is 1 to 5 to 10 10 to 6

 try make use of parent pointer and find a solution :-o


 --
 With Regards,
 *Jalaj Jaiswal* (+919019947895)
 Final Year Undergraduate,
 IIIT 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, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




-- 
Rahul K Rai
rahulpossi...@gmail.com

-- 
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 options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: o/p

2011-02-07 Thread rahul rai
For more of these tricks one can see the first 10 lectures
from{exclude 1st one}
http://see.stanford.edu/see/lecturelist.aspx?coll=2d712634-2bf1-4b55-9a3a-ca9d470755ee

On 2/7/11, ranjane ranjane...@gmail.com wrote:
 thank u jalaj

 On Feb 6, 10:03 pm, jalaj jaiswal jalaj.jaiswa...@gmail.com wrote:
 the logic is :-
 int is stored in 32 bits in our systems

 300 is   0001 00101100
 as ptr is character pointer, it points to lower 8 bits
 and when *++ptr=2 gets executed then 0001 changes to 0010(equal to
 2)

 so i becomes   0010 00101100 which is 556 :D

 On Sun, Feb 6, 2011 at 10:26 PM, aditya pratap
 contacttoadity...@gmail.comwrote:

  @jalaj : gcc compiler.

   --
  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 options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.

 --
 With Regards,
 *Jalaj Jaiswal* (+919019947895)
 Final Year Undergraduate,
 IIIT 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, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




-- 
Rahul K Rai
rahulpossi...@gmail.com

-- 
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 options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: SPOJ PROBLEM

2011-02-03 Thread rahul rai
does this has to do with floating point representation of numbers {IEE 754}
{single precision  }
then the number would be
like
like for 32 bit field

put 0 in the sign field
all 1 in biased exponent field{8}
and all zeros in the mantissa field{23}

http://en.wikipedia.org/wiki/Single_precision_floating-point_format

also infinity is not equal to {1/machine tolerance=(2^-23)} for some
machines

one thing for sure is that
you can never come up with something bigger by adding one to {infinity}
and never subtract 1 from machine tolerance


correct me if i am wrong please

-- 
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 options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] can i know the best way to learn programming??

2011-02-02 Thread rahul rai
Dear Ajay You Need This
http://see.stanford.edu/see/courseinfo.aspx?coll=11f4f422-5670-4b4c-889c-008262e09e4e


Get Visual Studio 2005 from somewhere
{It Is not free}
first install visual studio 2005
Set up the compiler ready
by installing pclib


and start learning 2
lectures at  a time
the prof demonstrates the code live


http://www.stanford.edu/class/cs106b/

WORK out all problems
FYI::Lecture 10 will blow up your mind


On 2/2/11, Ajay Kumar ajay...@gmail.com wrote:
 @ nishaanthh... what is SPOJ and topcoder...plz help!!!

 On Tue, Feb 1, 2011 at 9:31 PM, nishaanth nishaant...@gmail.com wrote:

 solve problems from SPOJ and topcoder.it helps a lot.


 On Tue, Feb 1, 2011 at 1:30 AM, sandy sandeep.aa...@gmail.com wrote:

 plz help

 --
 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.comalgogeeks%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




 --
 S.Nishaanth,
 Computer Science and engineering,
 IIT Madras.

  --
 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.comalgogeeks%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


 --
 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 options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




-- 
Rahul K Rai
rahulpossi...@gmail.com

-- 
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 options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] can i know the best way to learn programming??

2011-02-02 Thread rahul rai
@Aniket

If You Like That Link Then You Might be interested n reading  my blog

www.rahrai.wordpress.com
 i just wrote one entry there in August
see

On 2/2/11, aniket chatterjee aniket...@gmail.com wrote:
 @Rahul:

 Awesome link dude!!

 --
 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 options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




-- 
Rahul K Rai
rahulpossi...@gmail.com

-- 
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 options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: Prime Numbers

2011-01-26 Thread rahul rai
I think one can use an elimination method . List out all the numbers
. Keep on eliminating the multiples of 2{excluding 2} , then multiples
of 3 , then multiples of 5 , then 7 , the denseness of the numbers
eliminated will get less .  And obviouslly you will get the numbers .

On 1/25/11, siddharth srivastava akssps...@gmail.com wrote:
 Hey Dave

 On 25 January 2011 18:17, Dave dave_and_da...@juno.com wrote:

 The most efficient approach is to google millionth prime number and
 select the first hit.

 Good one. But it was asked to me in an interview.
 The trivial approach would be to check for every number to be a prime an
 continue till
 the count of prime no reaches 1 million.

 Another approach according to me would be to use gcd approach for the same
 but it doesn't guarantees the order of primes I guess (correct me if I am
 wrong)

 The interviewer still wanted a better approach. I know of better approaches
 if a range is given, but what to do in this case.


 Dave

 On Jan 25, 6:00 am, siddharth srivastava akssps...@gmail.com wrote:
  Hi
 
  Its an easy one but still I am looking for the most efficient approach.
 
  Find first 1 million prime numbers.
 
  --
  Siddharth Srivastava
 
  When you have learned to snatch the error code from the trap frame, it
 will
  be time for you to leave.

 --
 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.comalgogeeks%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




 --
 Siddharth Srivastava

 When you have learned to snatch the error code from the trap frame, it will
 be time for you to leave.

 --
 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 options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




-- 
Rahul K Rai
rahulpossi...@gmail.com

-- 
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 options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Re: http://www.cs.princeton.edu/~wayne/cs423/demos.html ::a helpful resource i thought

2011-01-24 Thread rahul rai
http://www.cs.princeton.edu/~wayne/cs423/demos.html

-- 
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 options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] http://www.cs.princeton.edu/~wayne/cs423/demos.html ::a helpful resource i thought

2011-01-24 Thread rahul rai


-- 
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 options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] i need Theory Of Computation By Sipser's Solution Mannual

2011-01-22 Thread rahul rai
-- can somebody give me sipser soluton mannual

-- 
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 options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Sites for Interview Questions

2011-01-21 Thread rahul rai
http://www.ocf.berkeley.edu/~wwu/riddles/intro.shtml
Rahul K Rai
rahulpossi...@gmail.com


On Tue, Jan 18, 2011 at 9:27 PM, Yellow Sapphire pukhraj7...@gmail.comwrote:

 Hi,

 Can someone suggest good books/websites/blogs for interview related
 questions.


 thanks--
 YS

 --
 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.comalgogeeks%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


-- 
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 options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: L values and r values

2011-01-21 Thread rahul rai
Thanks , btw the example was from Dragon Book of Compilers . . Any one
knows an instructor manuall or some selected set of solutions for that
. ? I have read it that they are not published

On 1/21/11, Gene gene.ress...@gmail.com wrote:
 L and R values have great significance to language designers and compiler
 builders. They have some significance to language users, but most people
 don't have to think about them because the distinction is common sense.

 In your case,  operates on L-values and always produces an R-value.
  Therefore (X) for any won't compile no matter what X is.


 --
 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 options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




-- 
Rahul K Rai
rahulpossi...@gmail.com

-- 
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 options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Distance in a dictionary

2011-01-21 Thread rahul rai
@nishaanth  can u give the outline?//

On 1/21/11, nishaanth nishaant...@gmail.com wrote:
 Its a state space search. Solve it by using any of the known search
 algorithms.

 BFS, Best first search, DFS, A*

 On Fri, Jan 21, 2011 at 2:00 PM, snehal jain learner@gmail.com wrote:

 You have a dictionary of N words each of 3 chars. Given 2 words you
 have to find the optimum path between the 2 words. The optimum path
 contains the words in the dictionary each word at a distance of 1 from
 the previous word.
 for eg source = cat , target = sun
 path is
 cat - bat - but - bun - sun
 given all these words are in the dictionary

 --
 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.comalgogeeks%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




 --
 S.Nishaanth,
 Computer Science and engineering,
 IIT Madras.

 --
 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 options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




-- 
Rahul K Rai
rahulpossi...@gmail.com

-- 
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 options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] OS galvin sol..

2011-01-21 Thread rahul rai
can u give me sipser solution mannual?


On 1/21/11, Sreeprasad Govindankutty sreeprasad...@gmail.com wrote:
 Thanks so much

 On Wed, Jan 19, 2011 at 4:20 AM, jayapriya surendran
 priya7...@gmail.comwrote:

 wow..thank you so much


 On Wed, Jan 19, 2011 at 2:08 PM, LALIT SHARMA lks.ru...@gmail.com wrote:



 --
 Lalit Kishore Sharma,

 IIIT Allahabad (Amethi Capmus),
 6th Sem.

 --
 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.comalgogeeks%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


  --
 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.comalgogeeks%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




 --
 Thanks and many regards,
 Sreeprasad Govindankutty

 --
 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 options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




-- 
Rahul K Rai
rahulpossi...@gmail.com

-- 
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 options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] L values and r values

2011-01-18 Thread rahul rai
Do l values and r values hold any practical significance
   how do we find l and r values of things like
\\*((A))\\
if A is an integer   if A is an array of integers

If A in itself is a reference

-- 
Rahul K Rai
rahulpossi...@gmail.com

-- 
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 options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] bfs doubt

2011-01-18 Thread rahul rai
Let G = (V, E) be a  **, cONNECTED  undirected graph. Give an O(V + E)-time
algorithm to compute
a path in G that traverses each edge in E exactly once in each direction.
Describe how you can
find your way out of a maze if you are given a large supply of pennies.
from clrs

-- 
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 options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: Amazon Analytical Puzzle

2011-01-13 Thread rahul rai
 A similar question
http://ocw.mit.edu/courses/mathematics/18-s34-problem-solving-seminar-fall-2007/18.s34-problem-solving-seminar-fall-2007-home-page-answer/

On 1/12/11, vaibhav shukla vaibhav200...@gmail.com wrote:
 @Dave: gud one :)

 On Wed, Jan 12, 2011 at 7:48 PM, Dave dave_and_da...@juno.com wrote:

 Open the box labeled apples and oranges and inspect one piece of
 fruit. Say that it is an apple. Then label this box apples since it
 cannot be apples and oranges or oranges. To identify the boxes
 that should be labeled oranges and apples and oranges, realize
 that since the remaining boxes are mislabeled, the one labeled
 oranges cannot contain only oranges, so it must be apples and
 oranges. And the last box is oranges. Deal with discovering an
 orange in the first box in a similar way.

 Dave

 On Jan 12, 6:52 am, bittu shashank7andr...@gmail.com wrote:
  3rd Puzzle
 
  There are three boxes, one contains only apples, one contains only
  oranges, and one contains both apples and oranges. The boxes have been
  incorrectly labeled such that no label identifies the actual contents
  of the box it labels. Opening just one box, and without looking in the
  box, you take out one piece of fruit. By looking at the fruit, how can
  you immediately label all of the boxes correctly?
 
  Thanks  Regards
  Shashank

 --
 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.comalgogeeks%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




 --
   best wishes!!
 Vaibhav Shukla
 DU-MCA

 --
 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 options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




-- 
Rahul K Rai
rahulpossi...@gmail.com

-- 
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 options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] please explain the pointer math on page 22 of this pdf

2010-09-29 Thread rahul rai
Ya , i get it now . ReThanks!

2010/9/29, Sathaiah Dontula don.sat...@gmail.com:
 int arr [100]; /* array to search */
 *
 Let's write a simple search function:

 int *linear _search ( int val) {
 int *parr, *parrend = arr + array _length(arr);

 for (parr = arr; parr  parrend; parr++) {
   if (* parr == val )
   return parr ;
  }

 return NULL;
 }

 Talking about this problem, parrend is pointing to the end of arr, it is
 like arr + 100 same as arr + sizeof(arr)/sizeof(int);
 Now loop starts from the array start and then goes till the end and when the
 values matches with the val then loop breaks.

 Some code in without pointers,

 int arr[100];
 int *linear _search ( int val) {
 int index_start, size;

 size = sizeof(arr)/sizeof(int); //100

 for (index = 0; index  size; index++) {
   if (parr[index] == val )
   return parr[index] ;
  }

 return NULL;
 }

 please let me know if you have any comments.

 Thanks,
 Sathaiah

 On Tue, Sep 28, 2010 at 11:34 PM, rahul rai raikra...@gmail.com wrote:


 http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-087-practical-programming-in-c-january-iap-2010/lecture-notes/MIT6_087IAP10_lec05.pdf

 Thanking In Advance
 --
 Rahul K Rai
 And The Geek Shall Inherit The Earth

 --
 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.comalgogeeks%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.



 --
 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 group at
 http://groups.google.com/group/algogeeks?hl=en.




-- 
Rahul K Rai
rahulpossi...@gmail.com

-- 
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 group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] please explain the pointer math on page 22 of this pdf

2010-09-28 Thread rahul rai
http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-087-practical-programming-in-c-january-iap-2010/lecture-notes/MIT6_087IAP10_lec05.pdf

Thanking In Advance
-- 
Rahul K Rai
And The Geek Shall Inherit The Earth

-- 
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 group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Fwd: another help please

2010-09-25 Thread rahul rai
Yes , i. Can , and i did , but is't there a shortcut . I want to know that

2010/9/24, mohit ranjan shoonya.mo...@gmail.com:
 Dear Rahul,

 Can you try writing hex digits in binary and try.

 0x77 -- 0111 0111
 0x03 --  0011
 ---
 AND   0011 -- 0x03


 Cheers !
 Mohit


 On Thu, Sep 23, 2010 at 10:25 PM, rahul rai raikra...@gmail.com wrote:


 Rahul K Rai
 rahulpossi...@gmail.com


 -- Forwarded message --
 From: rahul rai raikra...@gmail.com
 Date: 2010/9/23
 Subject: another help please
 To: Baljeet Kumar baljeetk...@gmail.com



 Rahul K Rai


 please explain me this please
 rahulpossi...@gmail.com

  --
 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.comalgogeeks%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


 --
 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 group at
 http://groups.google.com/group/algogeeks?hl=en.




-- 
Rahul K Rai
rahulpossi...@gmail.com

-- 
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 group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] A help please

2010-09-22 Thread rahul rai
printf(%d%d,scanf(%d%d,a b))

-- 
Rahul K Rai
rahulpossi...@gmail.com

-- 
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 group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] a help

2010-08-14 Thread rahul rai
can anyone suggest me lectures / videos for BASICS of BITS manipulation?


thanks in advance
Rahul K Rai
rahulpossi...@gmail.com

-- 
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 group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] a help

2010-08-14 Thread rahul rai
Thanks a lot , it's a life saver , i will work it out fully .

2010/8/14, Asit Baran Das asitbaran@gmail.com:
 http://graphics.stanford.edu/~seander/bithacks.html
 http://graphics.stanford.edu/~seander/bithacks.htmlit has all that you
 need.

 On Sat, Aug 14, 2010 at 7:53 PM, rahul rai raikra...@gmail.com wrote:

 can anyone suggest me lectures / videos for BASICS of BITS manipulation?


 thanks in advance
 Rahul K Rai
 rahulpossi...@gmail.com

 --
 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.comalgogeeks%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


 --
 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 group at
 http://groups.google.com/group/algogeeks?hl=en.




-- 
Rahul K Rai
rahulpossi...@gmail.com

-- 
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 group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: P ! = NP

2010-08-12 Thread rahul rai
http://www.hpl.hp.com/personal/Vinay_Deolalikar/Papers/pnp12pt.pdf
Rahul K Rai
rahulpossi...@gmail.com


2010/8/12 Avik Mitra tutai...@gmail.com

 We are proud that an Indian has attempted to solve this problem.

 Avik

 --
 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.comalgogeeks%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.



-- 
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 group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] a correction in probability problem

2010-07-11 Thread rahul rai
A chess competition in which A is the present champion
B and C are the challengers


Furthermore,following:
•  0.6. = probability that B will Beat C in any match
•  0.5. =probability that A will Beat B in any match
•  0.7. = probability that A will Beat C in any match

B AND C are made to play a two games against each others max
If
one   of them wins both games,he gets to play a two-game
second round
with A ,the current champion
.A retains his championship unless a second round is required and the challenger
beats A in both games.



If A wins the initial game of the second round,no more games are needed




work out the probability that
A will retain his championship this year.




 i want a direct approach
I mean { 1- P(A asCHAMP) - P(B asCHAMP) }
is also fine and gives the answers
but i need a direct method


http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-041-probabilistic-systems-analysis-and-applied-probability-spring-2005/recitations/tut01.pdf


http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-041-probabilistic-systems-analysis-and-applied-probability-spring-2005/recitations/tut01_sol.pdf






Rahul K Rai

-- 
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 group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] a request please

2010-07-05 Thread rahul rai
can anyone tell me how to find front page in office 2003
Rahul K Rai
rahulpossi...@gmail.com

-- 
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 group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] malloc implementations

2010-07-05 Thread rahul rai
http://www.youtube.com/user/StanfordUniversity#p/c/9D558D49CA734A02



these are the best to learn about real implementation of C lang

the lectures number 1 to 10

Rahul K Rai
rahulpossi...@gmail.com



2010/7/5 amit amitjaspal...@gmail.com:
 Hi, can anybody tell me how is malloc implementedany links to
 tutorials for this will be highly apperciated.

 --
 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 group at 
 http://groups.google.com/group/algogeeks?hl=en.



-- 
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 group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] tree from linked list

2010-05-09 Thread rahul rai
can anyone give me links to more educative and active groups like algogeeks

On Sun, May 9, 2010 at 2:11 AM, Arun prasath
aruntendulkar2...@gmail.com wrote:
 This does not create a balanced tree but ensures that every element in the
 tree is accessible by lg(n) time.

 Time : Complexity   O(n)


 [a...@91blore-srv1 ~]$ cat recursion.c
 #include stdlib.h
 #includeunistd.h
 #include stdio.h
 #define TEST2
 #ifdef TEST1
 int arr[] = { 1,2,3,4,5,6,7};
 int max_elems = sizeof(arr)/sizeof(arr[0]);
 #endif

 #ifdef TEST2
 int arr[] = { 1,2,3,4,5};
 int max_elems = sizeof(arr)/sizeof(arr[0]);
 #endif

 #ifdef TEST3
 int arr[] = { 1,2,3,4,5,6,7,8};
 int max_elems = sizeof(arr)/sizeof(arr[0]);
 #endif

 #define LIST_EMPTY -1

 struct tree {
     int data;
     struct tree * left,* right;
 };

 struct tree* function( int , int);
 void print_inorder( struct tree *);

 int return_next_from_list(void)
 {
     static int nxt_elem = 0;
     if(nxt_elem  max_elems)
     return arr[nxt_elem++];

     return LIST_EMPTY;// empty condition
 }
 int main()
 {
     unsigned int  x = max_elems;
     struct tree* head;
     while( x  (x - 1) ) {
     x = x  (x - 1) ;
     }

     head = function(0, x);
     print_inorder(head);
     free(head);
     return 0;
 }
 struct tree* function(int mid, int i)
 {
     int val = mid + i ;
     if (val  1) {
     struct tree * leaf = malloc( sizeof(struct tree) );
     leaf-left = leaf-right = NULL;
     leaf-data = return_next_from_list();
     if(leaf-data == LIST_EMPTY) {
     free(leaf);
     return NULL;
     }
     return leaf;
     }
     struct tree *non_leaf = malloc( sizeof(struct tree) ) ;

     non_leaf-left  = function( mid, i/2);
     non_leaf-data = return_next_from_list();
     if (non_leaf-data == LIST_EMPTY) {
     struct tree *tmp = non_leaf-left;
     free(non_leaf);
     return tmp;
     }
     non_leaf-right = function( mid+i, i/2);
     return non_leaf;
 }
 void print_inorder( struct tree* root)
 {
     struct tree * trav = root;
     if (!trav) {
     return;
     }
     print_inorder(trav-left);
     if(trav-left)
     free(trav-left);
     printf({%d}, trav-data);
     print_inorder(trav-right);
     if(trav-right)
     free(trav-right);

 }
 [a...@91blore-srv1 ~]$


 On Sun, May 2, 2010 at 6:38 PM, divya sweetdivya@gmail.com wrote:

 u are given a sorted lnked list construct a balanced binary search
 tree from 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, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


 --
 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 group at
 http://groups.google.com/group/algogeeks?hl=en.


-- 
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 group at 
http://groups.google.com/group/algogeeks?hl=en.