Re: [algogeeks] Re: prime factorization algo

2011-09-19 Thread abhinav gupta
Dats not the logic Tammana
you have to check whether there is any factor in between 2 to number/2;
if there is any no then u have to brak at that point.


On Tue, Sep 20, 2011 at 12:10 PM, Tamanna Afroze wrote:

>
> I checked whether th enuber s divisible by 2 nd 3 repeatedly...
> I got no other number which aren't divisible by these two numbers.
> nd I am done.
> Tht's all abhinav.
>
> Tamanna
>
> --
> 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.
>



-- 
@ |3  # ! /\/ @ \./

-- 
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] prime factorization algo

2011-09-19 Thread siddharth srivastava
initialise a bit vector till the square root of the number and cancel out
the factors of numbers with whom divisibility has been checked (starting
from 2)
you can use bitvector to implement it.
set false for the discarded values.
if none remains true (given that you initialise the bit vector with true),
the number in question is prime.

On 20 September 2011 00:10, Manish Verma  wrote:

> does anybody know the fastest algo for prime factorization of a
> number???
>
> --
> 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
Siddharth Srivastava

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

2011-09-19 Thread Tamanna Afroze
I checked whether th enuber s divisible by 2 nd 3 repeatedly...
I got no other number which aren't divisible by these two numbers.
nd I am done.
Tht's all abhinav.

Tamanna

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

2011-09-19 Thread abhinav gupta
@ Tammana : Can u explain the main logic of haveFactor() function inside
Prime.?

On Tue, Sep 20, 2011 at 11:28 AM, Tamanna Afroze wrote:

> haveFactor() function checked the factor of a number.
> if a number has a factor other than 1 and itself it isn't prime.
> Operation function does the rest of the thing, i.e. file reading and file
> writing and looping throgh the file's input.
>
> Does that make sense?
>
> Pz let me know.
>
> --
> 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.
>



-- 
@ |3  # ! /\/ @ \./

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

2011-09-19 Thread Tamanna Afroze
haveFactor() function checked the factor of a number.
if a number has a factor other than 1 and itself it isn't prime.
Operation function does the rest of the thing, i.e. file reading and file
writing and looping throgh the file's input.

Does that make sense?

Pz let me know.

-- 
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] Array A and B

2011-09-19 Thread geeks
suppose an array A[0...n-1] given have to buld another array B[0..n-1] such 
that B[i] hold the number of lower or equal values in Right side of A[i]. in 
O(nlgn) please post solution . example if A{1,2,0,7,3} so B will be 
{1,1,0,1,0} .

-- 
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/-/YTQvLByiQaMJ.
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++ Query

2011-09-19 Thread abhinav gupta
Whenver you call copy constructor it has to pass reference parameter beacuse
you dont want constructor and destructor to be called twice.
Here is the reason why,

Suppose u have two objects of a class (let 'a' and 'b').
when u want to copy 'a' into 'b' you want current status of object 'a' to be
copied into 'b'.But if it is pass by value then object 'b' will call its own
constructor and u wont get the current status of object 'a' into 'b'.

And when destructor is called then same piece of allocated memory will be
deallocated twice.So it is necessary to have copy constructors as pass by
reference.
On Mon, Sep 19, 2011 at 10:22 PM, KARTHIKEYAN V.B. wrote:

> Hi
>
> Can anyone say me which is the best hashing tecnicque which can store
> duplicates and minimize time complexity?
>
> Pls reply
>
> --
>  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.
>



-- 
@ |3  # ! /\/ @ \./

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

2011-09-19 Thread abhinav gupta
@Tammana can u pls give me the logic of the above code !

On Tue, Sep 20, 2011 at 8:35 AM, Tamanna Afroze  wrote:

>
> I don't know whether my one is good algorithm or not, but it gives somewhat
> good output. It is in Java.
>
> /*
>  * To change this template, choose Tools | Templates
>  * and open the template in the editor.
>  */
> package prime;
>
> /**
>  *
>  * @author Tamanna Afroze
>  */
>
> import java.io.File;
> import java.io.FileReader;
> import java.io.FileWriter;
> import java.io.BufferedReader;
> import java.io.BufferedWriter;
> import java.io.IOException;
> import java.util.StringTokenizer;
>
> public class Prime {
>
> /**
>  * @param args the command line arguments
>  */
> boolean haveFactor(int iNumber){
> int iFactors[] = new int[1];
> int iIndex = 0;
> iFactors[iIndex] = 1;
> iIndex++;
> iFactors[iIndex] = iNumber;
> iIndex++;
>
> if(iNumber != 2 && (iNumber%2)==0){
> iFactors[iIndex] = 2;
> iIndex++;
> iNumber /=2;
> if( iNumber != 2 ){
> iFactors[iIndex] = iNumber;
> iIndex++;
> }
> int iLoop = 2;
> if( iNumber != 2 ){
> while((iNumber%2) != 1){
> iFactors[iIndex] = 2*iLoop;
> //System.out.println("Here :" + iFactors[iIndex]);
> iIndex++;
> iNumber /= 2;
> iFactors[iIndex] = iNumber;
> iIndex++;
> iLoop *= 2;
> }
> }
> if(iNumber != 3 && (iNumber%3)==0){
> iFactors[iIndex] = 3;
> iIndex++;
> iNumber /=3;
> if( iNumber != 3 ){
> iFactors[iIndex] = iNumber;
> iIndex++;
> }
> iLoop = 3;
> if( iNumber != 3 ){
> while((iNumber%3) != 1){
> iFactors[iIndex] = 3*iLoop;
> //System.out.println("Here :" + iFactors[iIndex]);
> iIndex++;
> iNumber /= 3;
> if( iNumber != 3 ){
> iFactors[iIndex] = iNumber;
> iIndex++;
> }
> iLoop *= 3;
> }
> }
> }
> for(int i =0; i //System.out.println(iFactors[i]);
> }
> return true;
> }
> else if(iNumber != 3 && (iNumber%3)==0){
> iFactors[iIndex] = 3;
> iIndex++;
> iNumber /=3;
> if( iNumber != 3 ){
> iFactors[iIndex] = iNumber;
> iIndex++;
> }
> int iLoop = 3;
> while(iNumber != 3 && (iNumber%3) != 1){
> iFactors[iIndex] = 3*iLoop;
> //System.out.println("Here :" + iFactors[iIndex]);
> iIndex++;
> iNumber /= 3;
> if( iNumber != 3 ){
> iFactors[iIndex] = iNumber;
> iIndex++;
> }
> iLoop *= 3;
> }
> for(int i =0; i //System.out.println(iFactors[i]);
> }
> return true;
> }
> else{
> return false;
> }
> }
>
> public void Operation(){
> String number,numberofinput,first,second;
> int index = 0,iFirst = 0,iSecond = 0, iNumberOfInput = 0;
>
> try{
> File file = new File("input.txt");
> FileReader fileReader = new FileReader(file);
> BufferedReader bufferedReader = new BufferedReader(fileReader);
>
> FileWriter fileWriter = new FileWriter("output.txt");
> BufferedWriter bufferedWriter = new BufferedWriter(fileWriter);
>
> while((number = bufferedReader.readLine()) != null){
> if(index == 0){
> numberofinput = number;
> iNumberOfInput = Integer.parseInt(numberofinput);
> }
> else{
> StringTokenizer tokenizer = new
> StringTokenizer(number);
> while(tokenizer.hasMoreTokens()){
> first = tokenizer.nextToken();
> second = tokenizer.nextToken();
> System.out.println("First: " + first + " Second: "
> + second);
> iFirst = Integer.parseInt(first);
> iSecond = Integer.parseInt(second);
> }
> System.out.println("Integer Version First: " + iFirst +
> " Second: " + iSecond);
> if(iFirst >= 1 && iSecond >= iFirst && iSecond <=
> 1

Re: [algogeeks] Re: random function

2011-09-19 Thread abhinav gupta
int i;
i=random(5);


int random(int x)
{
return (rand(x) % 5);
}


rand() is inbuilt function in c/c++;


On Mon, Sep 19, 2011 at 9:24 PM, Don  wrote:


> The most common way that it works would be that random(n) returns the
> equivalent of a random integer mod n, so 0<=x standard for how they work, so know what you are dealing with.
>
> Don
>
>  On Sep 19, 10:12 am, prasanth n  wrote:
> > @don:
> > suppose if give like random(5)-> it must give any number between 0 and
> 5..
> >
> >
> >
>
>  > On Mon, Sep 19, 2011 at 8:22 PM, Don  wrote:
> > > You mean a pseudo-random generator.
> > > Without special hardware you won't get a real random generator.
> > > Use Mersenne Twister.
> >
> > > Don
> >
> > > On Sep 19, 9:43 am, prasanth n  wrote:
> > > > anyone give an algorithm of how to generate a random
> number..probability
> > > of
> > > > occurrence of each no should be the same..
> >
> > > > --
> > > > *prasanth*
> >
> > > --
> > > 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.
> >
> > --
> > *prasanth*
>
> --
> 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.
>
>
>


-- 
@ |3  # ! /\/ @ \./

-- 
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] C query

2011-09-19 Thread teja bala
// Could some body plzz xplain dis code..


#include
void main()
{
long double lda=1e+37L,ldb=1e-37L;
long double a[2]={1234,5678};
long long unsigned int x=0x1234;
printf("%d  %d   %ld%ld  %llx
%d",sizeof(lda),lda,a[0],a[1],x,sizeof(x));
}

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

2011-09-19 Thread Tamanna Afroze
I don't know whether my one is good algorithm or not, but it gives somewhat
good output. It is in Java.

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package prime;

/**
 *
 * @author Tamanna Afroze
 */

import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.util.StringTokenizer;

public class Prime {

/**
 * @param args the command line arguments
 */
boolean haveFactor(int iNumber){
int iFactors[] = new int[1];
int iIndex = 0;
iFactors[iIndex] = 1;
iIndex++;
iFactors[iIndex] = iNumber;
iIndex++;

if(iNumber != 2 && (iNumber%2)==0){
iFactors[iIndex] = 2;
iIndex++;
iNumber /=2;
if( iNumber != 2 ){
iFactors[iIndex] = iNumber;
iIndex++;
}
int iLoop = 2;
if( iNumber != 2 ){
while((iNumber%2) != 1){
iFactors[iIndex] = 2*iLoop;
//System.out.println("Here :" + iFactors[iIndex]);
iIndex++;
iNumber /= 2;
iFactors[iIndex] = iNumber;
iIndex++;
iLoop *= 2;
}
}
if(iNumber != 3 && (iNumber%3)==0){
iFactors[iIndex] = 3;
iIndex++;
iNumber /=3;
if( iNumber != 3 ){
iFactors[iIndex] = iNumber;
iIndex++;
}
iLoop = 3;
if( iNumber != 3 ){
while((iNumber%3) != 1){
iFactors[iIndex] = 3*iLoop;
//System.out.println("Here :" + iFactors[iIndex]);
iIndex++;
iNumber /= 3;
if( iNumber != 3 ){
iFactors[iIndex] = iNumber;
iIndex++;
}
iLoop *= 3;
}
}
}
for(int i =0; i= 1 && iSecond >= iFirst && iSecond <=
10 && iSecond-iFirst <= 10){

for(int k = iFirst; k<=iSecond ; k++ ){
if(k!=1){
boolean result = haveFactor(k);


if(!result){
String sPrime = Integer.toString(k);
bufferedWriter.write(sPrime);
bufferedWriter.newLine();
}
iFirst++;
}
}
}
else{
System.out.println("Input Error Occured: m and n are
not in the specified Range");
}
}
index++;
bufferedWriter.newLine();
}
bufferedWriter.flush();
bufferedWriter.close();
}
catch(IOException iox){
iox.printStackTrace();
}

}

public static void main(String[] args) {
// TODO code application logic here
Prime object = new Prime();
object.Operation();
//boolean bHave = object.haveFactor(7);
//System.out.println("The output of the Factor function is: " +
bHave);
}
}



Sincerely,
Tamanna

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

2011-09-19 Thread kartik sachan
+1  to yogesh

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

2011-09-19 Thread kartik sachan
@bharatkumar  i think u r  in thinking oder in lexicographic order .but in
question its not the same...

we have print the according to the sentence not according to dictonary

-- 
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: c output,printf("%llx")

2011-09-19 Thread Dave
@Wujin: Okay. b is but an integer, yet it is being printed as a long
long. Since there are no implicit type conversions in procedure calls
such as the printf statement, b is taken as a long long, not of an
int. So b and the next 32-bits are printed. The format that these are
printed in is a figment of the little-endianness of your computer. and
the order in which the compiler happens to allocate memory for a, b,
and c, and perhaps for the constants used to initialize them.

Dave

On Sep 19, 8:18 pm, wujin chen  wrote:
> @Dave  printf("a=%x, b=%llx",a,b,c);  i think c will be ignored~~ , and the
> output is a=9,b=10
>
> 2011/9/19 Dave 
>
>
>
> > @Wujin: What do you expect the output to be? How does it differ from
> > what you actually get?
>
> > Dave
>
> > On Sep 18, 8:47 am, wujin chen  wrote:
> > > usigned long long x = 0x12345678;
> > > int a = 0x09;
> > > int b = 0x10;
> > > printf("a=%x, b=%llx",a,b,c);
>
> > > the result is: a=9,b=123456780010
>
> > > i wonder why~~
>
> > > can anyone explain it?
> > > thanks.
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Algorithm Geeks" group.
> > To post to this group, send email to algogeeks@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.- Hide quoted text -
>
> - Show quoted text -

-- 
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: c output,printf("%llx")

2011-09-19 Thread Dave
@Wujin: Okay. But b is an integer and it is being printed as a long
long. Since there are no implicit type conversions in procedure calls
such as the printf statement, b is taken as a long long, not of an
int. So b and the next 32-bits are printed.

Dave

On Sep 19, 8:18 pm, wujin chen  wrote:
> @Dave  printf("a=%x, b=%llx",a,b,c);  i think c will be ignored~~ , and the
> output is a=9,b=10
>
> 2011/9/19 Dave 
>
>
>
> > @Wujin: What do you expect the output to be? How does it differ from
> > what you actually get?
>
> > Dave
>
> > On Sep 18, 8:47 am, wujin chen  wrote:
> > > usigned long long x = 0x12345678;
> > > int a = 0x09;
> > > int b = 0x10;
> > > printf("a=%x, b=%llx",a,b,c);
>
> > > the result is: a=9,b=123456780010
>
> > > i wonder why~~
>
> > > can anyone explain it?
> > > thanks.
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Algorithm Geeks" group.
> > To post to this group, send email to algogeeks@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.- Hide quoted text -
>
> - Show quoted text -

-- 
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-09-19 Thread Sandy
@Utkarsh:  In Yogesh's code assigning a[1] to largest and second_largest in
the beginning, -VE case will be handled.

On Mon, Sep 19, 2011 at 12:10 PM, asdqwe  wrote:

> @Yogesh:fails for negative numbers..
>
> (though I am also confused with the ques)
>
> On Sep 19, 10:38 am, Yogesh Yadav  wrote:
> > current position is index n (say)
> > largest=0;
> > second_largest=0;
> >
> > for(i=1;i<=n;i++)
> > {
> > if(a[i]>a[n])
> > {
> > if(a[i]>largest)
> > {
> > second_largest=largest;
> > largest=a[i];}
> >
> > elseif(a[i]>second_largest)
> > second_largest=a[i];
> >
> > }
> > }
> >
> > 
> >
> >
> >
> >
> >
> >
> >
> > On Mon, Sep 19, 2011 at 2:15 AM, sagar pareek 
> wrote:
> > > Give some examples ,i m not getting ur question
> >
> > > On Mon, Sep 19, 2011 at 1:45 AM, UTKARSH SRIVASTAV <
> > > usrivastav...@gmail.com> wrote:
> >
> > >> how to find second largest element than current element in an array
> given
> > >> condition that we have to find that second largest element from index
> 1 to
> > >> the index of the current element
> >
> > >> --
> > >> *UTKARSH SRIVASTAV
> > >> CSE-3
> > >> B-Tech 3rd Year
> > >> @MNNIT 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.
> >
> > > --
> > > **Regards
> > > SAGAR PAREEK
> > > COMPUTER SCIENCE AND ENGINEERING
> > > NIT 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.
>
> --
> 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.
>
>


-- 

*Sandeep Kumar,*
 ( Mobile +91-9866507368

*“I believe in smart work, Believe Me”*

-- 
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: c output,printf("%llx")

2011-09-19 Thread wujin chen
@Dave  printf("a=%x, b=%llx",a,b,c);  i think c will be ignored~~ , and the
output is a=9,b=10

2011/9/19 Dave 

> @Wujin: What do you expect the output to be? How does it differ from
> what you actually get?
>
> Dave
>
> On Sep 18, 8:47 am, wujin chen  wrote:
> > usigned long long x = 0x12345678;
> > int a = 0x09;
> > int b = 0x10;
> > printf("a=%x, b=%llx",a,b,c);
> >
> > the result is: a=9,b=123456780010
> >
> > i wonder why~~
> >
> > can anyone explain it?
> > thanks.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@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] All valid dictionary words must be found and printed.

2011-09-19 Thread Ankur Garg
nice find bhanu..though i didnt get much :P on first read :D :D

On Tue, Sep 20, 2011 at 4:34 AM, Bhanu Kishore wrote:

> See this algorithm:
> http://en.wikipedia.org/wiki/Aho%E2%80%93Corasick_string_matching_algorithm
>
>
> --
> 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] All valid dictionary words must be found and printed.

2011-09-19 Thread Bhanu Kishore
See this algorithm:
http://en.wikipedia.org/wiki/Aho%E2%80%93Corasick_string_matching_algorithm

-- 
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: K-LCS

2011-09-19 Thread Ankur Garg
Yes...You cant use suffix trees here...Forget Coding...can anybody even
explain the algo as to how suffix trees or tries can be used here ?



On Tue, Sep 20, 2011 at 12:45 AM, pooja  wrote:

> exactly.. to implement suffix tree was out f my reach atleast during
> the test. even thou i knew dat it ws d correct DS to use. i cudn't
> actlly use it.
>
> On Sep 19, 11:51 pm, hary rathor  wrote:
> > can anybody tell about other approach because suffix tree is very thought
> to
> > implement at interview or written test time
>
> --
> 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: C-dot Interview Questions

2011-09-19 Thread Harshit Sethi


thanks siddharam,but i am form computers .I have given my interview.I
heard that C-dot asks questions from networking.But since networking
was not in our  syllaybus i was too worried as i had only 2-3 hrs to
read about that .I took an idea about networking,but wasn't confident
that i will be able to answer any cross questions.

But luckily they asked me from C and Data Structures .And i answered
all their questions very well.I am waiting for my result .It will be
announced tomorrow !!!


hoping for good news

-- 
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] is it possible??

2011-09-19 Thread Prakash D
in c/c++
without main function how to write a compilable code?
for example printing a string

On Tue, Sep 20, 2011 at 12:15 AM, hary rathor wrote:

> use #pragma  in c .
> static block in java .
>
> by the way which lang you are talking about ?
>
> --
> 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] Data Structures

2011-09-19 Thread piyush agarwal
anshul +1 yes we have to assign some memory to the pointers


On Mon, Sep 12, 2011 at 1:19 PM, rahul vatsa  wrote:

> @Anshul +1
> s,t r just pointers variables, and until u don't assign it addr of some
> object, where will it keep the values for str elements which r being
> assigned in the code.
>
>
>
> On Mon, Sep 12, 2011 at 3:38 AM, Sanjay Rajpal  wrote:
>
>> Run-Time error for Segmentation Fault.
>>
>> Sanju
>> :)
>>
>>
>>
>> On Mon, Sep 12, 2011 at 12:29 AM, Anshul Khandelwal <
>> anshul.dans1...@gmail.com> wrote:
>>
>>> @ teja bala - segmentation fault
>>> U hav to allocate memory for c and t pointers of node type.
>>>
>>>
>>> On Mon, Sep 12, 2011 at 12:29 PM, surender sanke wrote:
>>>
 In c++, its assigning one object to other, its calling operator= default
 function,
 if u overload operator= it will call urs. it just assigns ur object
 contents coming from operator=()

 surender

   On Mon, Sep 12, 2011 at 12:07 PM, teja bala <
 pawanjalsa.t...@gmail.com> wrote:

> s typedef is der...
>
>
> On Mon, Sep 12, 2011 at 12:06 PM, sukran dhawan <
> sukrandha...@gmail.com> wrote:
>
>> i think u missed a typedef b4... correct me if im wrong
>>
>>   On Mon, Sep 12, 2011 at 11:10 AM, teja bala <
>> pawanjalsa.t...@gmail.com> wrote:
>>
>>>  @sukran
>>>
>>> dis was asked in microsoft written ?
>>>
>>> take node *c 'll create a new node like that
>>>
>>>   On Mon, Sep 12, 2011 at 11:00 AM, sukran dhawan <
>>> sukrandha...@gmail.com> wrote:
>>>
  pl tell me wat ur doin here... here u ve defined a variable node
 of type struct n.

 wat does the statement node *c ??? how can u create an instance of
 an instance ?

  On Mon, Sep 12, 2011 at 10:52 AM, teja bala <
 pawanjalsa.t...@gmail.com> wrote:

> struct n { int data; struct n* next}node;
> node *c,*t;
> c->data = 10;
> t->next = null;
> *c = *t;
> what is the effect of the last statement?
>
> Is dis correct?
> My Ans:- c 'll point to node t which contains garbage value in data
> fieldc and link field a null
>
>
> --
> 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.
>>>
>>
>> --
>> 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.

>>>
>>>
>>>
>>> --
>>> ANSHUL KHANDELWAL
>>> B.TECH. Final year
>>> Computer Engineering
>>> Malaviya National Institute Of Technology, Jaipur
>>>
>>>
>>> --
>>>  You received this message because you are subscribed to the Google
>>> Groups

[algogeeks] Re: K-LCS

2011-09-19 Thread pooja
exactly.. to implement suffix tree was out f my reach atleast during
the test. even thou i knew dat it ws d correct DS to use. i cudn't
actlly use it.

On Sep 19, 11:51 pm, hary rathor  wrote:
> can anybody tell about other approach because suffix tree is very thought to
> implement at interview or written test time

-- 
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-09-19 Thread asdqwe
@Yogesh:fails for negative numbers..

(though I am also confused with the ques)

On Sep 19, 10:38 am, Yogesh Yadav  wrote:
> current position is index n (say)
> largest=0;
> second_largest=0;
>
> for(i=1;i<=n;i++)
> {
> if(a[i]>a[n])
> {
> if(a[i]>largest)
> {
> second_largest=largest;
> largest=a[i];}
>
> elseif(a[i]>second_largest)
> second_largest=a[i];
>
> }
> }
>
> 
>
>
>
>
>
>
>
> On Mon, Sep 19, 2011 at 2:15 AM, sagar pareek  wrote:
> > Give some examples ,i m not getting ur question
>
> > On Mon, Sep 19, 2011 at 1:45 AM, UTKARSH SRIVASTAV <
> > usrivastav...@gmail.com> wrote:
>
> >> how to find second largest element than current element in an array given
> >> condition that we have to find that second largest element from index 1 to
> >> the index of the current element
>
> >> --
> >> *UTKARSH SRIVASTAV
> >> CSE-3
> >> B-Tech 3rd Year
> >> @MNNIT 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.
>
> > --
> > **Regards
> > SAGAR PAREEK
> > COMPUTER SCIENCE AND ENGINEERING
> > NIT 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.

-- 
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] Good one to learn intro programming

2011-09-19 Thread Rahul
https://oli.web.cmu.edu/jcourse/workbook/activity/page?context=495037cd80020ca601966bbd4853030b
Rahul

https://oli.web.cmu.edu/jcourse/lms/students/syllabus.do?section=49502e3f80020ca60136d016a1574b4a

-- 
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: K-LCS

2011-09-19 Thread hary rathor
can anybody tell about other approach because suffix tree is very thought to
implement at interview or written test time

-- 
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: prime factorization algo

2011-09-19 Thread Manish Verma
around 999,999,999

or
the link to above pbm is
http://www.spoj.pl/problems/CZ_PROB2/

On Sep 19, 11:45 pm, Rahul  wrote:
> how much big number are You tHINKING
> Rahul
>
> On Mon, Sep 19, 2011 at 2:40 PM, Manish Verma  wrote:
> > does anybody know the fastest algo for prime factorization of a
> > number???
>
> > --
> > 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 
> > athttp://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] prime factorization algo

2011-09-19 Thread Rahul
how much big number are You tHINKING
Rahul



On Mon, Sep 19, 2011 at 2:40 PM, Manish Verma  wrote:
> does anybody know the fastest algo for prime factorization of a
> number???
>
> --
> 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] is it possible??

2011-09-19 Thread hary rathor
use #pragma  in c .
static block in java .

by the way which lang you are talking about ?

-- 
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] prime factorization algo

2011-09-19 Thread Manish Verma
does anybody know the fastest algo for prime factorization of a
number???

-- 
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] is it possible??

2011-09-19 Thread Yogesh Yadav
u dont want to call "main()" or u do not want to call it by name "main"

because if u do not want to call it by name "main" then we can do it by
macros ... and if u dont want to call "main()"... then i dont think this is
possible..

plz correct me if i m wrong

...
On Mon, Sep 19, 2011 at 10:21 PM, cegprakash  wrote:

> is it possible to print something without a main function??
> I wonder how the code won't get any compile error
>
> --
> 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] Re: random function

2011-09-19 Thread Piyush Grover
as such there is no specific method to generate random number but if you
have to implement it then you can generate a pseudo random generator
using cur_time_value_in_mili_seconds mod n.

On Mon, Sep 19, 2011 at 9:24 PM, Don  wrote:

> The most common way that it works would be that random(n) returns the
> equivalent of a random integer mod n, so 0<=x standard for how they work, so know what you are dealing with.
>
> Don
>
> On Sep 19, 10:12 am, prasanth n  wrote:
> > @don:
> > suppose if give like random(5)-> it must give any number between 0 and
> 5..
> >
> >
> >
> > On Mon, Sep 19, 2011 at 8:22 PM, Don  wrote:
> > > You mean a pseudo-random generator.
> > > Without special hardware you won't get a real random generator.
> > > Use Mersenne Twister.
> >
> > > Don
> >
> > > On Sep 19, 9:43 am, prasanth n  wrote:
> > > > anyone give an algorithm of how to generate a random
> number..probability
> > > of
> > > > occurrence of each no should be the same..
> >
> > > > --
> > > > *prasanth*
> >
> > > --
> > > 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.
> >
> > --
> > *prasanth*
>
> --
> 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] Fwd: suggestion pl

2011-09-19 Thread ravinder s
package is 8.5 lakhs and 9 lakhs

On Mon, Sep 19, 2011 at 8:25 PM, malay chakrabarti wrote:

>
> package plz for each?
>
> On Mon, Sep 19, 2011 at 8:22 PM, ravinder s wrote:
>
>>
>>
>>
>>
>>
>> Hello guys, i got an offer from inmobi and akamai. Which one to choose ?
>> Guys please reply! Im in confusion
>>
>> --
>> 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] All valid dictionary words must be found and printed.

2011-09-19 Thread sukran dhawan
trie data structure

On Mon, Sep 19, 2011 at 10:37 PM, praveen raj  wrote:

> Use trie.
> On 19-Sep-2011 8:20 PM, "Sangeeta"  wrote:
> > given an array of characters without spaces and a dictionary.All valid
> > dictionary words must be found and printed.
> > i/p : BANKERKCATXYWOMAN.
> > o/p: BANK
> > BANKER
> > CAT
> > WOMAN
> > MAN
> > (the only function you could use for dictionary is
> > dictionary.findword(char *str) which returns a Boolean value).
> > Eg. Dictionary.findword(“bank”) =>true
> > Dictionary.findword(“hj”) =>false
> >
> > --
> > 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] All valid dictionary words must be found and printed.

2011-09-19 Thread prasanth n
@don:
can u give the algorithm??

On Mon, Sep 19, 2011 at 10:37 PM, praveen raj  wrote:

> Use trie.
> On 19-Sep-2011 8:20 PM, "Sangeeta"  wrote:
> > given an array of characters without spaces and a dictionary.All valid
> > dictionary words must be found and printed.
> > i/p : BANKERKCATXYWOMAN.
> > o/p: BANK
> > BANKER
> > CAT
> > WOMAN
> > MAN
> > (the only function you could use for dictionary is
> > dictionary.findword(char *str) which returns a Boolean value).
> > Eg. Dictionary.findword(“bank”) =>true
> > Dictionary.findword(“hj”) =>false
> >
> > --
> > 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.
>



-- 
*prasanth*

-- 
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: All valid dictionary words must be found and printed.

2011-09-19 Thread Don
Assuming that findword is O(n) for words of size n, this will be an
O(n^3) algorithm. If you had a better interface to the dictionary, it
could be O(n). That's another example of why interfaces should be
designed for the intended task.

Don

On Sep 19, 9:50 am, Sangeeta  wrote:
> given an array of characters without spaces and a dictionary.All valid
> dictionary words must be found and printed.
> i/p : BANKERKCATXYWOMAN.
> o/p: BANK
> BANKER
> CAT
> WOMAN
> MAN
> (the only function you could use for dictionary is
> dictionary.findword(char *str) which returns a Boolean value).
> Eg. Dictionary.findword(“bank”) =>true
> Dictionary.findword(“hj”) =>false

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

2011-09-19 Thread KARTHIKEYAN V.B.
Hi

Can anyone say me which is the best hashing tecnicque which can store
duplicates and minimize time complexity?

Pls reply

-- 
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] All valid dictionary words must be found and printed.

2011-09-19 Thread praveen raj
Use trie.
On 19-Sep-2011 8:20 PM, "Sangeeta"  wrote:
> given an array of characters without spaces and a dictionary.All valid
> dictionary words must be found and printed.
> i/p : BANKERKCATXYWOMAN.
> o/p: BANK
> BANKER
> CAT
> WOMAN
> MAN
> (the only function you could use for dictionary is
> dictionary.findword(char *str) which returns a Boolean value).
> Eg. Dictionary.findword(“bank”) =>true
> Dictionary.findword(“hj”) =>false
>
> --
> 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] is it possible??

2011-09-19 Thread cegprakash
is it possible to print something without a main function??
I wonder how the code won't get any compile error

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

2011-09-19 Thread prasanth n
@teja:

if we use call by value in copy constructor,,

class base
{
int a;
public:
base(int x)
{
a=x;
}

base(base c)
{
}

};

int main()
{
base b(1);
base b1=b;// this ll be seen as base c=b(see the copy constructor)..this ll
in turn call another copy constructor..

return 0;
}

now it ll create a separate object each time you call a copy constructor..so
it ll result in infinite loop..so we have to pass by reference..
On Mon, Sep 19, 2011 at 7:53 PM, teja bala wrote:

> Does anyone can xplain Function object or functor in C++ with
> example???
>
>
> thx in advance.
>
> --
> 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.
>
>


-- 
*prasanth*

-- 
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: random function

2011-09-19 Thread Don
The "rand()" functions built into many compilers are notoriously bad.
If the quality of the random series doesn't matter much, it might be
ok. If you are doing any kind of simulation, use Mersenne Twister.
Don

On Sep 19, 10:48 am, abhinav gupta  wrote:
> for that u have rand() function in c programming just go through it
>
> On Mon, Sep 19, 2011 at 8:42 PM, prasanth n  wrote:
> > @don:
> > suppose if give like random(5)-> it must give any number between 0 and 5..
>
> > On Mon, Sep 19, 2011 at 8:22 PM, Don  wrote:
>
> >> You mean a pseudo-random generator.
> >> Without special hardware you won't get a real random generator.
> >> Use Mersenne Twister.
>
> >> Don
>
> >> On Sep 19, 9:43 am, prasanth n  wrote:
> >> > anyone give an algorithm of how to generate a random number..probability
> >> of
> >> > occurrence of each no should be the same..
>
> >> > --
> >> > *prasanth*
>
> >> --
> >> 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.
>
> > --
> > *prasanth*
>
> > --
> > 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: random function

2011-09-19 Thread Don
The most common way that it works would be that random(n) returns the
equivalent of a random integer mod n, so 0<=x wrote:
> @don:
> suppose if give like random(5)-> it must give any number between 0 and 5..
>
>
>
> On Mon, Sep 19, 2011 at 8:22 PM, Don  wrote:
> > You mean a pseudo-random generator.
> > Without special hardware you won't get a real random generator.
> > Use Mersenne Twister.
>
> > Don
>
> > On Sep 19, 9:43 am, prasanth n  wrote:
> > > anyone give an algorithm of how to generate a random number..probability
> > of
> > > occurrence of each no should be the same..
>
> > > --
> > > *prasanth*
>
> > --
> > 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.
>
> --
> *prasanth*

-- 
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: random function

2011-09-19 Thread abhinav gupta
for that u have rand() function in c programming just go through it


On Mon, Sep 19, 2011 at 8:42 PM, prasanth n  wrote:

> @don:
> suppose if give like random(5)-> it must give any number between 0 and 5..
>
>
> On Mon, Sep 19, 2011 at 8:22 PM, Don  wrote:
>
>> You mean a pseudo-random generator.
>> Without special hardware you won't get a real random generator.
>> Use Mersenne Twister.
>>
>> Don
>>
>> On Sep 19, 9:43 am, prasanth n  wrote:
>> > anyone give an algorithm of how to generate a random number..probability
>> of
>> > occurrence of each no should be the same..
>> >
>> > --
>> > *prasanth*
>>
>> --
>> 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.
>>
>>
>
>
> --
> *prasanth*
>
> --
> 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] All valid dictionary words must be found and printed.

2011-09-19 Thread keyan karthi
didnt read the question properly ... ignore ma post !! :/

On Mon, Sep 19, 2011 at 8:44 PM, Yogesh Yadav  wrote:

> i=0;
> char *str;
> while(a[i]!=NULL)
> {
>j=0;
>
>while(j!=i)
>{
>   for(k=j;k<=i;k++)
>   {
>  l=0;
>  str[l]=a[j];
>   }
>   if(Dictionary.findword(str))
>   printf(str);
>   j++;
>}
> }
>
>
> ...
>
> On Mon, Sep 19, 2011 at 8:20 PM, Sangeeta  wrote:
>
>> given an array of characters without spaces and a dictionary.All valid
>> dictionary words must be found and printed.
>> i/p : BANKERKCATXYWOMAN.
>> o/p: BANK
>> BANKER
>> CAT
>> WOMAN
>> MAN
>> (the only function you could use for dictionary is
>> dictionary.findword(char *str) which returns a Boolean value).
>> Eg. Dictionary.findword(“bank”) =>true
>> Dictionary.findword(“hj”) =>false
>>
>> --
>> 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] All valid dictionary words must be found and printed.

2011-09-19 Thread keyan karthi
construct a trie.. then a simple recursion on the trie ll do ... :)  any
standard tutorial on tries ll help u build one ...

then the recursion part should look something like this,
start scanning from root of tire.

if(end of word is found)
{
   take is as a word, start searching from root of a trie + consider this as
a prefix and proceed from the current state itself
}
else
  proceed to next state

On Mon, Sep 19, 2011 at 8:20 PM, Sangeeta  wrote:

> given an array of characters without spaces and a dictionary.All valid
> dictionary words must be found and printed.
> i/p : BANKERKCATXYWOMAN.
> o/p: BANK
> BANKER
> CAT
> WOMAN
> MAN
> (the only function you could use for dictionary is
> dictionary.findword(char *str) which returns a Boolean value).
> Eg. Dictionary.findword(“bank”) =>true
> Dictionary.findword(“hj”) =>false
>
> --
> 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] All valid dictionary words must be found and printed.

2011-09-19 Thread Yogesh Yadav
// there were some mistakes...

so...

i=0;
char *str;
while(a[i]!=NULL)
{
   j=0;

   while(j!=i)
   {
  l=0;
  for(k=j;k<=i;k++)
  {

 str[l]=a[j];
 l++
  }
  if(Dictionary.findword(str))
  printf(str);
  j++;
   }
}
On Mon, Sep 19, 2011 at 8:44 PM, Yogesh Yadav  wrote:

> i=0;
> char *str;
> while(a[i]!=NULL)
> {
>j=0;
>
>while(j!=i)
>{
>   for(k=j;k<=i;k++)
>   {
>  l=0;
>  str[l]=a[j];
>   }
>   if(Dictionary.findword(str))
>   printf(str);
>   j++;
>}
> }
>
>
> ...
>
> On Mon, Sep 19, 2011 at 8:20 PM, Sangeeta  wrote:
>
>> given an array of characters without spaces and a dictionary.All valid
>> dictionary words must be found and printed.
>> i/p : BANKERKCATXYWOMAN.
>> o/p: BANK
>> BANKER
>> CAT
>> WOMAN
>> MAN
>> (the only function you could use for dictionary is
>> dictionary.findword(char *str) which returns a Boolean value).
>> Eg. Dictionary.findword(“bank”) =>true
>> Dictionary.findword(“hj”) =>false
>>
>> --
>> 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] All valid dictionary words must be found and printed.

2011-09-19 Thread Yogesh Yadav
i=0;
char *str;
while(a[i]!=NULL)
{
   j=0;

   while(j!=i)
   {
  for(k=j;k<=i;k++)
  {
 l=0;
 str[l]=a[j];
  }
  if(Dictionary.findword(str))
  printf(str);
  j++;
   }
}


...
On Mon, Sep 19, 2011 at 8:20 PM, Sangeeta  wrote:

> given an array of characters without spaces and a dictionary.All valid
> dictionary words must be found and printed.
> i/p : BANKERKCATXYWOMAN.
> o/p: BANK
> BANKER
> CAT
> WOMAN
> MAN
> (the only function you could use for dictionary is
> dictionary.findword(char *str) which returns a Boolean value).
> Eg. Dictionary.findword(“bank”) =>true
> Dictionary.findword(“hj”) =>false
>
> --
> 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] Re: random function

2011-09-19 Thread prasanth n
@don:
suppose if give like random(5)-> it must give any number between 0 and 5..

On Mon, Sep 19, 2011 at 8:22 PM, Don  wrote:

> You mean a pseudo-random generator.
> Without special hardware you won't get a real random generator.
> Use Mersenne Twister.
>
> Don
>
> On Sep 19, 9:43 am, prasanth n  wrote:
> > anyone give an algorithm of how to generate a random number..probability
> of
> > occurrence of each no should be the same..
> >
> > --
> > *prasanth*
>
> --
> 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.
>
>


-- 
*prasanth*

-- 
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] Fwd: suggestion pl

2011-09-19 Thread malay chakrabarti
package plz for each?

On Mon, Sep 19, 2011 at 8:22 PM, ravinder s  wrote:

>
>
>
>
>
> Hello guys, i got an offer from inmobi and akamai. Which one to choose ?
> Guys please reply! Im in confusion
>
> --
> 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] Fwd: suggestion pl

2011-09-19 Thread ravinder s
Hello guys, i got an offer from inmobi and akamai. Which one to choose ?
Guys please reply! Im in confusion

-- 
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: random function

2011-09-19 Thread Don
You mean a pseudo-random generator.
Without special hardware you won't get a real random generator.
Use Mersenne Twister.

Don

On Sep 19, 9:43 am, prasanth n  wrote:
> anyone give an algorithm of how to generate a random number..probability of
> occurrence of each no should be the same..
>
> --
> *prasanth*

-- 
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] All valid dictionary words must be found and printed.

2011-09-19 Thread Sangeeta
given an array of characters without spaces and a dictionary.All valid
dictionary words must be found and printed.
i/p : BANKERKCATXYWOMAN.
o/p: BANK
BANKER
CAT
WOMAN
MAN
(the only function you could use for dictionary is
dictionary.findword(char *str) which returns a Boolean value).
Eg. Dictionary.findword(“bank”) =>true
Dictionary.findword(“hj”) =>false

-- 
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: Directi Questions - needed answers

2011-09-19 Thread Ankur Garg
Q9 - >  1 *logn for getting the minimum element ..Normal heap Sort procedure

Q3 - > n+logn-2 comparisions so 51 -2 + log 51


Regards
Ankur

On Mon, Sep 19, 2011 at 7:59 PM, Ashima .  wrote:

> m getting  result in 95 matches
>
> Ashima
> M.Sc.(Tech)Information Systems
> 4th year
> BITS Pilani
> Rajasthan
>
>
>
>
> On Mon, Sep 19, 2011 at 7:07 PM, malay chakrabarti wrote:
>
>> i have explained :)
>>
>> On Sun, Sep 18, 2011 at 11:53 PM, Ashima .  wrote:
>>
>>> @malay: how cm n+logn-2?
>>> cn u explain the logic ?
>>>
>>> Ashima
>>> M.Sc.(Tech)Information Systems
>>>  4th year
>>> BITS Pilani
>>> Rajasthan
>>>
>>>
>>>
>>>
>>>  On Sun, Sep 18, 2011 at 11:07 AM, Ashima . wrote:
>>>
 rite! 62.5%

 Ashima
 M.Sc.(Tech)Information Systems
 4th year
 BITS Pilani
 Rajasthan




 On Sat, Sep 17, 2011 at 9:04 PM, malay chakrabarti 
 wrote:

> create a tournament tree.in each round one value is eliminated to
> obtain in the process the winner or the highest value in n-1 comparisons.
> Then check the queue of the winner which contains log(n) entries of the
> values beaten by the winner which implicitly will contain the runners
> up.Then log(n)-1 comparisons to find the highest among all the losers whom
> the winner had beaten. So all over complexity will be n-1 +log(n) -1 =
> n+log(n)-2. Hp that answers ur query. nice question btw :)
>
>
> On Sun, Sep 18, 2011 at 8:02 AM, VIHARRI wrote:
>
>> hey i'm also thinking n + logn -2.. but couldnt able to figure out
>> how??? can you please explain the logic
>>
>> --
>> 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.
>>>
>>
>>  --
>> 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.



[algogeeks] Re: Makefile in c doubt???

2011-09-19 Thread Dave
@Saurabh: Maybe after the line
p1.o : p1.c
you should insert the line
gcc -c p1.c
Without that, make uses the default rule for constructing a .o file
from a .c file.

Dave

On Sep 19, 4:58 am, Saurabh  wrote:
> Can any one have any idea how this make file is working.
> Without compiling gcc -c p1.c.
>
> ***
> exe : p1.o
>         gcc -o exe p1.o
> p1.o : p1.c
> clean:
>         rm *.o
>         rm exe
> ***
> Makefile output as follows :
> cc    -c -o p1.o p1.c // I am not getting this line ???
> gcc -o exe p1.o
>
> --
> Regards  n Luv
> Saurabh Badhai

-- 
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] random function

2011-09-19 Thread prasanth n
anyone give an algorithm of how to generate a random number..probability of
occurrence of each no should be the same..

-- 
*prasanth*

-- 
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: Directi Questions - needed answers

2011-09-19 Thread Ashima .
m getting  result in 95 matches
Ashima
M.Sc.(Tech)Information Systems
4th year
BITS Pilani
Rajasthan




On Mon, Sep 19, 2011 at 7:07 PM, malay chakrabarti wrote:

> i have explained :)
>
> On Sun, Sep 18, 2011 at 11:53 PM, Ashima .  wrote:
>
>> @malay: how cm n+logn-2?
>> cn u explain the logic ?
>>
>> Ashima
>> M.Sc.(Tech)Information Systems
>>  4th year
>> BITS Pilani
>> Rajasthan
>>
>>
>>
>>
>>  On Sun, Sep 18, 2011 at 11:07 AM, Ashima . wrote:
>>
>>> rite! 62.5%
>>>
>>> Ashima
>>> M.Sc.(Tech)Information Systems
>>> 4th year
>>> BITS Pilani
>>> Rajasthan
>>>
>>>
>>>
>>>
>>> On Sat, Sep 17, 2011 at 9:04 PM, malay chakrabarti 
>>> wrote:
>>>
 create a tournament tree.in each round one value is eliminated to
 obtain in the process the winner or the highest value in n-1 comparisons.
 Then check the queue of the winner which contains log(n) entries of the
 values beaten by the winner which implicitly will contain the runners
 up.Then log(n)-1 comparisons to find the highest among all the losers whom
 the winner had beaten. So all over complexity will be n-1 +log(n) -1 =
 n+log(n)-2. Hp that answers ur query. nice question btw :)


 On Sun, Sep 18, 2011 at 8:02 AM, VIHARRI  wrote:

> hey i'm also thinking n + logn -2.. but couldnt able to figure out
> how??? can you please explain the logic
>
> --
> 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.
>>
>
>  --
> 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: question on algorithm

2011-09-19 Thread Don
I divide by 5 to determine how many ways there are to use nickles. I
could have written a for loop:

for(nickles = 0; (quarters+dimes+nickles) <= n; nickles += 5)
  ++result;

But that would have just executed 1+(n-quarters-dimes)/5 times
incrementing result every time. I just computed the result in one step
instead.

Don

On Sep 17, 8:08 am, bharatkumar bagana 
wrote:
> @don:
> will u pls explain why divided by 5 is used 
>
>
>
> On Fri, Sep 16, 2011 at 3:44 PM, prasanth n  wrote:
> > @Don:
> > thanks a lot
>
> > On Sat, Sep 17, 2011 at 12:28 AM, Don  wrote:
>
> >> The algorithm is to count them, looping over the number of quarters
> >> and dimes. Then it is easy to compute the number of nickles which
> >> could be used, and the shortfall is made up with pennies.
> >> It is very common to see a recursive solution, but that is not
> >> necessary or beneficial when the iterative solution is so simple.
> >> Don
>
> >>  int result = 0;
> >>  for(int quarters = 0; quarters <= n; quarters += 25)
> >>      for(int dimes = 0; (quarters+dimes) <= n; dimes += 10)
> >>        result += 1 + (n-quarters-dimes) / 5;
>
> >> On Sep 16, 1:35 pm, prasanth n  wrote:
> >> > Given an infinite number of quarters (25 cents), dimes (10 cents),
> >> nickels
> >> > (5 cents) and pennies (1 cent), write code to calculate the number of
> >> ways
> >> > of representing n cents.
> >> > also do give an algorithm first..
>
> >> > --
> >> > *prasanth*
>
> >> --
> >> 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.
>
> > --
> > *prasanth*
>
> > --
> > 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.
>
> --
>
> **Please do not print this e-mail until urgent requirement. Go Green!!
> Save Papers <=> Save Trees
> *BharatKumar Bagana*
> **http://www.google.com/profiles/bagana.bharatkumar
> *
> Mobile +91 8056127652*
> 

-- 
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] C++ Query

2011-09-19 Thread teja bala
Does anyone can xplain Function object or functor in C++ with
example???


thx in advance.

-- 
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: Array ques based on correlation factor

2011-09-19 Thread Don
This depends on rnd being a good pseudo-random generator. I don't
suggest using the RNG built into many compilers. Instead use something
like the Mersenne Twister which produces much better results with an
extremely long period. My Random class has a "gen" method which
returns an integer in the range 0..n-1.

int *shuffle(int n)
{
  int *result = (int *)malloc(n * sizeof(int));
  result[0] = 0;
  for(int i = 1; i < n; ++i)
  {
int j = rnd.gen(i+1);
result[i] = result[j];
result[j] = i;
  }
  return result;
}

On Sep 17, 12:12 pm, sivaviknesh s  wrote:
> Write a method fill up an array of size n - and returns the array to the
> caller - with the following conditions
>
> 1. the numbers shud be between 0 to n-1
> 2. no repeated numbers
> 3. the method should have a deterministic time to fill the arrays
> 4. arrays returned from the method should have low-correlation factor
>
> ...btw what does 4 th point mean? what is a correlation factor?? Plz provide
> code and explain...
>
> --
> Regards,
> $iva

-- 
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] identify all the affected nodes in a Graph

2011-09-19 Thread shady
example ?
link to the actual problem ?

On Mon, Sep 19, 2011 at 7:44 PM, Sangeeta  wrote:

> A graph is given :
>
> nodes denoting computers
> edges denoting connections
>
> if one system(node) fails , the other systems(node) may get affected.
> To identify all the affected nodes, which data structure is used? How
> do u implement it?
>
> --
> 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] identify all the affected nodes in a Graph

2011-09-19 Thread Sangeeta
A graph is given :

nodes denoting computers
edges denoting connections

if one system(node) fails , the other systems(node) may get affected.
To identify all the affected nodes, which data structure is used? How
do u implement it?

-- 
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: c output

2011-09-19 Thread Bhavesh agrawal
abhishek can you plz explain

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

2011-09-19 Thread teja bala
@praveen

how about shallow copy and deep copy of copy  constructor?

On Mon, Sep 19, 2011 at 6:53 PM, praveen raj  wrote:

> Yes u r saying correct .
> On 19-Sep-2011 6:39 PM, "teja bala"  wrote:
> > Why do we pass a reference for copy constructors?
> > If it does shallow copy for pass by value (user defined object), how
> > will it do the deep copy?
> >
> >
> > Ans:- if we don't pass the reference, every time a new object copy
> > like
> >
> > A a=b;
> >
> > constructor will be called twice ,,
> >
> > correct me if i'm wrong...
> >
> > help me regarding about shallow copy and deep copy in copy
> > constructor.
> >
> > --
> > 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] Re: Directi Questions - needed answers

2011-09-19 Thread malay chakrabarti
i have explained :)

On Sun, Sep 18, 2011 at 11:53 PM, Ashima .  wrote:

> @malay: how cm n+logn-2?
> cn u explain the logic ?
>
> Ashima
> M.Sc.(Tech)Information Systems
> 4th year
> BITS Pilani
> Rajasthan
>
>
>
>
> On Sun, Sep 18, 2011 at 11:07 AM, Ashima .  wrote:
>
>> rite! 62.5%
>>
>> Ashima
>> M.Sc.(Tech)Information Systems
>> 4th year
>> BITS Pilani
>> Rajasthan
>>
>>
>>
>>
>> On Sat, Sep 17, 2011 at 9:04 PM, malay chakrabarti wrote:
>>
>>> create a tournament tree.in each round one value is eliminated to obtain
>>> in the process the winner or the highest value in n-1 comparisons. Then
>>> check the queue of the winner which contains log(n) entries of the values
>>> beaten by the winner which implicitly will contain the runners up.Then
>>> log(n)-1 comparisons to find the highest among all the losers whom the
>>> winner had beaten. So all over complexity will be n-1 +log(n) -1 =
>>> n+log(n)-2. Hp that answers ur query. nice question btw :)
>>>
>>>
>>> On Sun, Sep 18, 2011 at 8:02 AM, VIHARRI  wrote:
>>>
 hey i'm also thinking n + logn -2.. but couldnt able to figure out
 how??? can you please explain the logic

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

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

2011-09-19 Thread praveen raj
Yes u r saying correct .
On 19-Sep-2011 6:39 PM, "teja bala"  wrote:
> Why do we pass a reference for copy constructors?
> If it does shallow copy for pass by value (user defined object), how
> will it do the deep copy?
>
>
> Ans:- if we don't pass the reference, every time a new object copy
> like
>
> A a=b;
>
> constructor will be called twice ,,
>
> correct me if i'm wrong...
>
> help me regarding about shallow copy and deep copy in copy
> constructor.
>
> --
> 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] C++ Query

2011-09-19 Thread teja bala
Why do we pass a reference for copy constructors?
 If it does shallow copy for pass by value (user defined object), how
will it do the deep copy?


Ans:- if we don't pass the reference, every time a new object copy
like

A a=b;

constructor will be called twice ,,

correct me if i'm wrong...

help me regarding about shallow copy and deep copy  in copy
constructor.

-- 
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] suggestion pl

2011-09-19 Thread ravinder s
Hello guys, i got an offer from inmobi and akamai. Which one to choose ?

-- 
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: c output

2011-09-19 Thread sukran dhawan
According to K and R c book , when the return value is specified and yet we
fail to return a value, it is undefined. It is compiler dependent.

So i feel  there is no meaning in thinking abt it

On Mon, Sep 19, 2011 at 4:38 PM, abhishek  wrote:

> @ sukran
> if it is giving same ans then there  has to be some reason,
>
> On Sep 19, 12:45 pm, sukran dhawan  wrote:
> > common guys its undefined acc to standard c 
> >
> > On Mon, Sep 19, 2011 at 12:36 PM, Siddhartha Banerjee <
> >
> >
> >
> >
> >
> >
> >
> > thefourrup...@gmail.com> wrote:
> > > on running,every time i get  second a=30... any reasons for that???
> >
> > >  --
> > > 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] Please share amazon online test questions for freshers

2011-09-19 Thread Deoki Nandan
plz share .

On 8 September 2011 19:41, algo geek  wrote:

>
>  --
> 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
Deoki Nandan Vishwakarma

*
*

-- 
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: c output

2011-09-19 Thread abhishek
@ sukran
if it is giving same ans then there  has to be some reason,

On Sep 19, 12:45 pm, sukran dhawan  wrote:
> common guys its undefined acc to standard c 
>
> On Mon, Sep 19, 2011 at 12:36 PM, Siddhartha Banerjee <
>
>
>
>
>
>
>
> thefourrup...@gmail.com> wrote:
> > on running,every time i get  second a=30... any reasons for that???
>
> >  --
> > 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: c output

2011-09-19 Thread abhishek
output is
 18 9 0
0
0
8

the same was expected.

printf uses stack when it has multiple arguments to print
On Sep 18, 1:19 pm, Bhavesh agrawal  wrote:
> another que..
>
> #include
> main()
> {
>     int a;
>     int i=10;
>     printf("%d %d %d\n",i+++i,i,i---i);
>     printf("%d\n",i---i);
>     a=i---i;
>     printf("%d \n%d",a,i);
>     return 0;
>
> }
>
> output:
>
> 18 10 0
> 0
> 0
> 8
>
> how ??

-- 
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: Microsoft Question

2011-09-19 Thread bharatkumar bagana
@piyush: what is time and space complexity  of u'r sol..

On Mon, Sep 19, 2011 at 11:03 AM, Piyush Grover
wrote:

> sry, in the findWord function all a's are different e.g
> a0, a1a7
>
> and if(!a) is actually if(a0||a1||...||a7)
>
> thnx
> piyush
>
>
> On Mon, Sep 19, 2011 at 1:10 AM, Piyush Grover 
> wrote:
>
>> for(i = 0; i < n; i++)
>>for(j = 0; j < n; j++){
>>   setColor(i, j) = black;
>>if(A[i][j] == str[0]){
>>   setColor(i, j) = blue;
>>   a =  findWord(A, i, j, str, 1)
>>   if(!a) setColor(i, j) = black;
>>else break;
>> }
>>}
>>
>> findWord(A, i, j, str, k){
>> if(k == strlen(str))
>>   return true;
>>
>>  if(A[i-1][j-1] == str[k] && getColor(i-1, j-1) != blue)
>>   setColor(i-1, j-1) = blue;
>>   a = findWord(A, i-1, j-1, str, k+1);
>>
>>  if(A[i-1][j] == str[k] && getColor(i-1, j) != blue)
>>  setColor(i-1, j) = blue;
>>   a = findWord(A, i-1, j, str, k+1);
>>
>>  if(A[i-1][j+1] == str[k] && getColor(i-1, j+1) != blue)
>>   setColor(i-1, j+1) = blue;
>>   a = findWord(A, i-1, j+1, str, k+1);
>>
>>  if(A[i][j-1] == str[k] && getColor(i, j-1) != blue)
>>  setColor(i, j-1) = blue;
>>   a = findWord(A, i, j-1, str, k+1);
>>
>>  if(A[i][j+1] == str[k] && getColor(i, j+1) != blue)
>>   setColor(i, j+1) = blue;
>>   a = findWord(A, i, j+1, str, k+1);
>>
>>   if(A[i+1][j-1] == str[k] && getColor(i+1, j-1) != blue)
>>   setColor(i+1, j-1) = blue;
>>   a = findWord(A, i+1, j-1, str, k+1);
>>
>>   if(A[i+1][j] == str[k] && getColor(i+1, j) != blue)
>>   setColor(i+1, j) = blue;
>>   a = findWord(A, i+1, j, str, k+1);
>>
>>   if(A[i+1][j+1] == str[k] && getColor(i+1, j+1) != blue)
>>setColor(i+1, j+1) = blue;
>>a = findWord(A, i+1, j+1, str, k+1);
>>
>>if(!a)  setColor(i, j) = black;
>>
>>   return a;
>> }
>>
>> This is a pseudo code. I haven't considered the boundary cases to make it
>> understandable.
>>
>>
>>
>> On Mon, Sep 19, 2011 at 12:21 AM, vikas wrote:
>>
>>> hmm, nice questions, can we create an  efficient DS to query the
>>> strings ??
>>>
>>>
>>> tried using trie but memory prints are very large ( O(n^2) )? :-((
>>>
>>>
>>>
>>> On Sep 18, 12:59 pm, Anup Ghatage  wrote:
>>> > For the mentioned scenario, it seems to be the only feasible solution.
>>> >
>>> > On Sun, Sep 18, 2011 at 3:57 AM, bharatkumar bagana <
>>> >
>>> >
>>> >
>>> >
>>> >
>>> >
>>> >
>>> >
>>> >
>>> > bagana.bharatku...@gmail.com> wrote:
>>> > > @anup : the time complexity will be very high ...
>>> O(n*M*M)...n=#characters
>>> > > to be checked...M=size of the matrix ...
>>> >
>>> > > On Sat, Sep 17, 2011 at 8:30 AM, Anup Ghatage 
>>> wrote:
>>> >
>>> > >> As WgpShashank once pointed out.
>>> >
>>> > >> Search the whole matrix for the first character instances, for each
>>> > >> instance, send the array, string and that char's position to a
>>> function that
>>> > >> will recursively check its direct neighbors for the next character.
>>> > >> Exhaustively check like that for each starting characters appearance
>>> till
>>> > >> you find the string, if any.
>>> >
>>> > >> On Fri, Sep 16, 2011 at 11:55 PM, Ankur Garg >> >wrote:
>>> >
>>> > >>> In a matrix of. characters, find an string. String can be in any
>>> way (all
>>> > >>> 8 neighbours to be considered)
>>> > >>> like find Microsoft in below matrix.
>>> >
>>> > >>>  A
>>> > >>> C
>>> > >>> P
>>> > >>> *R
>>> > >>> *C*
>>> > >>> *X
>>> > >>> *S
>>> > >>> **O
>>> > >>> *P
>>> > >>> *C*
>>> > >>> V
>>> > >>> *O*
>>> > >>> V
>>> > >>> N
>>> > >>> *I*
>>> > >>> W
>>> > >>>  G
>>> > >>> *F
>>> > >>> **M
>>> > >>> *N
>>> > >>> Q
>>> > >>>  A
>>> > >>> *T*
>>> > >>> I
>>> > >>> T
>>> >
>>> > >>>  *Any Ideas How to Solve/Approach this problem ?*
>>> >
>>> > >>>  --
>>> > >>> 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.
>>> >
>>> > >> --
>>> > >> Anup Ghatage
>>> >
>>> > >>  --
>>> > >> 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.
>>> >
>>> > > --
>>> >
>>> > > **Please do not print this e-mail until urgent requirement. Go
>>> Green!!
>>> > > Save Papers <=> Save Trees
>>> > > *BharatKumar Bagana*
>>> > > **http://www.google.com/profiles/bagan

Re: [algogeeks] Directi Questions - needed answers

2011-09-19 Thread teja bala
5 ans-C

reference http://en.wikipedia.org/wiki/Reentrant_(subroutine)

On Sat, Sep 17, 2011 at 9:11 AM, VIHARRI  wrote:

> 1. Minimum no.of comparisons required to select the 2nd max element in
> an array of N numbers.
>
> 2. What are the number of counting ties for four horses. ( example for
> two horses A and B there are three cases - A wins, B wins, A & B
> ties ).
>
> 3. What are the minimum no.of tournaments needed to get the winner. A
> player is out when he loses two matches. Total players are 51.
> ( Badminton ).
>
> 4. while(true)
>{
> sleep 1sencond;
> if( getpid() % 2 == 0 )
> {
> fork();
> }
>   }
> How many no.of processes are created by the end of 12th second, if
> time starts from 0th second? Process id's start from 0.
>
> 5. Which of the following are thread safe?
> a) Atomic operations
> b) Mutual exclusion
> c) Re-entrant
> d) Queuing
>
> 6. When a dice is rolled the outcome of the face is summed up each
> time, and rolling is stopped when the sum becomes greater than 100.
> Which of the following have more probability to become sum.
> a) 103
> b) 102
> c) 100
> d) all have equal probability
> e) 101
>
> 7. A man moves 1km east, 2km north, 3km west, 4km south, 5km east, 6km
> north, 7km west and so on until he travels total of 300km so what
> will be the distance from origin?
>
> 8. Alam bought 5pens, 7 pencils, 4 erasers. Ashok bought 6 pens, 8
> erasers, 14 pencils and paid half more the amount Alam paid. What is
> the percentage of amount did Alam spent on buying pens?
>
> 9. Time complexity to get min elements from MAX heap.
>
> --
> 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] Makefile in c doubt???

2011-09-19 Thread Saurabh
Can any one have any idea how this make file is working.
Without compiling gcc -c p1.c.


***
exe : p1.o
gcc -o exe p1.o
p1.o : p1.c
clean:
rm *.o
rm exe
***
Makefile output as follows :
cc-c -o p1.o p1.c // I am not getting this line ???
gcc -o exe p1.o




-- 
Regards  n Luv
Saurabh Badhai

-- 
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: Directi Questions - needed answers

2011-09-19 Thread praveen raj
For question 5  reentrant

On 19-Sep-2011 1:43 PM, "Nitin Garg"  wrote:
> Can someone tell answers to question 2 and 5 with explanation??
>
>
>
>
> On Mon, Sep 19, 2011 at 1:40 PM, Nitin Garg wrote:
>
>> In Question 4 i just kept counting new processes that are being added in
>> every iteration.
>> No. of new processes being created is equal to the already running no. of
>> even pid processes.
>>
>> Time - PId
>> 0 - 0 1
>> 1 - 0,1 2
>> 2, - 0,1,2 3
>> 3, - 0,1,2,3,4 5
>> 4 - 0,1,2,3,4,5,6,7 8
>> .
>> .
>> .
>>
>>
>>
>> 1,2,3,5,8,11,17,25,38,57,86,129,194
>>
>> I kept counting, got 194.
>> Don't know of any shortcut.
>>
>>
>>
>>
>>
>> On Mon, Sep 19, 2011 at 1:35 PM, Nitin Garg wrote:
>>
>>> Question 6 -
>>> Intuitively you can see that the greater the sum is, the greater the
>>> favorable events in sample space.
>>>
>>> e.g. - sum = 1 .. cases {(1)} Pr = 1/6
>>> sum = 2 cases {(2),(1,1)} Pr = 1/6 + 1/36
>>> sum = 3 cases {(3),(2,1)(1,2)(1,1,1)} Pr = 1/6 + 1/36 +1/36 +
>>> 1/216
>>>
>>>
>>> for a more formal proof, look at the recursion -
>>>
>>>
>>> P(k) = (P(k-6) + P(k-5) + P(k-4)... P(k-1)))/6
>>>
>>> where P(0) = 1, P(i) = 0 for i<0
>>>
>>> Base case -
>>> P(2) > P(1)
>>>
>>> Hypothesis -
>>>
>>> P(i) > P(i-1) for all i <= k
>>>
>>> To prove
>>> P(k+1) > P(k)
>>>
>>> Proof
>>> P(k+1) - P(k) = (P(k) - P(k-6))/6 > 0
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> On Mon, Sep 19, 2011 at 1:04 PM, Nitin Garg wrote:
>>>
 Question 3 -
 To eliminate one player, you need to host atleast 2 matches and make
him
 loose in both 2. These 2 matches can not contribute to elimination of
any
 other player.
 So, min 2 matches for every player who is to be eliminated, hence 100.


 On Mon, Sep 19, 2011 at 11:54 AM, Bhanu Chowdary <
 bhanuchowd...@gmail.com> wrote:

> @Nitin: Answer to question 3 is 50.
>
>
> On Mon, Sep 19, 2011 at 11:44 AM, praveen raj wrote:
>
>> @nitin Plz explain how u have reached answer of question no. 4 and 6
>>
>> On 19-Sep-2011 12:26 AM, "Nitin Garg" 
>> wrote:
>> >
>> > Answer 3 - 100
>> > Answer 6 - 103
>> > Answer 4 - 194 total processes including the parent
>> > Answer 7 - 12 km south, 12 km east
>> >
>> >
>> > On Sun, Sep 18, 2011 at 11:53 PM, Ashima . 
>> wrote:
>> >>
>> >> @malay: how cm n+logn-2?
>> >> cn u explain the logic ?
>> >>
>> >> Ashima
>> >> M.Sc.(Tech)Information Systems
>> >> 4th year
>> >> BITS Pilani
>> >> Rajasthan
>> >>
>> >>
>> >>
>> >>
>> >> On Sun, Sep 18, 2011 at 11:07 AM, Ashima . 
>> wrote:
>> >>>
>> >>> rite! 62.5%
>> >>>
>> >>> Ashima
>> >>> M.Sc.(Tech)Information Systems
>> >>> 4th year
>> >>> BITS Pilani
>> >>> Rajasthan
>> >>>
>> >>>
>> >>>
>> >>>
>> >>> On Sat, Sep 17, 2011 at 9:04 PM, malay chakrabarti <
>> m1234...@gmail.com> wrote:
>> 
>>  create a tournament tree.in each round one value is eliminated
to
>> obtain in the process the winner or the highest value in n-1
comparisons.
>> Then check the queue of the winner which contains log(n) entries of
the
>> values beaten by the winner which implicitly will contain the runners
>> up.Then log(n)-1 comparisons to find the highest among all the losers
whom
>> the winner had beaten. So all over complexity will be n-1 +log(n) -1
=
>> n+log(n)-2. Hp that answers ur query. nice question btw :)
>> 
>> 
>>  On Sun, Sep 18, 2011 at 8:02 AM, VIHARRI 
>> wrote:
>> >
>> > hey i'm also thinking n + logn -2.. but couldnt able to figure
>> out
>> > how??? can you please explain the logic
>> >
>> > --
>> > 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, 

Re: [algogeeks] Re: Directi Questions - needed answers

2011-09-19 Thread praveen raj
Given in the question
.
 On 19-Sep-2011 2:57 PM, "Bhanu Chowdary"  wrote:
> @Nithin: Sorry I did not understand your logic!! If a person looses a
match
> he should be knocked out of the tournament. Could you please explain why 2
> matches to knock out a person??
>
> On Mon, Sep 19, 2011 at 2:47 PM, praveen raj 
wrote:
>
>> For question 2 see ashima link.
>>
>> On 19-Sep-2011 1:43 PM, "Nitin Garg"  wrote:
>> >
>> > Can someone tell answers to question 2 and 5 with explanation??
>> >
>> >
>> >
>> >
>> > On Mon, Sep 19, 2011 at 1:40 PM, Nitin Garg 
>> wrote:
>> >>
>> >> In Question 4 i just kept counting new processes that are being added
in
>> every iteration.
>> >> No. of new processes being created is equal to the already running no.
>> of even pid processes.
>> >>
>> >> Time - PId
>> >> 0 - 0 1
>> >> 1 - 0,1 2
>> >> 2, - 0,1,2 3
>> >> 3, - 0,1,2,3,4 5
>> >> 4 - 0,1,2,3,4,5,6,7 8
>> >> .
>> >> .
>> >> .
>> >>
>> >>
>> >>
>> >> 1,2,3,5,8,11,17,25,38,57,86,129,194
>> >>
>> >> I kept counting, got 194.
>> >> Don't know of any shortcut.
>> >>
>> >>
>> >>
>> >>
>> >>
>> >> On Mon, Sep 19, 2011 at 1:35 PM, Nitin Garg 
>> wrote:
>> >>>
>> >>> Question 6 -
>> >>> Intuitively you can see that the greater the sum is, the greater the
>> favorable events in sample space.
>> >>>
>> >>> e.g. - sum = 1 .. cases {(1)} Pr = 1/6
>> >>> sum = 2 cases {(2),(1,1)} Pr = 1/6 + 1/36
>> >>> sum = 3 cases {(3),(2,1)(1,2)(1,1,1)} Pr = 1/6 + 1/36 +1/36
>> + 1/216
>> >>>
>> >>>
>> >>> for a more formal proof, look at the recursion -
>> >>>
>> >>>
>> >>> P(k) = (P(k-6) + P(k-5) + P(k-4)... P(k-1)))/6
>> >>>
>> >>> where P(0) = 1, P(i) = 0 for i<0
>> >>>
>> >>> Base case -
>> >>> P(2) > P(1)
>> >>>
>> >>> Hypothesis -
>> >>>
>> >>> P(i) > P(i-1) for all i <= k
>> >>>
>> >>> To prove
>> >>> P(k+1) > P(k)
>> >>>
>> >>> Proof
>> >>> P(k+1) - P(k) = (P(k) - P(k-6))/6 > 0
>> >>>
>> >>>
>> >>>
>> >>>
>> >>>
>> >>>
>> >>>
>> >>>
>> >>> On Mon, Sep 19, 2011 at 1:04 PM, Nitin Garg <
nitin.garg.i...@gmail.com>
>> wrote:
>> 
>>  Question 3 -
>>  To eliminate one player, you need to host atleast 2 matches and make
>> him loose in both 2. These 2 matches can not contribute to elimination of
>> any other player.
>>  So, min 2 matches for every player who is to be eliminated, hence
100.
>> 
>> 
>>  On Mon, Sep 19, 2011 at 11:54 AM, Bhanu Chowdary <
>> bhanuchowd...@gmail.com> wrote:
>> >
>> > @Nitin: Answer to question 3 is 50.
>> >
>> >
>> > On Mon, Sep 19, 2011 at 11:44 AM, praveen raj <
praveen0...@gmail.com>
>> wrote:
>> >>
>> >> @nitin Plz explain how u have reached answer of question no. 4 and
6
>> >>
>> >>
>> >> On 19-Sep-2011 12:26 AM, "Nitin Garg" 
>> wrote:
>> >> >
>> >> > Answer 3 - 100
>> >> > Answer 6 - 103
>> >> > Answer 4 - 194 total processes including the parent
>> >> > Answer 7 - 12 km south, 12 km east
>> >> >
>> >> >
>> >> > On Sun, Sep 18, 2011 at 11:53 PM, Ashima . <
ashima.b...@gmail.com>
>> wrote:
>> >> >>
>> >> >> @malay: how cm n+logn-2?
>> >> >> cn u explain the logic ?
>> >> >>
>> >> >> Ashima
>> >> >> M.Sc.(Tech)Information Systems
>> >> >> 4th year
>> >> >> BITS Pilani
>> >> >> Rajasthan
>> >> >>
>> >> >>
>> >> >>
>> >> >>
>> >> >> On Sun, Sep 18, 2011 at 11:07 AM, Ashima . <
>> ashima.b...@gmail.com> wrote:
>> >> >>>
>> >> >>> rite! 62.5%
>> >> >>>
>> >> >>> Ashima
>> >> >>> M.Sc.(Tech)Information Systems
>> >> >>> 4th year
>> >> >>> BITS Pilani
>> >> >>> Rajasthan
>> >> >>>
>> >> >>>
>> >> >>>
>> >> >>>
>> >> >>> On Sat, Sep 17, 2011 at 9:04 PM, malay chakrabarti <
>> m1234...@gmail.com> wrote:
>> >> 
>> >>  create a tournament tree.in each round one value is
eliminated
>> to obtain in the process the winner or the highest value in n-1
comparisons.
>> Then check the queue of the winner which contains log(n) entries of the
>> values beaten by the winner which implicitly will contain the runners
>> up.Then log(n)-1 comparisons to find the highest among all the losers
whom
>> the winner had beaten. So all over complexity will be n-1 +log(n) -1 =
>> n+log(n)-2. Hp that answers ur query. nice question btw :)
>> >> 
>> >> 
>> >>  On Sun, Sep 18, 2011 at 8:02 AM, VIHARRI <
>> viharri@gmail.com> wrote:
>> >> >
>> >> > hey i'm also thinking n + logn -2.. but couldnt able to
figure
>> out
>> >> > how??? can you please explain the logic
>> >> >
>> >> > --
>> >> > 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/a

Re: [algogeeks] Re: Directi Questions - needed answers

2011-09-19 Thread Bhanu Chowdary
@Nithin: Sorry I did not understand your logic!! If a person looses a match
he should be knocked out of the tournament. Could you please explain why 2
matches to knock out a person??

On Mon, Sep 19, 2011 at 2:47 PM, praveen raj  wrote:

> For question 2 see ashima link.
>
> On 19-Sep-2011 1:43 PM, "Nitin Garg"  wrote:
> >
> > Can someone tell answers to question 2 and 5 with explanation??
> >
> >
> >
> >
> > On Mon, Sep 19, 2011 at 1:40 PM, Nitin Garg 
> wrote:
> >>
> >> In Question 4 i just kept counting new processes that are being added in
> every iteration.
> >> No. of new processes being created is equal to the already running no.
> of even pid processes.
> >>
> >> Time - PId
> >> 0  - 0  1
> >> 1 - 0,12
> >> 2, - 0,1,23
> >> 3, - 0,1,2,3,4  5
> >> 4 - 0,1,2,3,4,5,6,7   8
> >> .
> >> .
> >> .
> >>
> >>
> >>
> >> 1,2,3,5,8,11,17,25,38,57,86,129,194
> >>
> >> I kept counting, got 194.
> >> Don't know of any shortcut.
> >>
> >>
> >>
> >>
> >>
> >> On Mon, Sep 19, 2011 at 1:35 PM, Nitin Garg 
> wrote:
> >>>
> >>> Question 6 -
> >>> Intuitively you can see that the greater the sum is, the greater the
> favorable events in sample space.
> >>>
> >>> e.g. - sum = 1 .. cases {(1)}   Pr = 1/6
> >>> sum = 2 cases {(2),(1,1)}   Pr = 1/6 + 1/36
> >>> sum = 3cases {(3),(2,1)(1,2)(1,1,1)}  Pr = 1/6 + 1/36 +1/36
> + 1/216
> >>>
> >>>
> >>> for a more formal proof, look at the recursion -
> >>>
> >>>
> >>> P(k) = (P(k-6) + P(k-5) + P(k-4)... P(k-1)))/6
> >>>
> >>> where P(0) = 1, P(i) = 0  for i<0
> >>>
> >>> Base case -
> >>> P(2) > P(1)
> >>>
> >>> Hypothesis -
> >>>
> >>> P(i) > P(i-1) for  all i <= k
> >>>
> >>> To prove
> >>> P(k+1)  > P(k)
> >>>
> >>> Proof
> >>> P(k+1) - P(k) = (P(k) - P(k-6))/6 > 0
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>> On Mon, Sep 19, 2011 at 1:04 PM, Nitin Garg 
> wrote:
> 
>  Question 3 -
>  To eliminate one player, you need to host atleast 2 matches and make
> him loose in both 2. These 2 matches can not contribute to elimination of
> any other player.
>  So, min 2 matches for every player who is to be eliminated, hence 100.
> 
> 
>  On Mon, Sep 19, 2011 at 11:54 AM, Bhanu Chowdary <
> bhanuchowd...@gmail.com> wrote:
> >
> > @Nitin: Answer to question 3 is 50.
> >
> >
> > On Mon, Sep 19, 2011 at 11:44 AM, praveen raj 
> wrote:
> >>
> >> @nitin Plz explain how u have reached answer of question no. 4 and 6
> >>
> >>
> >> On 19-Sep-2011 12:26 AM, "Nitin Garg" 
> wrote:
> >> >
> >> > Answer  3 - 100
> >> > Answer 6 - 103
> >> > Answer 4 - 194 total processes including the parent
> >> > Answer 7 - 12 km south, 12 km east
> >> >
> >> >
> >> > On Sun, Sep 18, 2011 at 11:53 PM, Ashima . 
> wrote:
> >> >>
> >> >> @malay: how cm n+logn-2?
> >> >> cn u explain the logic ?
> >> >>
> >> >> Ashima
> >> >> M.Sc.(Tech)Information Systems
> >> >> 4th year
> >> >> BITS Pilani
> >> >> Rajasthan
> >> >>
> >> >>
> >> >>
> >> >>
> >> >> On Sun, Sep 18, 2011 at 11:07 AM, Ashima . <
> ashima.b...@gmail.com> wrote:
> >> >>>
> >> >>> rite! 62.5%
> >> >>>
> >> >>> Ashima
> >> >>> M.Sc.(Tech)Information Systems
> >> >>> 4th year
> >> >>> BITS Pilani
> >> >>> Rajasthan
> >> >>>
> >> >>>
> >> >>>
> >> >>>
> >> >>> On Sat, Sep 17, 2011 at 9:04 PM, malay chakrabarti <
> m1234...@gmail.com> wrote:
> >> 
> >>  create a tournament tree.in each round one value is eliminated
> to obtain in the process the winner or the highest value in n-1 comparisons.
> Then check the queue of the winner which contains log(n) entries of the
> values beaten by the winner which implicitly will contain the runners
> up.Then log(n)-1 comparisons to find the highest among all the losers whom
> the winner had beaten. So all over complexity will be n-1 +log(n) -1 =
> n+log(n)-2. Hp that answers ur query. nice question btw :)
> >> 
> >> 
> >>  On Sun, Sep 18, 2011 at 8:02 AM, VIHARRI <
> viharri@gmail.com> wrote:
> >> >
> >> > hey i'm also thinking n + logn -2.. but couldnt able to figure
> out
> >> > how??? can you please explain the logic
> >> >
> >> > --
> >> > 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 

Re: [algogeeks] Re: Directi Questions - needed answers

2011-09-19 Thread praveen raj
For question 2 see ashima link.
On 19-Sep-2011 1:43 PM, "Nitin Garg"  wrote:
>
> Can someone tell answers to question 2 and 5 with explanation??
>
>
>
>
> On Mon, Sep 19, 2011 at 1:40 PM, Nitin Garg 
wrote:
>>
>> In Question 4 i just kept counting new processes that are being added in
every iteration.
>> No. of new processes being created is equal to the already running no. of
even pid processes.
>>
>> Time - PId
>> 0  - 0  1
>> 1 - 0,12
>> 2, - 0,1,23
>> 3, - 0,1,2,3,4  5
>> 4 - 0,1,2,3,4,5,6,7   8
>> .
>> .
>> .
>>
>>
>>
>> 1,2,3,5,8,11,17,25,38,57,86,129,194
>>
>> I kept counting, got 194.
>> Don't know of any shortcut.
>>
>>
>>
>>
>>
>> On Mon, Sep 19, 2011 at 1:35 PM, Nitin Garg 
wrote:
>>>
>>> Question 6 -
>>> Intuitively you can see that the greater the sum is, the greater the
favorable events in sample space.
>>>
>>> e.g. - sum = 1 .. cases {(1)}   Pr = 1/6
>>> sum = 2 cases {(2),(1,1)}   Pr = 1/6 + 1/36
>>> sum = 3cases {(3),(2,1)(1,2)(1,1,1)}  Pr = 1/6 + 1/36 +1/36
+ 1/216
>>>
>>>
>>> for a more formal proof, look at the recursion -
>>>
>>>
>>> P(k) = (P(k-6) + P(k-5) + P(k-4)... P(k-1)))/6
>>>
>>> where P(0) = 1, P(i) = 0  for i<0
>>>
>>> Base case -
>>> P(2) > P(1)
>>>
>>> Hypothesis -
>>>
>>> P(i) > P(i-1) for  all i <= k
>>>
>>> To prove
>>> P(k+1)  > P(k)
>>>
>>> Proof
>>> P(k+1) - P(k) = (P(k) - P(k-6))/6 > 0
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> On Mon, Sep 19, 2011 at 1:04 PM, Nitin Garg 
wrote:

 Question 3 -
 To eliminate one player, you need to host atleast 2 matches and make
him loose in both 2. These 2 matches can not contribute to elimination of
any other player.
 So, min 2 matches for every player who is to be eliminated, hence 100.


 On Mon, Sep 19, 2011 at 11:54 AM, Bhanu Chowdary <
bhanuchowd...@gmail.com> wrote:
>
> @Nitin: Answer to question 3 is 50.
>
>
> On Mon, Sep 19, 2011 at 11:44 AM, praveen raj 
wrote:
>>
>> @nitin Plz explain how u have reached answer of question no. 4 and 6
>>
>>
>> On 19-Sep-2011 12:26 AM, "Nitin Garg" 
wrote:
>> >
>> > Answer  3 - 100
>> > Answer 6 - 103
>> > Answer 4 - 194 total processes including the parent
>> > Answer 7 - 12 km south, 12 km east
>> >
>> >
>> > On Sun, Sep 18, 2011 at 11:53 PM, Ashima . 
wrote:
>> >>
>> >> @malay: how cm n+logn-2?
>> >> cn u explain the logic ?
>> >>
>> >> Ashima
>> >> M.Sc.(Tech)Information Systems
>> >> 4th year
>> >> BITS Pilani
>> >> Rajasthan
>> >>
>> >>
>> >>
>> >>
>> >> On Sun, Sep 18, 2011 at 11:07 AM, Ashima . 
wrote:
>> >>>
>> >>> rite! 62.5%
>> >>>
>> >>> Ashima
>> >>> M.Sc.(Tech)Information Systems
>> >>> 4th year
>> >>> BITS Pilani
>> >>> Rajasthan
>> >>>
>> >>>
>> >>>
>> >>>
>> >>> On Sat, Sep 17, 2011 at 9:04 PM, malay chakrabarti <
m1234...@gmail.com> wrote:
>> 
>>  create a tournament tree.in each round one value is eliminated
to obtain in the process the winner or the highest value in n-1 comparisons.
Then check the queue of the winner which contains log(n) entries of the
values beaten by the winner which implicitly will contain the runners
up.Then log(n)-1 comparisons to find the highest among all the losers whom
the winner had beaten. So all over complexity will be n-1 +log(n) -1 =
n+log(n)-2. Hp that answers ur query. nice question btw :)
>> 
>> 
>>  On Sun, Sep 18, 2011 at 8:02 AM, VIHARRI 
wrote:
>> >
>> > hey i'm also thinking n + logn -2.. but couldnt able to figure
out
>> > how??? can you please explain the logic
>> >
>> > --
>> > 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://grou

Re: [algogeeks] Re: Directi Questions - needed answers

2011-09-19 Thread sagar pareek
@VIHARRI
i think q.5 is *Which is not thread safe ??* :D :D

On Mon, Sep 19, 2011 at 1:43 PM, Nitin Garg wrote:

> Can someone tell answers to question 2 and 5 with explanation??
>
>
>
>
> On Mon, Sep 19, 2011 at 1:40 PM, Nitin Garg wrote:
>
>> In Question 4 i just kept counting new processes that are being added in
>> every iteration.
>> No. of new processes being created is equal to the already running no. of
>> even pid processes.
>>
>> Time - PId
>> 0  - 0  1
>> 1 - 0,12
>> 2, - 0,1,23
>> 3, - 0,1,2,3,4  5
>> 4 - 0,1,2,3,4,5,6,7   8
>> .
>> .
>> .
>>
>>
>>
>> 1,2,3,5,8,11,17,25,38,57,86,129,194
>>
>> I kept counting, got 194.
>> Don't know of any shortcut.
>>
>>
>>
>>
>>
>> On Mon, Sep 19, 2011 at 1:35 PM, Nitin Garg wrote:
>>
>>> Question 6 -
>>> Intuitively you can see that the greater the sum is, the greater the
>>> favorable events in sample space.
>>>
>>> e.g. - sum = 1 .. cases {(1)}   Pr = 1/6
>>> sum = 2 cases {(2),(1,1)}   Pr = 1/6 + 1/36
>>> sum = 3cases {(3),(2,1)(1,2)(1,1,1)}  Pr = 1/6 + 1/36 +1/36 +
>>> 1/216
>>>
>>>
>>> for a more formal proof, look at the recursion -
>>>
>>>
>>> P(k) = (P(k-6) + P(k-5) + P(k-4)... P(k-1)))/6
>>>
>>> where P(0) = 1, P(i) = 0  for i<0
>>>
>>> Base case -
>>> P(2) > P(1)
>>>
>>> Hypothesis -
>>>
>>> P(i) > P(i-1) for  all i <= k
>>>
>>> To prove
>>> P(k+1)  > P(k)
>>>
>>> Proof
>>> P(k+1) - P(k) = (P(k) - P(k-6))/6 > 0
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> On Mon, Sep 19, 2011 at 1:04 PM, Nitin Garg 
>>> wrote:
>>>
 Question 3 -
 To eliminate one player, you need to host atleast 2 matches and make him
 loose in both 2. These 2 matches can not contribute to elimination of any
 other player.
 So, min 2 matches for every player who is to be eliminated, hence 100.


 On Mon, Sep 19, 2011 at 11:54 AM, Bhanu Chowdary <
 bhanuchowd...@gmail.com> wrote:

> @Nitin: Answer to question 3 is 50.
>
>
> On Mon, Sep 19, 2011 at 11:44 AM, praveen raj 
> wrote:
>
>> @nitin Plz explain how u have reached answer of question no. 4 and 6
>>
>> On 19-Sep-2011 12:26 AM, "Nitin Garg" 
>> wrote:
>> >
>> > Answer  3 - 100
>> > Answer 6 - 103
>> > Answer 4 - 194 total processes including the parent
>> > Answer 7 - 12 km south, 12 km east
>> >
>> >
>> > On Sun, Sep 18, 2011 at 11:53 PM, Ashima . 
>> wrote:
>> >>
>> >> @malay: how cm n+logn-2?
>> >> cn u explain the logic ?
>> >>
>> >> Ashima
>> >> M.Sc.(Tech)Information Systems
>> >> 4th year
>> >> BITS Pilani
>> >> Rajasthan
>> >>
>> >>
>> >>
>> >>
>> >> On Sun, Sep 18, 2011 at 11:07 AM, Ashima . 
>> wrote:
>> >>>
>> >>> rite! 62.5%
>> >>>
>> >>> Ashima
>> >>> M.Sc.(Tech)Information Systems
>> >>> 4th year
>> >>> BITS Pilani
>> >>> Rajasthan
>> >>>
>> >>>
>> >>>
>> >>>
>> >>> On Sat, Sep 17, 2011 at 9:04 PM, malay chakrabarti <
>> m1234...@gmail.com> wrote:
>> 
>>  create a tournament tree.in each round one value is eliminated
>> to obtain in the process the winner or the highest value in n-1 
>> comparisons.
>> Then check the queue of the winner which contains log(n) entries of the
>> values beaten by the winner which implicitly will contain the runners
>> up.Then log(n)-1 comparisons to find the highest among all the losers 
>> whom
>> the winner had beaten. So all over complexity will be n-1 +log(n) -1 =
>> n+log(n)-2. Hp that answers ur query. nice question btw :)
>> 
>> 
>>  On Sun, Sep 18, 2011 at 8:02 AM, VIHARRI 
>> wrote:
>> >
>> > hey i'm also thinking n + logn -2.. but couldnt able to figure
>> out
>> > how??? can you please explain the logic
>> >
>> > --
>> > 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 po

Re: [algogeeks] Re: Directi Questions - needed answers

2011-09-19 Thread Nitin Garg
Can someone tell answers to question 2 and 5 with explanation??




On Mon, Sep 19, 2011 at 1:40 PM, Nitin Garg wrote:

> In Question 4 i just kept counting new processes that are being added in
> every iteration.
> No. of new processes being created is equal to the already running no. of
> even pid processes.
>
> Time - PId
> 0  - 0  1
> 1 - 0,12
> 2, - 0,1,23
> 3, - 0,1,2,3,4  5
> 4 - 0,1,2,3,4,5,6,7   8
> .
> .
> .
>
>
>
> 1,2,3,5,8,11,17,25,38,57,86,129,194
>
> I kept counting, got 194.
> Don't know of any shortcut.
>
>
>
>
>
> On Mon, Sep 19, 2011 at 1:35 PM, Nitin Garg wrote:
>
>> Question 6 -
>> Intuitively you can see that the greater the sum is, the greater the
>> favorable events in sample space.
>>
>> e.g. - sum = 1 .. cases {(1)}   Pr = 1/6
>> sum = 2 cases {(2),(1,1)}   Pr = 1/6 + 1/36
>> sum = 3cases {(3),(2,1)(1,2)(1,1,1)}  Pr = 1/6 + 1/36 +1/36 +
>> 1/216
>>
>>
>> for a more formal proof, look at the recursion -
>>
>>
>> P(k) = (P(k-6) + P(k-5) + P(k-4)... P(k-1)))/6
>>
>> where P(0) = 1, P(i) = 0  for i<0
>>
>> Base case -
>> P(2) > P(1)
>>
>> Hypothesis -
>>
>> P(i) > P(i-1) for  all i <= k
>>
>> To prove
>> P(k+1)  > P(k)
>>
>> Proof
>> P(k+1) - P(k) = (P(k) - P(k-6))/6 > 0
>>
>>
>>
>>
>>
>>
>>
>>
>> On Mon, Sep 19, 2011 at 1:04 PM, Nitin Garg wrote:
>>
>>> Question 3 -
>>> To eliminate one player, you need to host atleast 2 matches and make him
>>> loose in both 2. These 2 matches can not contribute to elimination of any
>>> other player.
>>> So, min 2 matches for every player who is to be eliminated, hence 100.
>>>
>>>
>>> On Mon, Sep 19, 2011 at 11:54 AM, Bhanu Chowdary <
>>> bhanuchowd...@gmail.com> wrote:
>>>
 @Nitin: Answer to question 3 is 50.


 On Mon, Sep 19, 2011 at 11:44 AM, praveen raj wrote:

> @nitin Plz explain how u have reached answer of question no. 4 and 6
>
> On 19-Sep-2011 12:26 AM, "Nitin Garg" 
> wrote:
> >
> > Answer  3 - 100
> > Answer 6 - 103
> > Answer 4 - 194 total processes including the parent
> > Answer 7 - 12 km south, 12 km east
> >
> >
> > On Sun, Sep 18, 2011 at 11:53 PM, Ashima . 
> wrote:
> >>
> >> @malay: how cm n+logn-2?
> >> cn u explain the logic ?
> >>
> >> Ashima
> >> M.Sc.(Tech)Information Systems
> >> 4th year
> >> BITS Pilani
> >> Rajasthan
> >>
> >>
> >>
> >>
> >> On Sun, Sep 18, 2011 at 11:07 AM, Ashima . 
> wrote:
> >>>
> >>> rite! 62.5%
> >>>
> >>> Ashima
> >>> M.Sc.(Tech)Information Systems
> >>> 4th year
> >>> BITS Pilani
> >>> Rajasthan
> >>>
> >>>
> >>>
> >>>
> >>> On Sat, Sep 17, 2011 at 9:04 PM, malay chakrabarti <
> m1234...@gmail.com> wrote:
> 
>  create a tournament tree.in each round one value is eliminated to
> obtain in the process the winner or the highest value in n-1 comparisons.
> Then check the queue of the winner which contains log(n) entries of the
> values beaten by the winner which implicitly will contain the runners
> up.Then log(n)-1 comparisons to find the highest among all the losers whom
> the winner had beaten. So all over complexity will be n-1 +log(n) -1 =
> n+log(n)-2. Hp that answers ur query. nice question btw :)
> 
> 
>  On Sun, Sep 18, 2011 at 8:02 AM, VIHARRI 
> wrote:
> >
> > hey i'm also thinking n + logn -2.. but couldnt able to figure
> out
> > how??? can you please explain the logic
> >
> > --
> > 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.
> >
> >
> >
> >
> > --
> > Nitin Garg

Re: [algogeeks] Re: Directi Questions - needed answers

2011-09-19 Thread Nitin Garg
In Question 4 i just kept counting new processes that are being added in
every iteration.
No. of new processes being created is equal to the already running no. of
even pid processes.

Time - PId
0  - 0  1
1 - 0,12
2, - 0,1,23
3, - 0,1,2,3,4  5
4 - 0,1,2,3,4,5,6,7   8
.
.
.



1,2,3,5,8,11,17,25,38,57,86,129,194

I kept counting, got 194.
Don't know of any shortcut.





On Mon, Sep 19, 2011 at 1:35 PM, Nitin Garg wrote:

> Question 6 -
> Intuitively you can see that the greater the sum is, the greater the
> favorable events in sample space.
>
> e.g. - sum = 1 .. cases {(1)}   Pr = 1/6
> sum = 2 cases {(2),(1,1)}   Pr = 1/6 + 1/36
> sum = 3cases {(3),(2,1)(1,2)(1,1,1)}  Pr = 1/6 + 1/36 +1/36 +
> 1/216
>
>
> for a more formal proof, look at the recursion -
>
>
> P(k) = (P(k-6) + P(k-5) + P(k-4)... P(k-1)))/6
>
> where P(0) = 1, P(i) = 0  for i<0
>
> Base case -
> P(2) > P(1)
>
> Hypothesis -
>
> P(i) > P(i-1) for  all i <= k
>
> To prove
> P(k+1)  > P(k)
>
> Proof
> P(k+1) - P(k) = (P(k) - P(k-6))/6 > 0
>
>
>
>
>
>
>
>
> On Mon, Sep 19, 2011 at 1:04 PM, Nitin Garg wrote:
>
>> Question 3 -
>> To eliminate one player, you need to host atleast 2 matches and make him
>> loose in both 2. These 2 matches can not contribute to elimination of any
>> other player.
>> So, min 2 matches for every player who is to be eliminated, hence 100.
>>
>>
>> On Mon, Sep 19, 2011 at 11:54 AM, Bhanu Chowdary > > wrote:
>>
>>> @Nitin: Answer to question 3 is 50.
>>>
>>>
>>> On Mon, Sep 19, 2011 at 11:44 AM, praveen raj wrote:
>>>
 @nitin Plz explain how u have reached answer of question no. 4 and 6

 On 19-Sep-2011 12:26 AM, "Nitin Garg" 
 wrote:
 >
 > Answer  3 - 100
 > Answer 6 - 103
 > Answer 4 - 194 total processes including the parent
 > Answer 7 - 12 km south, 12 km east
 >
 >
 > On Sun, Sep 18, 2011 at 11:53 PM, Ashima . 
 wrote:
 >>
 >> @malay: how cm n+logn-2?
 >> cn u explain the logic ?
 >>
 >> Ashima
 >> M.Sc.(Tech)Information Systems
 >> 4th year
 >> BITS Pilani
 >> Rajasthan
 >>
 >>
 >>
 >>
 >> On Sun, Sep 18, 2011 at 11:07 AM, Ashima . 
 wrote:
 >>>
 >>> rite! 62.5%
 >>>
 >>> Ashima
 >>> M.Sc.(Tech)Information Systems
 >>> 4th year
 >>> BITS Pilani
 >>> Rajasthan
 >>>
 >>>
 >>>
 >>>
 >>> On Sat, Sep 17, 2011 at 9:04 PM, malay chakrabarti <
 m1234...@gmail.com> wrote:
 
  create a tournament tree.in each round one value is eliminated to
 obtain in the process the winner or the highest value in n-1 comparisons.
 Then check the queue of the winner which contains log(n) entries of the
 values beaten by the winner which implicitly will contain the runners
 up.Then log(n)-1 comparisons to find the highest among all the losers whom
 the winner had beaten. So all over complexity will be n-1 +log(n) -1 =
 n+log(n)-2. Hp that answers ur query. nice question btw :)
 
 
  On Sun, Sep 18, 2011 at 8:02 AM, VIHARRI 
 wrote:
 >
 > hey i'm also thinking n + logn -2.. but couldnt able to figure out
 > how??? can you please explain the logic
 >
 > --
 > 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.
 >
 >
 >
 >
 > --
 > Nitin Garg
 >
 > "Personality can open doors... but only Character can keep them open"
 >
 > --
 > 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
 al

Re: [algogeeks] Re: Directi Questions - needed answers

2011-09-19 Thread Nitin Garg
Question 6 -
Intuitively you can see that the greater the sum is, the greater the
favorable events in sample space.

e.g. - sum = 1 .. cases {(1)}   Pr = 1/6
sum = 2 cases {(2),(1,1)}   Pr = 1/6 + 1/36
sum = 3cases {(3),(2,1)(1,2)(1,1,1)}  Pr = 1/6 + 1/36 +1/36 +
1/216


for a more formal proof, look at the recursion -


P(k) = (P(k-6) + P(k-5) + P(k-4)... P(k-1)))/6

where P(0) = 1, P(i) = 0  for i<0

Base case -
P(2) > P(1)

Hypothesis -

P(i) > P(i-1) for  all i <= k

To prove
P(k+1)  > P(k)

Proof
P(k+1) - P(k) = (P(k) - P(k-6))/6 > 0








On Mon, Sep 19, 2011 at 1:04 PM, Nitin Garg wrote:

> Question 3 -
> To eliminate one player, you need to host atleast 2 matches and make him
> loose in both 2. These 2 matches can not contribute to elimination of any
> other player.
> So, min 2 matches for every player who is to be eliminated, hence 100.
>
>
> On Mon, Sep 19, 2011 at 11:54 AM, Bhanu Chowdary 
> wrote:
>
>> @Nitin: Answer to question 3 is 50.
>>
>>
>> On Mon, Sep 19, 2011 at 11:44 AM, praveen raj wrote:
>>
>>> @nitin Plz explain how u have reached answer of question no. 4 and 6
>>>
>>> On 19-Sep-2011 12:26 AM, "Nitin Garg"  wrote:
>>> >
>>> > Answer  3 - 100
>>> > Answer 6 - 103
>>> > Answer 4 - 194 total processes including the parent
>>> > Answer 7 - 12 km south, 12 km east
>>> >
>>> >
>>> > On Sun, Sep 18, 2011 at 11:53 PM, Ashima . 
>>> wrote:
>>> >>
>>> >> @malay: how cm n+logn-2?
>>> >> cn u explain the logic ?
>>> >>
>>> >> Ashima
>>> >> M.Sc.(Tech)Information Systems
>>> >> 4th year
>>> >> BITS Pilani
>>> >> Rajasthan
>>> >>
>>> >>
>>> >>
>>> >>
>>> >> On Sun, Sep 18, 2011 at 11:07 AM, Ashima . 
>>> wrote:
>>> >>>
>>> >>> rite! 62.5%
>>> >>>
>>> >>> Ashima
>>> >>> M.Sc.(Tech)Information Systems
>>> >>> 4th year
>>> >>> BITS Pilani
>>> >>> Rajasthan
>>> >>>
>>> >>>
>>> >>>
>>> >>>
>>> >>> On Sat, Sep 17, 2011 at 9:04 PM, malay chakrabarti <
>>> m1234...@gmail.com> wrote:
>>> 
>>>  create a tournament tree.in each round one value is eliminated to
>>> obtain in the process the winner or the highest value in n-1 comparisons.
>>> Then check the queue of the winner which contains log(n) entries of the
>>> values beaten by the winner which implicitly will contain the runners
>>> up.Then log(n)-1 comparisons to find the highest among all the losers whom
>>> the winner had beaten. So all over complexity will be n-1 +log(n) -1 =
>>> n+log(n)-2. Hp that answers ur query. nice question btw :)
>>> 
>>> 
>>>  On Sun, Sep 18, 2011 at 8:02 AM, VIHARRI 
>>> wrote:
>>> >
>>> > hey i'm also thinking n + logn -2.. but couldnt able to figure out
>>> > how??? can you please explain the logic
>>> >
>>> > --
>>> > 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.
>>> >
>>> >
>>> >
>>> >
>>> > --
>>> > Nitin Garg
>>> >
>>> > "Personality can open doors... but only Character can keep them open"
>>> >
>>> > --
>>> > 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.
>>>
>>
>>
>>
>> --
>> Bhanu Chowdary
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, se

Re: [algogeeks] c output

2011-09-19 Thread sukran dhawan
common guys its undefined acc to standard c 

On Mon, Sep 19, 2011 at 12:36 PM, Siddhartha Banerjee <
thefourrup...@gmail.com> wrote:

> on running,every time i get  second a=30... any reasons for that???
>
>  --
> 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] Re: Directi Questions - needed answers

2011-09-19 Thread Nitin Garg
Question 3 -
To eliminate one player, you need to host atleast 2 matches and make him
loose in both 2. These 2 matches can not contribute to elimination of any
other player.
So, min 2 matches for every player who is to be eliminated, hence 100.


On Mon, Sep 19, 2011 at 11:54 AM, Bhanu Chowdary wrote:

> @Nitin: Answer to question 3 is 50.
>
>
> On Mon, Sep 19, 2011 at 11:44 AM, praveen raj wrote:
>
>> @nitin Plz explain how u have reached answer of question no. 4 and 6
>>
>> On 19-Sep-2011 12:26 AM, "Nitin Garg"  wrote:
>> >
>> > Answer  3 - 100
>> > Answer 6 - 103
>> > Answer 4 - 194 total processes including the parent
>> > Answer 7 - 12 km south, 12 km east
>> >
>> >
>> > On Sun, Sep 18, 2011 at 11:53 PM, Ashima . 
>> wrote:
>> >>
>> >> @malay: how cm n+logn-2?
>> >> cn u explain the logic ?
>> >>
>> >> Ashima
>> >> M.Sc.(Tech)Information Systems
>> >> 4th year
>> >> BITS Pilani
>> >> Rajasthan
>> >>
>> >>
>> >>
>> >>
>> >> On Sun, Sep 18, 2011 at 11:07 AM, Ashima . 
>> wrote:
>> >>>
>> >>> rite! 62.5%
>> >>>
>> >>> Ashima
>> >>> M.Sc.(Tech)Information Systems
>> >>> 4th year
>> >>> BITS Pilani
>> >>> Rajasthan
>> >>>
>> >>>
>> >>>
>> >>>
>> >>> On Sat, Sep 17, 2011 at 9:04 PM, malay chakrabarti <
>> m1234...@gmail.com> wrote:
>> 
>>  create a tournament tree.in each round one value is eliminated to
>> obtain in the process the winner or the highest value in n-1 comparisons.
>> Then check the queue of the winner which contains log(n) entries of the
>> values beaten by the winner which implicitly will contain the runners
>> up.Then log(n)-1 comparisons to find the highest among all the losers whom
>> the winner had beaten. So all over complexity will be n-1 +log(n) -1 =
>> n+log(n)-2. Hp that answers ur query. nice question btw :)
>> 
>> 
>>  On Sun, Sep 18, 2011 at 8:02 AM, VIHARRI 
>> wrote:
>> >
>> > hey i'm also thinking n + logn -2.. but couldnt able to figure out
>> > how??? can you please explain the logic
>> >
>> > --
>> > 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.
>> >
>> >
>> >
>> >
>> > --
>> > Nitin Garg
>> >
>> > "Personality can open doors... but only Character can keep them open"
>> >
>> > --
>> > 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.
>>
>
>
>
> --
> Bhanu Chowdary
>
> --
> 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.
>



-- 
Nitin Garg

"Personality can open doors... but only Character can keep them open"

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

2011-09-19 Thread Siddhartha Banerjee
on running,every time i get  second a=30... any reasons for that???

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