[algogeeks] Building a Binary tree with XOR

2011-04-19 Thread sunil
Hi All,

Before starting any binary tree problem I will be creating such kind
of binary tree and will be solving that problem accordingly.

>From the last few days I am trying to code to build a binary tree with
"Exclusive Operators". Here I am trying to build the tree in the level
order way like all the elements will be placed in the queue in the
order of levels so that the final binary tree will be almost complete
binary tree.

In general the left node will contain the left side tree adress
details and right node will contain the right tree details.
But the XOR Binary trees will be holding the XOR values of parent and
left child in the left node and in the same way the parent and right
child will be in the right part.

Here I am unable to track the "parent" of a particular node after the
level 3. Does it possible to create a XOR binary tree with the level
order mechanism. If possible, could you provide me clues in resolving
this problem.

My files looks like as below

Header file:

#include
#include
using namespace std;
typedef unsigned long pointer;

struct BTXNode
{
   int data;
   struct BTXNode* fleft;
   struct BTXNode* fright;
};

class BTX
{

   struct BTXNode *root;

   public:
   BTX()
   {
   root=NULL;
   }
   struct BTXNode* getNode(int data);
   int insertAtLeaf(struct BTXNode* node);

};
--

CPP file
---
#include "btf_xor.h"

struct BTXNode* BTX::getNode(int data)
{
   struct BTXNode* node=new BTXNode();

   node->data=data;
   node->fleft=NULL;
   node->fright=NULL;

   return node;
}

int BTX::insertAtLeaf(struct BTXNode* nd)
{
   cout<<"insertAtLeaf"<<" Data is "data is"fleft^(pointer)parent);
   q.push(left);
   right_ind=true;
   }
   else
   {
   nd->fleft=(struct BTXNode*)
((pointer)temp ^ (pointer)nd->fleft);
   nd->fright=(struct BTXNode*)
((pointer)temp ^ (pointer)nd->fright);
   //temp->fleft=(struct BTXNode*)
((pointer)nd ^ (pointer)parent);
   temp->fleft=(struct BTXNode*)
((pointer)nd ^ (pointer)temp->fleft);
   right_ind=false;
   set_ind=false;

   }
   if(right_ind)
   {
   if(temp->fright != parent)
   {
struct BTXNode* right=(struct
BTXNode*)((pointer)temp-
>fright^(pointer)parent);
q.push(right);
right_ind=true;
   }
   else
   {
 nd->fright=(struct BTXNode*)
((pointer)temp ^
(pointer)nd->fright);
 nd->fleft=(struct BTXNode*)
((pointer)temp ^ (pointer)nd-
>fleft);
 //temp->fright=(struct BTXNode*)
((pointer)nd ^
(pointer)parent);
 temp->fright=(struct BTXNode*)
((pointer)nd ^ (pointer)temp-
>fright);
 set_ind=false;
   }
   }
   parent=temp;
   }
   else
   {
   if(!q.empty())
   {
   q.push(NULL);
   }

   }
   }
}





int main()
{
   BTX btx;
   btx.insertAtLeaf(btx.getNode(10) );
   btx.insertAtLeaf(btx.getNode(8));
   btx.insertAtLeaf(btx.getNode(12));
   btx.insertAtLeaf(btx.getNode(7));
   btx.insertAtLeaf(btx.getNode(9));
   btx.insertAtLeaf(btx.getNode(11));
   btx.insertAtLeaf(btx.getNode(13));

   return 0;

}


Regards
Sunil


-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] If anyone have this book please mail me Thanks in advance

2011-04-19 Thread kamlesh yadav
to D N vishwakarma

please send me that book .

On Wed, Apr 20, 2011 at 7:22 AM, D.N.Vishwakarma@IITR  wrote:
> I've already got But thanks for your link
>
> On Wed, Apr 20, 2011 at 5:32 AM, DIPANKAR DUTTA 
> wrote:
>>
>> plz chk the folowing link..
>>
>> www.mediafire.com/?692caj1v154c5kc
>>
>> On Tue, Apr 19, 2011 at 11:05 PM, D.N.Vishwakarma@IITR 
>> wrote:
>>>
>>> "Cracking the Coding Interview"
>>>
>>> by Gayle Laakmann
>>>
>>> --
>>> With Regards
>>> Deoki Nandan Vishwakarma
>>> IITR MCA
>>> Mathematics Department
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "Algorithm Geeks" group.
>>> To post to this group, send email to algogeeks@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> algogeeks+unsubscr...@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>
>>
>>
>> --
>> Thanks and Regards,
>> --
>> DIPANKAR DUTTA
>> Visiting Research Scholar
>> Dept of Computing,
>> Macquarie University, Sydney, Australia
>> ph.no-+61 416381145
>> email: dipankar.du...@mq.edu.au
>> ---
>> M-TECH,Computer Science & Engg.
>> E&C Dept,IIT ROORKEE
>> Uttarakhand , India – 247667
>> ---
>> website:http://people.iitr.ernet.in/shp/09535009/Website/index.html
>> ph no-09045809987
>> Lab: 286454
>> email:dipan...@iitr.ernet.in
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from 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
> IITR MCA
> Mathematics Department
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
Kamlesh Kumar Yadav
MCA  Department of Computer Science
Delhi University

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] Reading Huge input from the terminal in least time.

2011-04-19 Thread abhijith reddy
You could read input character by character using getchar_unlocked() untill
you hit a space or new line or EOF.
Alternatively you read the whole input at once using fread_unlocked() and
then process it as per your need.

On Wed, Apr 20, 2011 at 7:41 AM, shubham  wrote:

> Hello Geeks,
> Suppose we have a 2-d array arr[1000][1000] capable of storing 10^6
> elements in it. Input is supplied one row at a time. Then what is the
> best possible way to read this much data in the least amount of time
> as scanf() or cin takes a lot of 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] Reading Huge input from the terminal in least time.

2011-04-19 Thread shubham
Hello Geeks,
Suppose we have a 2-d array arr[1000][1000] capable of storing 10^6
elements in it. Input is supplied one row at a time. Then what is the
best possible way to read this much data in the least amount of time
as scanf() or cin takes a lot of 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] If anyone have this book please mail me Thanks in advance

2011-04-19 Thread D.N.Vishwakarma@IITR
*I've already got But thanks for your link
*
On Wed, Apr 20, 2011 at 5:32 AM, DIPANKAR DUTTA
wrote:

>
> plz chk the folowing link..
>
> www.*mediafire*.com/?692caj1v154c5kc
>
> On Tue, Apr 19, 2011 at 11:05 PM, D.N.Vishwakarma@IITR 
> wrote:
>
>> "Cracking the Coding Interview" by *Gayle 
>> Laakmann
>> *
>>
>>
>> --
>> **With Regards
>> Deoki Nandan Vishwakarma
>> IITR MCA
>> Mathematics Department*
>> *
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>
>
> --
> Thanks and Regards,
> --
> DIPANKAR DUTTA
> Visiting Research Scholar
> Dept of Computing,
> Macquarie University, Sydney, Australia
> ph.no-+61 416381145
> email: dipankar.du...@mq.edu.au
> ---
> M-TECH,Computer Science & Engg.
> E&C Dept,IIT ROORKEE
> Uttarakhand , India – 247667
> ---
> website:http://people.iitr.ernet.in/shp/09535009/Website/index.html
> ph no-09045809987
> Lab: 286454
> email:dipan...@iitr.ernet.in
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from 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
IITR MCA
Mathematics Department*
*

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] If anyone have this book please mail me Thanks in advance

2011-04-19 Thread DIPANKAR DUTTA
plz chk the folowing link..

www.*mediafire*.com/?692caj1v154c5kc

On Tue, Apr 19, 2011 at 11:05 PM, D.N.Vishwakarma@IITR wrote:

> "Cracking the Coding Interview" by *Gayle 
> Laakmann
> *
>
>
> --
> **With Regards
> Deoki Nandan Vishwakarma
> IITR MCA
> Mathematics Department*
> *
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
Thanks and Regards,
--
DIPANKAR DUTTA
Visiting Research Scholar
Dept of Computing,
Macquarie University, Sydney, Australia
ph.no-+61 416381145
email: dipankar.du...@mq.edu.au
---
M-TECH,Computer Science & Engg.
E&C Dept,IIT ROORKEE
Uttarakhand , India – 247667
---
website:http://people.iitr.ernet.in/shp/09535009/Website/index.html
ph no-09045809987
Lab: 286454
email:dipan...@iitr.ernet.in

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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: Sites for Interview Questions

2011-04-19 Thread zero_cool
http://www.ihas1337code.com/
go for this  also !

On Apr 11, 10:25 pm, abhishek jain  wrote:
> www.careercup.comhttp://www.acetheinterview.com/
>
> Thanks,
> Abhishek
>
> On Mon, Apr 11, 2011 at 3:25 PM, Akash Agrawal 
> wrote:
>
>
>
> >http://tech-queries.blogspot.com
>
> > Regards,
> > Akash Agrawal
> >http://tech-queries.blogspot.com/
>
> > On Tue, Jan 18, 2011 at 10:09 PM, rahul rai  wrote:
>
> >>http://www.ocf.berkeley.edu/~wwu/riddles/intro.shtml
> >> Rahul K Rai
> >> rahulpossi...@gmail.com
>
> >> On Tue, Jan 18, 2011 at 9:27 PM, Yellow Sapphire 
> >> wrote:
>
> >>> Hi,
>
> >>> Can someone suggest good books/websites/blogs for interview related
> >>> questions.
>
> >>> thanks--
> >>> YS
>
> >>> --
> >>> You received this message because you are subscribed to the Google Groups
> >>> "Algorithm Geeks" group.
> >>> To post to this group, send email to algogeeks@googlegroups.com.
> >>> To unsubscribe from this group, send email to
> >>> algogeeks+unsubscr...@googlegroups.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] If anyone have this book please mail me Thanks in advance

2011-04-19 Thread D.N.Vishwakarma@IITR
 "Cracking the Coding Interview" by *Gayle
Laakmann
*


-- 
**With Regards
Deoki Nandan Vishwakarma
IITR MCA
Mathematics Department*
*

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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: finding n numbers having particular sum

2011-04-19 Thread Don
Here is the program with better documentation and a fix for the case
when sum is zero.

// Number of elements to select from
const int setSize = 20;

// Unique integers to select from
int set[setSize] =
{ 5,9,1,3,4,2,6,7,11,10,13,15,19,22,25,31,33,37,39,40};

// Desired sum of subset
const int sum = 165;

// Stores the current subset
int rec[setSize];
int recCount = 0;
int subset=0;

// Find a subset of set which adds to sum
void search(int *set, int setSize, int sum)
{
// If we found a subset, print it
if ((sum == 0) && recCount)
{
printf("Subset %d: {%d", ++subset,rec[0]);
for(int i = 1; i < recCount; ++i)
printf(",%d", rec[i]);
printf("}\n");
}
else if (sum > 0)
{
// Consider elements of the set to add to the subset
for(int i = 0; i < setSize; ++i)
{
// Include set[i] in the subset
rec[recCount++] = set[i];

// Look for remaining elements which add to sum
search(set, i, sum-set[i]);

// Back out set[i] to try subsets without set[i]
--recCount;
}
}
}


int main(int argc, char* argv[])
{
search(set, setSize, sum);
printf("Found %d subsets\n", subset);
return 0;
}

On Apr 18, 11:58 pm, kamlesh yadav  wrote:
> @Don thanks,  nice one, but can u give a little bit of explanation.
>
>
>
> On Mon, Apr 18, 2011 at 10:14 PM, Don  wrote:
> > const int setSize = 20;
> > int set[setSize] =
> > { 5,9,1,3,4,2,6,7,11,10,13,15,19,22,25,31,33,37,39,40};
> > const int sum = 150;
>
> > int rec[setSize];
> > int recCount = 0;
> > int subset=0;
>
> > void search(int *set, int setSize, int sum)
> > {
> >        int i;
> >        if (sum == 0)
> >        {
> >                printf("Subset %d: {%d", ++subset,rec[0]);
> >                for(i = 1; i < recCount; ++i)
> >                        printf(",%d", rec[i]);
> >                printf("}\n");
> >        }
> >        else if (sum > 0)
> >        {
> >                for(i = 0; i < setSize; ++i)
> >                {
> >                        rec[recCount++] = set[i];
> >                        search(set, i, sum-set[i]);
> >                        --recCount;
> >                }
> >        }
> > }
>
> > int main(int argc, char* argv[])
> > {
> >        search(set, setSize, sum);
>
> >        return 0;
> > }
>
> > On Apr 18, 6:16 am, kamlesh yadav  wrote:
> >> given an array of elements (all elements are unique ) , given a sum
> >> s   find all the subsets having sum s.
>
> >> for ex  array {5,9,1,3,4,2,6,7,11,10}
>
> >> sum is 10
>
> >> possible subsets are     {10},  {6,4}     ,{7,3}      {5,3,2}
> >> {6,3,1}  etc.    there can be many more.
> >> also find the total number of these subsets
>
> > --
> > You received this message because you are subscribed to the Google Groups 
> > "Algorithm Geeks" group.
> > To post to this group, 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.
>
> --
> Kamlesh Kumar Yadav
> MCA  Department of Computer Science
> Delhi University

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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: Basic Algorithms!!

2011-04-19 Thread Don
Knuth, "The Art of Computer Programming"

On Apr 19, 4:06 am, Vishnutej  wrote:
> Hello everyone,
>
> Wat according to u are the basic algorithms that a programmer should
> know for sure?
> If possible just let me know of the resource in which it is best
> explained.
>
> Thanks in advance.
>
> -Vishnutej.Mylavarapu

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] [brain teaser ] Identical Twin Puzzle 19april

2011-04-19 Thread DeVaNsH gUpTa
Their date of birth can be same but their birth year can be different.


-- 
Thanks and Regards
DEVANSH GUPTA
B.TECH SECOND 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.



Re: [algogeeks] Re: Sequence Puzzle 13april

2011-04-19 Thread rajul jain
this is look and say sequence next term is
312211
13112221

On Tue, Apr 19, 2011 at 7:43 AM, nagajyothi gunti <
nagajyothi.gu...@gmail.com> wrote:

> Is the answer as follows:
>
> *1 1*
> *2 1*
> 1 2 *1 1*
> 1 1 1 2* 2 1*
> 1 1 2 1 1 1 *1 1*
> 1 1 2 1 1 1 2 1 *2 1*
>
>
> On Thu, Apr 14, 2011 at 2:36 PM, D.N.Vishwakarma@IITR 
> wrote:
>
>> 3 1 2 2 1 1
>> 1 3 1 1 2 2 2 1
>>
>> On Thu, Apr 14, 2011 at 10:24 PM, arpit.gupta wrote:
>>
>>> 3 1 2 2 1 1
>>> 1 3 1 1 2 2 2 1
>>>
>>> On Apr 13, 12:32 pm, Lavesh Rawat  wrote:
>>> > * Sequence Puzzle
>>> >
>>> > The below is a number puzzle. It should be read left to right, top to
>>> > bottom.
>>> > Question 1 What is the next two rows of numbers.
>>> > Question 2 How was this reached.
>>> > 1 1
>>> > 2 1
>>> > 1 2 1 1
>>> > 1 1 1 2 2 1
>>> > *
>>> > *Update Your Answers at* : Click
>>> > Here<
>>> http://dailybrainteaser.blogspot.com/2011/04/sequence-puzzle-13april...
>>> .>
>>> >
>>> > Solution:
>>> > Will be updated after 1 day
>>> >
>>> > --
>>> >
>>> > "Never explain yourself. Your friends don’t need it
>>> and
>>> > your enemies won’t believe 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.
>>>
>>>
>>
>>
>> --
>> **With Regards
>> Deoki Nandan Vishwakarma
>> IITR MCA
>> Mathematics Department*
>> *
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>
>
> --
> Jyothi
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from 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] [brain teaser ] Identical Twin Puzzle 19april

2011-04-19 Thread Arpit Sood
1. they may be triplets... 2. birth year may be different

On Tue, Apr 19, 2011 at 2:00 PM, Lavesh Rawat wrote:

> *  Identical Twin Puzzle  **
>
>  Two women apply for a job. They are identical. They have the same mother,
> father and birthday. The interviewer asks, 'Are you twins?' to which they
> honestly reply, 'No'.
>
> How is this possible?
> *
> *Update Your Answers at* : Click 
> Here
>
> Solution:
> Will be updated after 1 day
>
>
> --
>
> "Never explain yourself. Your friends don’t need it and
> your enemies won’t believe 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.
>



-- 
Regards,
Arpit Sood

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] Basic Algorithms!!

2011-04-19 Thread Anders Ma

http://www.amazon.com/Introduction-Algorithms-Third-Thomas-Cormen/dp/0262033844

On Tue, Apr 19, 2011 at 5:06 PM, Vishnutej
 wrote:
> Hello everyone,
>
> Wat according to u are the basic algorithms that a programmer should
> know for sure?
> If possible just let me know of the resource in which it is best
> explained.
>
> Thanks in advance.
>
> -Vishnutej.Mylavarapu
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from 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
Anders

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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: finding n numbers having particular sum

2011-04-19 Thread Anders Ma
the program doesn't consider const in sum = 0.

On Apr 19, 12:44 am, Don  wrote:
> const int setSize = 20;
> int set[setSize] =
> { 5,9,1,3,4,2,6,7,11,10,13,15,19,22,25,31,33,37,39,40};
> const int sum = 150;
>
> int rec[setSize];
> int recCount = 0;
> int subset=0;
>
> void search(int *set, int setSize, int sum)
> {
>         int i;
>         if (sum == 0)
>         {
>                 printf("Subset %d: {%d", ++subset,rec[0]);
>                 for(i = 1; i < recCount; ++i)
>                         printf(",%d", rec[i]);
>                 printf("}\n");
>         }
>         else if (sum > 0)
>         {
>                 for(i = 0; i < setSize; ++i)
>                 {
>                         rec[recCount++] = set[i];
>                         search(set, i, sum-set[i]);
>                         --recCount;
>                 }
>         }
>
> }
>
> int main(int argc, char* argv[])
> {
>         search(set, setSize, sum);
>
>         return 0;
>
> }
>
> On Apr 18, 6:16 am, kamlesh yadav  wrote:
>
> > given an array of elements (all elements are unique ) , given a sum
> > s   find all the subsets having sum s.
>
> > for ex  array {5,9,1,3,4,2,6,7,11,10}
>
> > sum is 10
>
> > possible subsets are     {10},  {6,4}     ,{7,3}      {5,3,2}
> > {6,3,1}  etc.    there can be many more.
> > also find the total number of these subsets

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] Basic Algorithms!!

2011-04-19 Thread Vishnutej
Hello everyone,

Wat according to u are the basic algorithms that a programmer should
know for sure?
If possible just let me know of the resource in which it is best
explained.

Thanks in advance.

-Vishnutej.Mylavarapu

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] [brain teaser ] Identical Twin Puzzle 19april

2011-04-19 Thread Lavesh Rawat
*  Identical Twin Puzzle

 Two women apply for a job. They are identical. They have the same mother,
father and birthday. The interviewer asks, 'Are you twins?' to which they
honestly reply, 'No'.

How is this possible?
*
*Update Your Answers at* : Click
Here

Solution:
Will be updated after 1 day


-- 

"Never explain yourself. Your friends don’t need it and
your enemies won’t believe 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.