Re: [algogeeks] Re: Algorithm page

2012-08-28 Thread Wladimir Tavares
http://marathoncode.blogspot.com.br/2012/08/ano-turing.html
http://marathoncode.blogspot.com.br/2012/08/logaritmo-discreto.html
http://marathoncode.blogspot.com.br/2012/08/registrador-de-deslocamento.html
http://marathoncode.blogspot.com.br/2012/08/paradoxo-do-aniversario.html
http://marathoncode.blogspot.com.br/2012/08/algoritmo-pollards-rho.html
http://marathoncode.blogspot.com.br/2012/08/fatoracao-de-fermat.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.



Re: [algogeeks] Re: Printing random word from file

2012-08-28 Thread pankajsingh
@Dave Sir-Got ur point..thnks!!

-- 
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: Search an element in a sorted and pivoted array

2012-08-28 Thread Dave
@Rahul: Please tell us what you mean by a "pivoted" array.
 
Dave

On Tuesday, August 28, 2012 12:56:03 PM UTC-5, rahul sharma wrote:

> plz provide me algo for this,thnx 

-- 
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/-/iomheqkDEd0J.
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: Printing random word from file

2012-08-28 Thread Dave
@Pankaj: My only complaint is that rand()%n is not uniformly distributed 
between 0 and n-1. To see this, suppose rand() produces positive 32-bit 
integers, so they have the range 0 to 2^31 - 1 = 2,147,483,647. Now, 
suppose there are 100,000 words in the file. When you are computing 
rand()%10, you will get each of the numbers 0 to 83,646 on average 
21,475 times out of 2^31 random numbers, but you will get the numbers 
83,647 to 99,999 only 21,474 times out of every 2^31 random numbers. Thus, 
the first numbers in the file will appear with slightly too high a 
probability and the numbers at the end of the file will be selected with 
slightly too low a probability.
 
That's why I prescribed a double precision random number generator that 
generates uniformly-distributed numbers between 0 and 1, and wrote the 
test  i * random() < 1.
 
Dave

On Tuesday, August 28, 2012 7:59:13 AM UTC-5, Pankaj wrote:

> @all-This is almost the same question asked in facebook.. 
> Dave sir is correct!
> Example-file contain only a b a c;
> Then step1:
> save a;
> step2:
> save b with probability of value 0 by rand()%2;
> therefore pr[1]=1/2;pr[2]=1/2;
> step3;
> save a with probability of value 0 by rand()%3;
> therefore pr[1]=1/2*2/3=1/3;
> pr[2]=1/2*2/3=1/3;
> pr[3]=1/3;
> step4;
> all same similraly =1/4..and dis continues..
>

-- 
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/-/gWo4UhJ1uhsJ.
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: Printing random word from file

2012-08-28 Thread Dave
@Kailash: I assumed a function random() which generates uniformly 
distributed double precision random numbers between 0 and 1. Usually such a 
generator would produce numbers with 53 bit precision, so I guess that is 
between 15 and 16 digits after the decimal point. Just google "random 
number generator" for a variety of methods to do this.
 
Dave

On Sunday, August 26, 2012 9:03:21 AM UTC-5, kailash wrote:

> @Dave: Can you throw some light on random() function?? How it is 
> generating numbers between 0.0 and 1.0, and how many digits are there after 
> the point...because if there is only one digit then we will not be able 
> to print words after 10th place because 10*0.1(lowest number generated by 
> random())=1...since lowest number generated by the random() function is not 
> able to convert 10th word into printable situation,so we can't print words 
> above 10th place (inclusive)  so it's not solving the original 
> problem???
>
> On Sun, Aug 26, 2012 at 3:55 AM, Dave  >wrote:
>
>> @Kunal: Yes. You are missing that you don't know the number of words in 
>> the file in advance. So, to use your method, you would have to read the 
>> file once to find n, and then read through it again to select the lucky_pos 
>> th word. The method I proposed only requires reading the file once. 
>>  
>> Furthermore, assuming that rand() produces a random non-negative integer, 
>> rand()%n is not equiprobable for all values of n. Consider n = 3. Then 
>> since rand() takes on 2^31 values, rand()%3 cannot take on the values 0, 1, 
>> and 2 with equal probability since 2^31 is not divisible by 3.
>>  
>> Dave
>>
>> On Saturday, August 25, 2012 1:44:03 PM UTC-5, Kunal Patil wrote:
>>
>>> How about using rand()%n ??
>>> Like, calculate lucky_pos = rand()%n
>>> Then print word at lucky_pos th position...
>>> Am I missing anything? All words are still equiprobable to get printed 
>>> right?
>>> On Aug 20, 2012 11:45 AM, "Dave"  wrote:
>>>
 @Navin: Okay. Here is a paraphrase. Assume double function random() 
 returns a uniformly distributed random number >= 0.0 and < 1.0.
  
 read first word from file into string save;
 int i = 1
 while not EOF
 {
 read next word from file into string temp;
 i++;
 if( i * random() < 1.0 )
 copy temp to save;
 }
 print save;
  
 Dave

 On Monday, August 20, 2012 12:02:54 AM UTC-5, Navin Kumar wrote:

> @Dave sir, I didn't get your logic. Can you please elaborate it? 
>
> On Sun, Aug 19, 2012 at 4:08 AM, Dave  wrote:
>
>> @Navin: Here is the algorithm:
>>  
>> Save the first word. 
>> For i = 2, 3, ..., n = number of words in the file
>> replace the saved word with the i-th word with probability 1/i.
>> When EOF is reached, every word in the file will have probability 1/n 
>> of being the saved word. Print it.
>>  
>> Dave
>>  
>> On Saturday, August 18, 2012 1:28:56 AM UTC-5, Navin Kumar wrote:
>>
>>> Print a *Random word* from a file. Input is "path to a file", 
>>>
>>> constraints- No extra memory like hashing etc. All the words in the 
>>> file should have equal probability.
>>
>>  -- 
>> 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/
>> **ms**g/algogeeks/-/HxO-wNzEP9gJ
>> .
>>
>> To post to this group, send email to algo...@googlegroups.com.
>> To unsubscribe from this group, send email to algogeeks+...@**
>> 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 view this discussion on the web visit https://groups.google.com/d/**
 msg/algogeeks/-/crET-x06vpkJ
 .
 To post to this group, send email to algo...@googlegroups.com.
 To unsubscribe from this group, send email to algogeeks+...@**
 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 view this discussion on the web visit 
>> https://groups.google.com/d/msg/algogeeks/-/pvqb27sRhFAJ.
>>
>> To post to this group, send email to algo...@googlegroups.com
>> .
>> To unsubscribe from this group, send email to 
>> algogeeks+...@googlegroups.com .
>> For more options, visit this group at 
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>
>
> --

[algogeeks] Re: max sum b/w 2 leaf nodes in a binary tree

2012-08-28 Thread Navin Gupta
I think the path between two leaves always passes thru root.
Now we can keep track of root-to-leaf path whose sum is max and secondMax 
among all sums.
Now between this two leaves path, root is repeated.
Hence actual sum is maxsum + secondMaxSum - root->val;
This can be done by iterative inorder traversal of tehe tree

T[n] - o[n]
Space - o[n]

-- 
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/-/5Okg0EjlIAkJ.
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] max sum b/w 2 leaf nodes in a binary tree

2012-08-28 Thread kunal rustgi
int maxLtoLSum(NODE *root,int *sum)
{
  int ls=0,rs=0,lsum=0,rsum=0;
  if(root==NULL)
  {
*sum=0;
return 0;
  }

  lsum= maxLtoLSum (root->left,&ls);
  rsum= maxLtoLSum (root->right,&rs);

  *sum=max(ls,rs) + root->data;

  return max(ls + rs + root->data, max(lsum,rsum));
}

On Tue, Aug 28, 2012 at 4:02 PM, vaibhav shukla wrote:

> I guess it might be
> finding maximum sum path for left subtree + max sum path for right subtree
> + root->data
>
> As in case of finding the diameter  which say
> height(root->left)+height(root->right)+1
>
> Please correct me!
>
>
> On Mon, Aug 27, 2012 at 11:46 PM, kunal rustgi wrote:
>
>> @ravi
>> yep, you're right.
>>
>> But method is similar to finding diameter as given on geeksforgeeks as
>> atul suggested . Thanks.
>>
>>
>> On Mon, Aug 27, 2012 at 11:23 PM, Ravi Maggon wrote:
>>
>>> @atul:
>>> I think he is asking for max. sum of elements between 2 leaf nodes and
>>> not the max distance between two nodes.
>>>
>>>
>>> On Sun, Aug 26, 2012 at 6:12 PM, atul anand wrote:
>>>
 its the diameter of tree.
 you can find implementation on geeksforgeeks

 On 8/25/12, kunal rustgi  wrote:
 > Hi,
 >
 > Can anyone suggest the best approach for finding max sum b/w 2 leaf
 nodes
 > in a binary tree ( not BST )  ?
 >
 > --
 > 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.


>>>
>>>
>>> --
>>>
>>> 
>>>
>>> *Regards
>>> *Ravi Maggon
>>>
>>> Member Technical - IT/Front Office
>>>
>>> D.E. Shaw & Co.
>>>
>>> --
>>> 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.
>>
>
>
>
> --
> best wishes!!
>  Vaibhav
>
>  --
> 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] max sum b/w 2 leaf nodes in a binary tree

2012-08-28 Thread pankajsingh
@vaibhav-yup :-)

-- 
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] Search an element in a sorted and pivoted array

2012-08-28 Thread rahul sharma
plz provide me algo for this,thnx

-- 
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] Fwd: Snapdeal placement proceedure

2012-08-28 Thread sachin singh
-- Forwarded message --
From: sachin singh 
Date: Tue, Aug 28, 2012 at 10:23 PM
Subject: Snapdeal placement proceedure
To: algogeeks@googlegroups.com



Can anyone tell about the recruitment process of snapdeal?
I mean how to prepare for the written test?What kind of written test it
would be?
What are they asking in interview? And some pointers on what skills they
are basically looking at when they come to hire at colleges

-- 
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: Printing random word from file

2012-08-28 Thread pankajsingh
@all-This is almost the same question asked in facebook..
Dave sir is correct!
Example-file contain only a b a c;
Then step1:
save a;
step2:
save b with probability of value 0 by rand()%2;
therefore pr[1]=1/2;pr[2]=1/2;
step3;
save a with probability of value 0 by rand()%3;
therefore pr[1]=1/2*2/3=1/3;
pr[2]=1/2*2/3=1/3;
pr[3]=1/3;
step4;
all same similraly =1/4..and dis continues..

-- 
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] max sum b/w 2 leaf nodes in a binary tree

2012-08-28 Thread pankajsingh
Hope This will Work..

int Recursion(node *root)
{
if(root->left==Null&&root->right==Null)
{
return root->data;
}
int a=0,b=0;
a=recursion(root->left);
b=recursion(root->right);
if(a+b+root->data>max)
max=a+b+root->data;
return max(a,b)+root->data;
}

-- 
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] Suggest algo...

2012-08-28 Thread pankajsingh
Code:-
#include
#include
using namespace std;
void recursion(int sum,int i,vector v,int size)
{
vector v1=v;
int size1=size;
if(sum==0)
{
for(int k=0;k v;
recursion(10,0,v,size);
system("pause");
}
output:-1 2 3 4
1 2 7
1 3 6
1 4 5
1 9
2 3 5
2 8
3 7
4 6

-- 
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] max sum b/w 2 leaf nodes in a binary tree

2012-08-28 Thread vaibhav shukla
I guess it might be
finding maximum sum path for left subtree + max sum path for right subtree
+ root->data

As in case of finding the diameter  which say
height(root->left)+height(root->right)+1

Please correct me!

On Mon, Aug 27, 2012 at 11:46 PM, kunal rustgi wrote:

> @ravi
> yep, you're right.
>
> But method is similar to finding diameter as given on geeksforgeeks as
> atul suggested . Thanks.
>
>
> On Mon, Aug 27, 2012 at 11:23 PM, Ravi Maggon wrote:
>
>> @atul:
>> I think he is asking for max. sum of elements between 2 leaf nodes and
>> not the max distance between two nodes.
>>
>>
>> On Sun, Aug 26, 2012 at 6:12 PM, atul anand wrote:
>>
>>> its the diameter of tree.
>>> you can find implementation on geeksforgeeks
>>>
>>> On 8/25/12, kunal rustgi  wrote:
>>> > Hi,
>>> >
>>> > Can anyone suggest the best approach for finding max sum b/w 2 leaf
>>> nodes
>>> > in a binary tree ( not BST )  ?
>>> >
>>> > --
>>> > 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.
>>>
>>>
>>
>>
>> --
>>
>> 
>>
>> *Regards
>> *Ravi Maggon
>>
>> Member Technical - IT/Front Office
>>
>> D.E. Shaw & Co.
>>
>> --
>> 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.
>



-- 
best wishes!!
 Vaibhav

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

2012-08-28 Thread pankajsingh
@atul-I think This Should work for n dimension-
complexity O(n^no.of dimesions)
:-
have N-dimension check for which Tile can contain which Tile.i.e (3,3,4)
can contain (2,3,4) .
Now
 1.Take the titles which cannot contain any-other tile set no-of tile if it
is base =1;
2.now take tiles which can contain 1 tile only.This tile will contain any
of tiles in 1. case ..it cannot be other title..since other tile can
contain tiles>=1 which means it shud contain >=2..which is not true.
set with base value=(if it exist)1+1=2;
3.similarly for other Tiles..in increasing order check maximum tile it can
contain..

correct me if wrong...complexity is high but its due to no.of dimesion..for
n=2 its simply O(n^2)..

-- 
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] 5 tyres 10000 Kilometers..

2012-08-28 Thread Prem Krishna Chettri
@Dave.. Yeah that correct .. Its fairly simple to get in the
interviews. A bit trickier one for me is to get the corrupted link
list correction... I have seen but not concentrated enough during the
hours..

On Tue, Aug 28, 2012 at 10:02 PM, Aditya Virmani
wrote:

> If there are total 5 tyres, including the 4 attached ones...
> you can change do a rotation, change tyre after every 2000 kms( or the
> factors of 2000), in that case, the journey by each one would be 8000.
> i think there can be several interpretations of the qn. IF for five extra
> tyres, wud mean equal use of the 5 new tyres, nt considering the old ones,
> even in that case, the above wud be true.
>
> On Tue, Aug 28, 2012 at 9:39 PM, Prem Krishna Chettri 
> wrote:
>
>> Guys Something good to share here..
>>
>> Query :-  Tomorrow I am Planning to take my car for a ride of 1 ( Ten
>> Thousands )  Km. As the journey will be rough so I am planning to pack 5
>> new tyres..  Now being very conservative, I want to use each of them such
>> that they all wear equally.. Now the question is how shall I achieve it and
>> what will be the total journey traveled by each on of them.
>>
>>  --
>> 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.
>

-- 
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] 5 tyres 10000 Kilometers..

2012-08-28 Thread Aditya Virmani
If there are total 5 tyres, including the 4 attached ones...
you can change do a rotation, change tyre after every 2000 kms( or the
factors of 2000), in that case, the journey by each one would be 8000.
i think there can be several interpretations of the qn. IF for five extra
tyres, wud mean equal use of the 5 new tyres, nt considering the old ones,
even in that case, the above wud be true.

On Tue, Aug 28, 2012 at 9:39 PM, Prem Krishna Chettri wrote:

> Guys Something good to share here..
>
> Query :-  Tomorrow I am Planning to take my car for a ride of 1 ( Ten
> Thousands )  Km. As the journey will be rough so I am planning to pack 5
> new tyres..  Now being very conservative, I want to use each of them such
> that they all wear equally.. Now the question is how shall I achieve it and
> what will be the total journey traveled by each on of them.
>
>  --
> 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.



[algogeeks] Re: 5 tyres 10000 Kilometers..

2012-08-28 Thread Dave
@Prem: You will travel 40,000 tire (American spelling) km. Therefore, each 
tire needs to be on the ground for 8,000 km. One way to accomplish this is 
to rotate the 5 tires each 2,000 km. Then, each tire will be on each wheel 
for 2,000 km, and will be the spare for 2,000 km. Another way, with less 
tire switching, is to switch the tire on a different wheel with the current 
spare each 2,000 km. This involves moving only 2 tires each 2,000 km. The 
diagram of tire positions is
 
  02000  4000  6000  8000
A B   S B S A S AS A
C D   C DC D B DB C
 SABCD
 
Dave

On Tuesday, August 28, 2012 11:09:47 AM UTC-5, Prem wrote:

> Guys Something good to share here..
>
> Query :-  Tomorrow I am Planning to take my car for a ride of 1 ( Ten 
> Thousands )  Km. As the journey will be rough so I am planning to pack 5 
> new tyres..  Now being very conservative, I want to use each of them such 
> that they all wear equally.. Now the question is how shall I achieve it and 
> what will be the total journey traveled by each on of them.
>
>

-- 
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/-/xtgmVV4zXA8J.
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] 5 tyres 10000 Kilometers..

2012-08-28 Thread Prem Krishna Chettri
Guys Something good to share here..

Query :-  Tomorrow I am Planning to take my car for a ride of 1 ( Ten
Thousands )  Km. As the journey will be rough so I am planning to pack 5
new tyres..  Now being very conservative, I want to use each of them such
that they all wear equally.. Now the question is how shall I achieve it and
what will be the total journey traveled by each on of them.

-- 
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] max sum b/w 2 leaf nodes in a binary tree

2012-08-28 Thread kunal rustgi
@ravi
yep, you're right.

But method is similar to finding diameter as given on geeksforgeeks as atul
suggested . Thanks.

On Mon, Aug 27, 2012 at 11:23 PM, Ravi Maggon  wrote:

> @atul:
> I think he is asking for max. sum of elements between 2 leaf nodes and not
> the max distance between two nodes.
>
>
> On Sun, Aug 26, 2012 at 6:12 PM, atul anand wrote:
>
>> its the diameter of tree.
>> you can find implementation on geeksforgeeks
>>
>> On 8/25/12, kunal rustgi  wrote:
>> > Hi,
>> >
>> > Can anyone suggest the best approach for finding max sum b/w 2 leaf
>> nodes
>> > in a binary tree ( not BST )  ?
>> >
>> > --
>> > 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.
>>
>>
>
>
> --
>
> 
>
> *Regards
> *Ravi Maggon
>
> Member Technical - IT/Front Office
>
> D.E. Shaw & Co.
>
> --
> 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] max sum b/w 2 leaf nodes in a binary tree

2012-08-28 Thread Sairam


> So, how do you do that sir? 
>>
>  Basically , we should  identify all the paths between those two nodes and 
keep track of maximum of sums. 

-- 
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/-/wdt4HVIpmcsJ.
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.