[algogeeks] Re: Closest ancestor of two nodes

2011-08-09 Thread Venkat
Don solution is perfect.
i double checked it..

On Aug 9, 9:01 pm, Don  wrote:
> tree closestSharedAncestor(tree root, tree node1, tree node2, int
> &result)
> {
>   tree returnValue = 0;
>
>   if (root)
>   {
>     if (root == node1) result += 1;
>     if (root == node2) result += 2;
>     int sum = 0;
>     tree returnLeft = closestSharedAncestor(root->left, node1, node2,
> sum);
>     if (returnLeft) returnValuet = returnLeft;
>     else
>     {
>       tree returnRight = closestSharedAncestor(root->right, node1,
> node2, sum);
>       if (returnRight) returnValue = returnRight;
>       else if (sum == 3) returnValue = root;
>     }
>     result += sum;
>   }
>   return returnValue;
>
> }
>
> On Aug 9, 9:56 am, Raman  wrote:
>
>
>
> > Can anyone give me the recursive algo to find closest ancestor of two nodes
> > in a tree(not a BST).- 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] amazon

2011-08-09 Thread Anika Jain
okk thanx

On Wed, Aug 10, 2011 at 11:58 AM, sagar pareek wrote:

> like u have given array
>
> *1 2 3 4 5 7* 6 7 8 9 *1 2 3 4 5 6 *5 4 3 6 7 8
>
> ans will be 6
>
>
> On Wed, Aug 10, 2011 at 11:30 AM, Anika Jain wrote:
>
>> i understand longest subsequence.. but what is longest increasing
>> subsequence .. i dont know the difference between them..plz sumbody tel ..
>>
>>
>> On Tue, Aug 9, 2011 at 9:41 AM, Akash Mukherjee wrote:
>>
>>> @udit : thanx man...they were really helpful
>>>
>>> 2 allcan u plzz chk d answers 4 the qns :
>>> 18c,20b
>>> also how do i solve 14,16  ??
>>>
>>> thanx
>>>
>>> On Mon, Aug 8, 2011 at 1:24 PM, Udit Gupta wrote:
>>>
 helloamazon's this year paper is attached with d mail
 cn u plz tell me what questions were there in adobe written and
 interviews??



 On Thu, Aug 4, 2011 at 10:23 PM, Kamakshii Aggarwal <
 kamakshi...@gmail.com> wrote:

> Can anyone please tell what is the procedure for amazon campus
> recruitment?
>
> --
> Regards,
> Kamakshi
> kamakshi...@gmail.com
> --
> You received this message because you are subscribed to the Google
> Groups "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

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

2011-08-09 Thread kartik sachan
any body tell the test cases??

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

2011-08-09 Thread Ankuj Gupta
We can use min heap.
1) Build a Min Heap MH of the first m elements (arr[0] to arr[m-1]) of
the given array. O(m)
2) For each element, after the mth element (arr[m] to arr[n-1]),
compare it with root of MH.
a) If the element is greater than the root then make it root and call
heapify for MH
b) Else ignore it.
O((n-m)*logm)
3) Finally, MH has m largest elements and root of the MH is the mth
largest element.

On Aug 8, 3:57 pm, vijay goswami  wrote:
> run bubble sort for m passes
>
> On Mon, Aug 8, 2011 at 4:02 PM, Nitin Nizhawan 
> wrote:
>
>
>
>
>
>
>
> > Selection algorithm,http://en.wikipedia.org/wiki/Selection_algorithm
>
> > On Mon, Aug 8, 2011 at 3:59 PM, nick  wrote:
>
> >> how will you find the m'th maximum element in an unsorted array of
> >> integers?
>
> >> --
> >> 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/-/aYU_PfGHiNkJ.
> >> To post to this group, send email to algogeeks@googlegroups.com.
> >> To unsubscribe from 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] amazon

2011-08-09 Thread sagar pareek
like u have given array

*1 2 3 4 5 7* 6 7 8 9 *1 2 3 4 5 6 *5 4 3 6 7 8

ans will be 6


On Wed, Aug 10, 2011 at 11:30 AM, Anika Jain  wrote:

> i understand longest subsequence.. but what is longest increasing
> subsequence .. i dont know the difference between them..plz sumbody tel ..
>
>
> On Tue, Aug 9, 2011 at 9:41 AM, Akash Mukherjee wrote:
>
>> @udit : thanx man...they were really helpful
>>
>> 2 allcan u plzz chk d answers 4 the qns :
>> 18c,20b
>> also how do i solve 14,16  ??
>>
>> thanx
>>
>> On Mon, Aug 8, 2011 at 1:24 PM, Udit Gupta wrote:
>>
>>> helloamazon's this year paper is attached with d mail
>>> cn u plz tell me what questions were there in adobe written and
>>> interviews??
>>>
>>>
>>>
>>> On Thu, Aug 4, 2011 at 10:23 PM, Kamakshii Aggarwal <
>>> kamakshi...@gmail.com> wrote:
>>>
 Can anyone please tell what is the procedure for amazon campus
 recruitment?

 --
 Regards,
 Kamakshi
 kamakshi...@gmail.com
 --
 You received this message because you are subscribed to the Google
 Groups "Algorithm Geeks" group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.

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



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



Re: [algogeeks] Re: Microsoft written!!!

2011-08-09 Thread Mohit Goel
   10
 4  5
   2  7  6 11
   1 39   8 12  13   14   15


i think we should first  find the parent of the particular node ..then apply
the concept as told by Brijesh on it 

p =parent(q);
r = parent(p);
count =1;
while(p ==isright(r))
{
p=r;
r=parent(r);
count++;
if(r==root)
break;

}

if(d =right(r))
{
while(count!=0)
{
if(d->left)
d=d->left;
else d=d->right;
count--;
}
}
else return NULL;
o/p=d->value;

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

2011-08-09 Thread Sinjan Kumar
hello reynald
could you plz send me the Thoughtworks questions,
thanx

On Aug 4, 6:17 am, Reynald Suz  wrote:
> Thank you so much! Thoughtworks is visiting our campus on Aug-8, I'll send
> you questions for sure.
>
>
>
> On Wed, Aug 3, 2011 at 11:14 PM, coder dumca  wrote:
>
> > hi reynald
>
> >  i m sending u some question that i have.  thought workd is gooing to visit
> > our campys in few days . if it is visiting ur campus befire us then pls send
> > me the questions.
>
> >  --
> > You received this message because you are subscribed to the Google Groups
> > "Algorithm Geeks" group.
> > To post to this group, send email to algogeeks@googlegroups.com.
> > To unsubscribe from 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
> Reynald Reni
> Masters in Software Engineering
> CIT - India

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] amazon

2011-08-09 Thread Anika Jain
i understand longest subsequence.. but what is longest increasing
subsequence .. i dont know the difference between them..plz sumbody tel ..

On Tue, Aug 9, 2011 at 9:41 AM, Akash Mukherjee  wrote:

> @udit : thanx man...they were really helpful
>
> 2 allcan u plzz chk d answers 4 the qns :
> 18c,20b
> also how do i solve 14,16  ??
>
> thanx
>
> On Mon, Aug 8, 2011 at 1:24 PM, Udit Gupta  wrote:
>
>> helloamazon's this year paper is attached with d mail
>> cn u plz tell me what questions were there in adobe written and
>> interviews??
>>
>>
>>
>> On Thu, Aug 4, 2011 at 10:23 PM, Kamakshii Aggarwal <
>> kamakshi...@gmail.com> wrote:
>>
>>> Can anyone please tell what is the procedure for amazon campus
>>> recruitment?
>>>
>>> --
>>> Regards,
>>> Kamakshi
>>> kamakshi...@gmail.com
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "Algorithm Geeks" group.
>>> To post to this group, send email to algogeeks@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> algogeeks+unsubscr...@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from 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: problem regarding output??

2011-08-09 Thread jagrati verma
(int *) it is derefrencing of any void pointer into integer.

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

2011-08-09 Thread Anika Jain
ah.. my mistake sorry

On Tue, Aug 9, 2011 at 9:24 PM, Anika Jain  wrote:

> @brijesh: if we have to find leftmost right cousin for 9 in the same tree..
> then it shall be 8.. but 9 is in right subtree of 7..
>
>
> On Tue, Aug 9, 2011 at 2:11 PM, Brijesh Upadhyay <
> brijeshupadhyay...@gmail.com> wrote:
>
>>  10
>>  4  5
>>2  7  6 11
>>1 39   8 12  13   14   15
>> let u have to fine leftmost right cousin of 8 . , move up , u get 10 as
>> the ancestor , such that its left subtree contains 8 , unlike 7 ,4 (whose
>> right subtree contains 8)!   now no of level u moved is 3 .. then
>> traverse in the right subtree of 10 , and find left most node , by moving
>> down 3 levels, and u get 12 as ur answer...
>>
>> --
>> 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/-/Lftrcml-FS0J.
>>
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from 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: Microsoft written!!!

2011-08-09 Thread Dhriti Khanna
I think leftmost right cousin of 9 should be NULL. Because 8 is its
immediate brother, and not cousin.

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

2011-08-09 Thread Ankuj Gupta
C++ will not allow void pointer to increment. But in C we can perform
it where void will be treated as char*

http://stackoverflow.com/questions/3523145/pointer-arithmetic-for-void-pointer-in-c
On Aug 9, 6:39 pm, UMarius  wrote:
> ++ on a void* will increase the address by 1 byte.  ++ on a type* will
> increase the address by sizeof(type) bytes. As if the initial pointer
> were an array of "type"
>
> On Aug 9, 2:49 pm, Rajesh Kumar  wrote:
>
>
>
>
>
>
>
> > why j and k  point different location?
>
> > #include
> > main()
> > {
> > int a=10,*j;
> > void *k;
> > j=k=&a;
> > k=(int *)k;
> > k++;
> > j++;
> > printf("%u %u\n",j,k);
>
> > }
>
> > --
> > Regards
> > Rajesh Kumar

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

2011-08-09 Thread Anika Jain
@brijesh: if we have to find leftmost right cousin for 9 in the same tree..
then it shall be 8.. but 9 is in right subtree of 7..

On Tue, Aug 9, 2011 at 2:11 PM, Brijesh Upadhyay <
brijeshupadhyay...@gmail.com> wrote:

>  10
>  4  5
>2  7  6 11
>1 39   8 12  13   14   15
> let u have to fine leftmost right cousin of 8 . , move up , u get 10 as the
> ancestor , such that its left subtree contains 8 , unlike 7 ,4 (whose right
> subtree contains 8)!   now no of level u moved is 3 .. then traverse in
> the right subtree of 10 , and find left most node , by moving down 3 levels,
> and u get 12 as ur answer...
>
> --
> 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/-/Lftrcml-FS0J.
>
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from 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: MS question

2011-08-09 Thread abhijeet srivastva
Below is a solution -

#include 
int main(int  argc, char* argv[]){
int i = 0;
char *array = argv[1];
char prev = array[0];
while(array[i]){
int count = 0;
while(prev == array[i]){
i +=1;
count++;
}
printf("%d%c,",count,prev);
prev = array[i];
}
printf("\n");
}

Regards
Abhijeet Srivastva



On Wed, Aug 10, 2011 at 9:04 AM, monish001  wrote:

> Given : ddbbccae
> O/P : 2d4a2b2c1a1e
> What is happening? What algo?
>
> Thanks and regards
> Monish
>
> On Aug 9, 5:59 pm, ankit sambyal  wrote:
> > Given an array of characters, change the array to something as shown in
> the
> > following example.
> > Given : ddbbccae
> > O/P : 2d4a2b2c1a1e
> >
> > Do it in the most efficient manner both in terms of time and space ...
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from 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: Amazon question.

2011-08-09 Thread Ankuj Gupta
How is the time O(n^2).It is O(nlgn)

On Aug 9, 7:53 pm, ankit sambyal  wrote:
> 1. Square each element of the array and then sort it---O(nlogn)
> 2. for(i=0;i<(size-3);i++)
> {
>     j=i+1; k=size-1;
>     while(j     {
>         if(a[[i] + a[j] == a[k])
>             printf("\n%d %d %d",sqrt(a[i]),sqrt(a[j]),sqrt(a[k]));
>         else if(a[i] + a[j] < a[k])
>             j++;
>         else
>             k--;
>     }
>
> }O(n^2)
>
> Time O(n^2)

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] SPOJ CENCRY

2011-08-09 Thread kartik sachan
this is my codeplz give me any test case where my code
fails.i am reaptedly getting WA

link is https://www.spoj.pl/problems/CENCRY/

# include
# include
char a[]="aeiouaeiouaeiouaeioua";
char b[]="bcdfghjklmnpqrstvwxyz";
int search(char a1)
{
int i;
if(a1=='a'||a1=='e'||a1=='i'||a1=='o'||a1=='u')
{
for(i=0;i<5;i++)
if(a1==a[i])
{return i;break;}
}
else
{
for(i=0;i<22;i++)
if(a1==b[i])
{return i;break;}
}
}


int main()
{

int l1=strlen(a);
int l2=strlen(b);

char c[6];
int t;
scanf("%d",&t);
int j;
for(j=0;jhttp://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Re: MS question

2011-08-09 Thread monish001
Given : ddbbccae
O/P : 2d4a2b2c1a1e
What is happening? What algo?

Thanks and regards
Monish

On Aug 9, 5:59 pm, ankit sambyal  wrote:
> Given an array of characters, change the array to something as shown in the
> following example.
> Given : ddbbccae
> O/P : 2d4a2b2c1a1e
>
> Do it in the most efficient manner both in terms of time and space ...

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

2011-08-09 Thread Shachindra A C
@dave : nice explanationsthank you for pointing out :)

On Wed, Aug 10, 2011 at 3:39 AM, Prakash D  wrote:

> @dave: thank you.. nice explanation :)
>
>
> On Wed, Aug 10, 2011 at 3:24 AM, Dave  wrote:
>
>> @Ritu: We are flipping one coin five times. Are you saying that you
>> don't learn anything about the coin by flipping it? Would you learn
>> something if any one of the five flips turned up tails? After a tails,
>> would you say that the probability of a subsequent head is still 3/5?
>>
>> Dave
>>
>> On Aug 9, 11:19 am, ritu  wrote:
>> > The statement "You randomly pulled one coin from the bag and tossed"
>> > tells that all the  events of tossing the coin are independent hence
>> > ans is 3/5
>> >
>> > On Aug 7, 10:34 pm, Algo Lover  wrote:
>> >
>> >
>> >
>> > > A bag contains 5 coins. Four of them are fair and one has heads on
>> > > both sides. You randomly pulled one coin from the bag and tossed it 5
>> > > times, heads turned up all five times. What is the probability that
>> > > you toss next time, heads turns up. (All this time you don't know you
>> > > were tossing a fair coin or not).
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
Regards,
Shachindra A C

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

2011-08-09 Thread Gary Drocella
RAID Level 0 is used for high performance where data loss isn't
critical.  Bit stripping is still performed
over multiple disks, but no mirroring or parity bits used for checking
data integrity.

On Aug 9, 2:56 pm, Vivek Srivastava 
wrote:
> On Wed, Aug 10, 2011 at 12:22 AM, raghavendhra rahul <
>
>
>
>
>
>
>
> rahulraghavend...@gmail.com> wrote:
> > @krishnameena: i think its 5
>
> > correct me if i m wrong
>
> > --
>
> > Regards
> > Raghavendhra
>
> > It's Raid level 3
> > "changing the face" can change nothing .. but "facing the change" can
> > change everything
>
> >  --
> > You received this message because you are subscribed to the Google Groups
> > "Algorithm Geeks" group.
> > To post to this group, send email to algogeeks@googlegroups.com.
> > To unsubscribe from 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] pls help

2011-08-09 Thread sagar pareek
Oh!
sorry
my idea for internal nodes=leaves-1  is only for binary tree

like at level 4 total leaves 2^4=32
so internal nodes=32-1=31
also can be checked as 16+8+4+2+1=31

there must be a shortcut for ternary also...

by the way brijesh thanks for correcting me.
so total internal nodes will be 40 as stated by brijesh

On Wed, Aug 10, 2011 at 3:08 AM, Brijesh Upadhyay <
brijeshupadhyay...@gmail.com> wrote:

> General approach would be , get the no of levels first by log 28 /log 3 , =
> 4(use ceiling)...and now 3^0+3^1+3^2+3^3 = 40 will be no of internal nodes..
>
>
> --
> 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/-/OyhD3tQ5uPgJ.
>
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from 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.



Re: [algogeeks] Probability question.. help

2011-08-09 Thread Prakash D
is there anything like there should be atleast one man and one women should
dance together?


On Wed, Aug 10, 2011 at 2:26 AM, Shuaib Khan  wrote:

>
>
> On Wed, Aug 10, 2011 at 1:45 AM, Brijesh Upadhyay <
> brijeshupadhyay...@gmail.com> wrote:
>
>> No thers is not.. someone has asked me this., dont know anything else
>> about the question  :|
>
>
> Seems like you got half of the question there.
>
>
>>  --
>> 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/-/mqMvDgb6TqUJ.
>>
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>
>
> --
> Shuaib
> http://www.bytehood.com
> http://twitter.com/ShuaibKhan
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from 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: Probability Puzzle

2011-08-09 Thread Prakash D
@dave: thank you.. nice explanation :)

On Wed, Aug 10, 2011 at 3:24 AM, Dave  wrote:

> @Ritu: We are flipping one coin five times. Are you saying that you
> don't learn anything about the coin by flipping it? Would you learn
> something if any one of the five flips turned up tails? After a tails,
> would you say that the probability of a subsequent head is still 3/5?
>
> Dave
>
> On Aug 9, 11:19 am, ritu  wrote:
> > The statement "You randomly pulled one coin from the bag and tossed"
> > tells that all the  events of tossing the coin are independent hence
> > ans is 3/5
> >
> > On Aug 7, 10:34 pm, Algo Lover  wrote:
> >
> >
> >
> > > A bag contains 5 coins. Four of them are fair and one has heads on
> > > both sides. You randomly pulled one coin from the bag and tossed it 5
> > > times, heads turned up all five times. What is the probability that
> > > you toss next time, heads turns up. (All this time you don't know you
> > > were tossing a fair coin or not).
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from 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: Probability Puzzle

2011-08-09 Thread Dave
@Ritu: We are flipping one coin five times. Are you saying that you
don't learn anything about the coin by flipping it? Would you learn
something if any one of the five flips turned up tails? After a tails,
would you say that the probability of a subsequent head is still 3/5?

Dave

On Aug 9, 11:19 am, ritu  wrote:
> The statement "You randomly pulled one coin from the bag and tossed"
> tells that all the  events of tossing the coin are independent hence
> ans is 3/5
>
> On Aug 7, 10:34 pm, Algo Lover  wrote:
>
>
>
> > A bag contains 5 coins. Four of them are fair and one has heads on
> > both sides. You randomly pulled one coin from the bag and tossed it 5
> > times, heads turned up all five times. What is the probability that
> > you toss next time, heads turns up. (All this time you don't know you
> > were tossing a fair coin or not).

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

2011-08-09 Thread Brijesh Upadhyay
General approach would be , get the no of levels first by log 28 /log 3 , = 
4(use ceiling)...and now 3^0+3^1+3^2+3^3 = 40 will be no of internal nodes..

-- 
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/-/OyhD3tQ5uPgJ.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] pls help

2011-08-09 Thread Brijesh Upadhyay
1 produces 3 nodes , which then 9 nodes,--> 27 nodes , and thses 27 
nodes finally produces <=81 leaves so sum of 27+9+3+1= 40 is the right 
answer... i guess

-- 
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/-/6EblaEKZozcJ.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] pls help

2011-08-09 Thread Brijesh Upadhyay
80???  how can 80 internal nodes just produce only maximum of 81 leaves and 
that too in 3ary tree  
the answer is  1+3+9+27 = 40 internal nodes... think like this 

-- 
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/-/7h9t9fFsVs0J.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] pls help

2011-08-09 Thread sagar pareek
sorry answer is not 27 its  *""80""*



just consider a binary tree 1st
root has nodes 2^0=1
1st level has 2^1=2
2nd has 2^2=4
so nth level has leaves 2^n

now if we have ternary tree
then follow same procedure just change 3 with 2..
mean at nth level total leaves 3^n

now calculate the level where 28 leaves can have

its not 3^3=27

so it will be 3^4=81

now at 4th level only 28 leaves are filled so its internal level will have
total 80 nodes

if any level has n leaves then total internal nodes=total leaves nodes -1

hence total internal nodes are 80
and total nodes are 80+28

i think u got it




On Wed, Aug 10, 2011 at 2:38 AM, muthu raj  wrote:

> pls explain how u got 27?
> *Muthuraj R
> IV th Year , ISE
> PESIT , Bangalore*
>
>
>
> On Wed, Aug 10, 2011 at 1:13 AM, sagar pareek wrote:
>
>> in ques 1 i considered leaves as nodes... if we consider only internal
>> nodes then it have 27
>>
>>
>> On Wed, Aug 10, 2011 at 1:12 AM, sagar pareek wrote:
>>
>>> 1.28+27
>>> 2.2pow(d)
>>>
>>>
>>> On Wed, Aug 10, 2011 at 12:07 AM, NIKHIL >> > wrote:
>>>
 In a ternary Tree No of leaves 28. How many nodes it have?
 An AVL tree with height d. How many children it have?

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



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



Re: [algogeeks] pls help

2011-08-09 Thread Brijesh Upadhyay
I dont think 27 is the right answer,... it should be log 28 /log 3... i mean 
log 28 base 3 shuold be the no. of internal nodes !   and for any no of 
leaves , >27 &&  < 81, the answer would be same... 

-- 
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/-/DN0DIvuwNLQJ.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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: Microsoft written!!!

2011-08-09 Thread Brijesh Upadhyay
 10
 4  5
   2  7  6 11
   1 39   8 12  13   14   15
let u have to fine leftmost right cousin of 8 . , move up , u get 10 as the 
ancestor , such that its left subtree contains 8 , unlike 7 ,4 (whose right 
subtree contains 8)!   now no of level u moved is 3 .. then traverse in 
the right subtree of 10 , and find left most node , by moving down 3 levels, 
and u get 12 as ur answer...

-- 
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/-/Lftrcml-FS0J.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] pls help

2011-08-09 Thread muthu raj
pls explain how u got 27?
*Muthuraj R
IV th Year , ISE
PESIT , Bangalore*



On Wed, Aug 10, 2011 at 1:13 AM, sagar pareek  wrote:

> in ques 1 i considered leaves as nodes... if we consider only internal
> nodes then it have 27
>
>
> On Wed, Aug 10, 2011 at 1:12 AM, sagar pareek wrote:
>
>> 1.28+27
>> 2.2pow(d)
>>
>>
>> On Wed, Aug 10, 2011 at 12:07 AM, NIKHIL 
>> wrote:
>>
>>> In a ternary Tree No of leaves 28. How many nodes it have?
>>> An AVL tree with height d. How many children it have?
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "Algorithm Geeks" group.
>>> To post to this group, send email to algogeeks@googlegroups.com.
>>> To unsubscribe from 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
>>
>>
>
>
> --
> **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] Re: Microsoft written!!!

2011-08-09 Thread Brijesh Upadhyay
simple algo.. :
let we have to find leftmost right cousin of x!
>>  try to get an ancestor of the node x such that x lies in left subtree of 
that ancestor  , and count no of levels , say L,  u moved to get that 
ancestor..now start from that ancestor to get left most node IN THE RIGHT 
SUBTREE , by going down L levels... that might be ur answer... correct me , 
if i m wrong!

-- 
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/-/agOYaDD33H0J.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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: Microsoft written!!!

2011-08-09 Thread Brijesh Upadhyay
simple algo.. :
let we have to find leftmost right cousin of x!
>>  try to get an ancestor of the node x such that x lies in left subtree of 
that ancestor  , and count no of levels , say L,  u moved to get that 
ancestor..now start from that ancestor to get left most node , by going down 
L levels... that might be ur answer... correct me , if i m wrong!

-- 
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/-/--VUgL7M18gJ.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] Microsoft written!!!

2011-08-09 Thread muthu raj
Write a C code to find Leftmost right cousin at the same level.

For ex:
   10
/\
   2 3
   /\ /\

  8 56 9

Leftmost right cousin of 5 is 6. Leftmost right cousin of 3 is NULL

*Muthuraj R
IV th Year , ISE
PESIT , Bangalore*

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Probability question.. help

2011-08-09 Thread Shuaib Khan
On Wed, Aug 10, 2011 at 1:45 AM, Brijesh Upadhyay <
brijeshupadhyay...@gmail.com> wrote:

> No thers is not.. someone has asked me this., dont know anything else about
> the question  :|


Seems like you got half of the question there.


>  --
> 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/-/mqMvDgb6TqUJ.
>
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
Shuaib
http://www.bytehood.com
http://twitter.com/ShuaibKhan

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

2011-08-09 Thread Brijesh Upadhyay
No thers is not.. someone has asked me this., dont know anything else about 
the question  :|

-- 
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/-/mqMvDgb6TqUJ.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] o/p

2011-08-09 Thread Prakash D
@rajkumar: thanks

#include 

#define max(a,b) ((a>b)?a:b)
int main()
{
 int m,n;
 m=3+max(2,3);
 n=2*max(3,2);
 printf("%d,%d",m,n);

getchar();
return 0;
}

this gives the correct output as 6,6



On Mon, Aug 8, 2011 at 7:12 PM, Dipankar Patro  wrote:

> relational operators give 0/1 output;
> (a>b) - will be either 0 or 1.
> similarly (a==b) will either be 0 or 1
>
>
> On 8 August 2011 18:39, Anil Arya  wrote:
>
>> in expression (a>b)?a:b--->(a>b) returns 1 if true  and  0 if
>> (false) .
>>
>>
>>
>> On Mon, Aug 8, 2011 at 6:08 PM, dilip makwana wrote:
>>
>>> Since test condition will always evaluate to non-zero value (which is
>>> considered true in c/c++) hence always first option get selected 
>>>
>>>
>>> On 8 August 2011 17:44, Shachindra A C  wrote:
>>>
 oops...I'm sorry.. the statement would evaluate to 3 + *0* ? 2 : 3 ==>
 *3* ? 2 : 3 ==> m = 2.


 On Mon, Aug 8, 2011 at 5:43 PM, Shachindra A C 
 wrote:

> @raj,
>  the preprocessed file would contain m=3+(2>3)?2:3 AFAIK.
>
>  So, the statement would evaluate to 3 + 1 ? 2 : 3 ==> 4 ? 2 :
> 3 ==> m = 2.
>
>  Likewise for n.
>
>
>  On Mon, Aug 8, 2011 at 5:21 PM, raj kumar wrote:
>
>> 3+2>3?2:3
>> so 5>3 hence 2 is returned bcoz of higher precedence of + over ?
>> 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.
>>
>
>
>
> --
> Regards,
> Shachindra A C
>
>


 --
 Regards,
 Shachindra A C

  --
 You received this message because you are subscribed to the Google
 Groups "Algorithm Geeks" group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.

>>>
>>>
>>>
>>> --
>>> *Dilip Makwana*
>>> VJTI
>>> BTech Computers Engineering
>>> 2009-2013
>>>
>>>  --
>>> You received this message because you are subscribed to the Google Groups
>>> "Algorithm Geeks" group.
>>> To post to this group, send email to algogeeks@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> algogeeks+unsubscr...@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>>
>>
>> --
>> Anil Kumar Arya
>> B.Tech  III year
>> computer science & engineering
>> M.N.N.I.T 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.
>>
>
>
>
> --
>
> ___
>
> Please do not print this e-mail until urgent requirement. Go Green!!
> Save Papers <=> Save Trees
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from 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] Probability question.. help

2011-08-09 Thread Prakash D
is there any constraint for anyone to dance?

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

2011-08-09 Thread Brijesh Upadhyay
100 men & women dance with each other. What is the Probability that a
man cannot dance with more than two women?

--
Regards,
Brijesh Upadhyay
CSE
Thapar 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] pls help

2011-08-09 Thread sagar pareek
in ques 1 i considered leaves as nodes... if we consider only internal nodes
then it have 27

On Wed, Aug 10, 2011 at 1:12 AM, sagar pareek  wrote:

> 1.28+27
> 2.2pow(d)
>
>
> On Wed, Aug 10, 2011 at 12:07 AM, NIKHIL 
> wrote:
>
>> In a ternary Tree No of leaves 28. How many nodes it have?
>> An AVL tree with height d. How many children it have?
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from 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
>
>


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



Re: [algogeeks] pls help

2011-08-09 Thread sagar pareek
1.28+27
2.2pow(d)

On Wed, Aug 10, 2011 at 12:07 AM, NIKHIL wrote:

> In a ternary Tree No of leaves 28. How many nodes it have?
> An AVL tree with height d. How many children it have?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from 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.



Re: [algogeeks] C question

2011-08-09 Thread Raman
signed char 129 = -127

127 =>   0111 
-127 =>   1000 0001  (2's compliment form) = ff81 (hex)

-- 
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/-/0Y7Ev0aJuLgJ.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] RAID LEVEL

2011-08-09 Thread Vivek Srivastava
On Wed, Aug 10, 2011 at 12:22 AM, raghavendhra rahul <
rahulraghavend...@gmail.com> wrote:

> @krishnameena: i think its 5
>
> correct me if i m wrong
>
>
> --
>
> Regards
> Raghavendhra
>
>
> It's Raid level 3
> "changing the face" can change nothing .. but "facing the change" can
> change everything
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from 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] RAID LEVEL

2011-08-09 Thread raghavendhra rahul
@krishnameena: i think its 5

correct me if i m wrong


-- 

Regards
Raghavendhra



"changing the face" can change nothing .. but "facing the change" can change
everything

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

2011-08-09 Thread krishna meena
which raid level provide highest data transfer rate ?

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

2011-08-09 Thread Priyanshu
@gopi.. didnt got you...

@adi.. ya thats what i am talking about...


Regards,
Priyanshu Gupta



On Tue, Aug 9, 2011 at 11:18 AM, Aditya Virmani wrote:

> i guess ur qn was how will u decide which frame shud b ur thumbnail...as
> after tht, the frame cud be set as a thumbnail which is pretty much an eay
> task in windows programming.i think most, dun hav much info abt it though,
> thumbnails shud contain more of data; i mean shudnt be unicolour(blank
> screen).
>
>
> On Tue, Aug 9, 2011 at 11:30 PM, *$*  wrote:
>
>> I guess , it can be done using indexing , with time stamp as key , and
>> frame pointer as data ..
>> Please correct me if I am wrong.
>>
>>
>> On Tue, Aug 9, 2011 at 11:03 PM, Priyanshu wrote:
>>
>>> Anyone??
>>>
>>> Regards,
>>> Priyanshu Gupta
>>>
>>>
>>> On Fri, Aug 5, 2011 at 6:09 PM, priyanshu wrote:
>>>
 Give an efficient algorithm  to determine which part of the video
 should be displayed as a thumbnail??
>>>
>>>
>>>  --
>>> You received this message because you are subscribed to the Google Groups
>>> "Algorithm Geeks" group.
>>> To post to this group, send email to algogeeks@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> algogeeks+unsubscr...@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>>
>>
>> --
>> Thx,
>> --Gopi
>>
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from 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] pls help

2011-08-09 Thread NIKHIL
In a ternary Tree No of leaves 28. How many nodes it have?
An AVL tree with height d. How many children it have?

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

2011-08-09 Thread nandy
Hi all,does anyone know EMC software's(bangalore) written pattern?is
it purely technical..if so can anyone tell me the areas to concentrate
on?

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] os

2011-08-09 Thread *$*
shared memory is fastest IPC mechanism , because , it is a simple memory
allocation on physical memory ,
in case of other options like pipes etc , they requires kernel entries ..

Thx,
--Gopi

On Tue, Aug 9, 2011 at 11:00 PM, Varun Jakhoria wrote:

> @Raghvendhra +1 ... because it doesn't require entry at kernel
>
> On Tue, Aug 9, 2011 at 10:55 PM, raghavendhra rahul
>  wrote:
> > Shared memory is fastest IPC mechanism, since it doesn’t involve any
> system
> > call as it is done in user space.
> > --
> >
> > Regards
> > Raghavendhra
> >
> >
> >
> > "changing the face" can change nothing .. but "facing the change" can
> change
> > everything
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Algorithm Geeks" group.
> > To post to this group, send email to algogeeks@googlegroups.com.
> > To unsubscribe from this group, send email to
> > algogeeks+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> > http://groups.google.com/group/algogeeks?hl=en.
> >
>
>
>
> --
> Varun Jakhoria
> ...it's only about 0's & 1's
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>


-- 
Thx,
--Gopi

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

2011-08-09 Thread Aditya Virmani
i guess ur qn was how will u decide which frame shud b ur thumbnail...as
after tht, the frame cud be set as a thumbnail which is pretty much an eay
task in windows programming.i think most, dun hav much info abt it though,
thumbnails shud contain more of data; i mean shudnt be unicolour(blank
screen).

On Tue, Aug 9, 2011 at 11:30 PM, *$*  wrote:

> I guess , it can be done using indexing , with time stamp as key , and
> frame pointer as data ..
> Please correct me if I am wrong.
>
>
> On Tue, Aug 9, 2011 at 11:03 PM, Priyanshu wrote:
>
>> Anyone??
>>
>> Regards,
>> Priyanshu Gupta
>>
>>
>> On Fri, Aug 5, 2011 at 6:09 PM, priyanshu wrote:
>>
>>> Give an efficient algorithm  to determine which part of the video
>>> should be displayed as a thumbnail??
>>
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>
>
> --
> Thx,
> --Gopi
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from 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: MS question

2011-08-09 Thread *$*
I guess , it can be done using indexing , with time stamp as key , and frame
pointer as data ..
Please correct me if I am wrong.

On Tue, Aug 9, 2011 at 11:03 PM, Priyanshu  wrote:

> Anyone??
>
> Regards,
> Priyanshu Gupta
>
>
> On Fri, Aug 5, 2011 at 6:09 PM, priyanshu wrote:
>
>> Give an efficient algorithm  to determine which part of the video
>> should be displayed as a thumbnail??
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
Thx,
--Gopi

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

2011-08-09 Thread raghavendhra rahul
hi all

 a company called Athena Health is visiting our campus...need help
regarding the question pattern and the question types..

-- 

Regards
Raghavendhra



"changing the face" can change nothing .. but "facing the change" can change
everything

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] C question

2011-08-09 Thread programming love
Correct me if i'm wrong. I think it's cos at a time it'll fetch the amount
of bytes = to it's register's size.
If a 32-bit machine is being used, answer will contain 4 bytes
 ff81

16-bit machine -  ff81

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

2011-08-09 Thread Karthikeyan palani
main()
{
char a=129;

printf("%0x",a);
}

the o/p whch i'm getting s ff81.. why is tat so?
as char s 1 byte why 2 bytes r printed...



-- 
karthikeyankkn

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

2011-08-09 Thread Varun Jakhoria
if linux use split command

On Tue, Aug 9, 2011 at 8:56 PM, Don  wrote:
> #include 
> #include 
>
> int main()
> {
>  char inFileName[80];
>  char outFileName[80];
>  int numSegments;
>  int bytesPerSegment;
>
>  printf("Enter file name:");
>  fgets(inFileName,80,stdin);
>  printf("Enter number of segments:");
>  scanf("%d", &numSegments);
>
>  FILE *f = fopen(inFileName, "rb");
>  if (!f) return 0;
>
>  // Get size of file to determine bytes per file segment
>  fseek(f, 0, SEEK_END);
>  int bytesPerSegment = 1 + (ftell(f) / numSegments);
>  fseek(f,0,SEEK_SET);
>  char *buffer = (char *)malloc(bytesPerSegment);
>  for(int segment = 0; segment < numSegments; ++segment)
>  {
>    sprintf(outFileName,"%s%d", inFileName,segment);
>    FILE *out = fopen(outFileName,"wb");
>    int len=fread(buffer, bytesPerSegment, 1, f);
>    fwrite(buffer, len, 1, out);
>    fclose(out);
>  }
>  return 1;
> }
>
> On Aug 9, 7:28 am, Divya Elangovan  wrote:
>> pls help me..its very urgent
>>
>> need a program to divide a file into equal parts(segments)
>>
>> --
>>
>> *
>>             **
>> *
>> *      **        **DIVI*
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to 
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/algogeeks?hl=en.
>
>



-- 
Varun Jakhoria
...it's only about 0's & 1's

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

2011-08-09 Thread Priyanshu
Anyone??

Regards,
Priyanshu Gupta


On Fri, Aug 5, 2011 at 6:09 PM, priyanshu  wrote:

> Give an efficient algorithm  to determine which part of the video
> should be displayed as a thumbnail??

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] os

2011-08-09 Thread Varun Jakhoria
@Raghvendhra +1 ... because it doesn't require entry at kernel

On Tue, Aug 9, 2011 at 10:55 PM, raghavendhra rahul
 wrote:
> Shared memory is fastest IPC mechanism, since it doesn’t involve any system
> call as it is done in user space.
> --
>
> Regards
> Raghavendhra
>
>
>
> "changing the face" can change nothing .. but "facing the change" can change
> everything
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
Varun Jakhoria
...it's only about 0's & 1's

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

2011-08-09 Thread DK
Please read the specifications IEEE 754 for representation of single digit 
floating point numbers.

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

In short, the format is:
   (1)(8)(23)
| sign bit | exponent + 127 | mantissa |

given the number is represented in base 2 format.

eg. 5.375 = 101 + bin(.375)
bin(.375) 
0.375 x 2 = 0.75 (0)
0.75 x 2 = 1.5 (1)
0.5 x 2 = 1.
therefore bin(5.375) = 101.011
Shifting decimal point = 1.01011 x 2^2

Sign bit = 0
Exponent = 127 + 2 = 129 = 1000 0001
Mantissa = 0101 1000    000


Floating point representation:
0 | 1000 0001 | 0101 1000    000|

--
DK

http://www.divye.in
http://twitter.com/divyekapoor
http://gplus.to/divyekapoor

-- 
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/-/GahSJFDLuF0J.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] os

2011-08-09 Thread raghavendhra rahul
Shared memory is fastest IPC mechanism, since it doesn’t involve any system
call as it is done in user space.
-- 

Regards
Raghavendhra



"changing the face" can change nothing .. but "facing the change" can change
everything

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

2011-08-09 Thread raghavendhra rahul
i think u guys r getting the question wrong...the question was to delete the
previous node of the current node and not the current node itself...

-- 

Regards
Raghavendhra



"changing the face" can change nothing .. but "facing the change" can change
everything

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

2011-08-09 Thread programming love
@Dave: Thanks for the explanation :)

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

2011-08-09 Thread SANDEEP CHUGH
@all sorry i give wrong explanation by mistake..:P :P

printf("")  returns no if characters.. in this case returns 0 . which is
assigned to ch

so in ch 0 is stored and 0 is the ascii value of null character
when we using ch in --- if (ch) --> it will reduce to if(0) -- as 0 is the
ascii value of null character

so the output "it doesn't matter"

On Tue, Aug 9, 2011 at 10:28 PM, Dipankar Patro  wrote:

> o/p:
> It doesn't matter
>
> Reason:
> printf() returns the number of characters printed to screen.
> since printf("") will return 0, hence the *else* is selected.
>
>
> On 9 August 2011 22:25, siddharth srivastava  wrote:
>
>>
>>
>> On 9 August 2011 22:20, tech rascal  wrote:
>>
>>> #include
>>> int main()
>>> {
>>> char ch;
>>> if((ch=printf("")))
>>> printf("it matters");
>>> else
>>> printf("it doesn't matter");
>>> return 0;
>>> }
>>>
>>>
>> It doesn't matter
>>
>>
>>
>>>
>>> what will b the output??
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "Algorithm Geeks" group.
>>> To post to this group, send email to algogeeks@googlegroups.com.
>>> To unsubscribe from 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.
>>
>
>
>
> --
>
> ___
>
> Please do not print this e-mail until urgent requirement. Go Green!!
> Save Papers <=> Save Trees
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from 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: texas instruments

2011-08-09 Thread aditi garg
and how much time do dey gv fr each section...any suggestion whch section to
be attempted frst???

On Tue, Aug 9, 2011 at 10:29 PM, Decipher  wrote:

> Both Tech and Apti papers were MCQs . And the questions are not that tough
> . Therefore they expect very good marks in written test . Some questions
> might ask you some intricate things about C or C++ like questions related to
> heaps , dynamic/static memory and other general computer concepts .
>
> --
> 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/-/bI68THLLToMJ.
>
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
Aditi Garg
Undergraduate Student
Electronics & Communication Divison
NETAJI SUBHAS INSTITUTE OF TECHNOLOGY
Sector 3, Dwarka
New Delhi

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

2011-08-09 Thread siddharth srivastava
my bad..that I didn't notice = (assumed it to be ==)

On 9 August 2011 22:28, SANDEEP CHUGH  wrote:

> it doesn't matter
>
> On Tue, Aug 9, 2011 at 10:25 PM, siddharth srivastava  > wrote:
>
>>
>>
>> On 9 August 2011 22:20, tech rascal  wrote:
>>
>>> #include
>>> int main()
>>> {
>>> char ch;
>>> if((ch=printf("")))
>>> printf("it matters");
>>> else
>>> printf("it doesn't matter");
>>> return 0;
>>> }
>>>
>>>
>> output wud be : It doesn't matter
>>
>
> reason:  in the printf("") ---> this will return null character and assign
> it to ch and null character has ascii value 0
>
> so statement reduces to
>
> if(0)
>
> rest u knw..
>
>
>
>>
>>
>>
>>>
>>> what will b the output??
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "Algorithm Geeks" group.
>>> To post to this group, send email to algogeeks@googlegroups.com.
>>> To unsubscribe from 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.
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from 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: texas instruments

2011-08-09 Thread Decipher
Both Tech and Apti papers were MCQs . And the questions are not that tough . 
Therefore they expect very good marks in written test . Some questions might 
ask you some intricate things about C or C++ like questions related to heaps 
, dynamic/static memory and other general computer concepts .

-- 
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/-/bI68THLLToMJ.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] Preprocessor Help !!

2011-08-09 Thread Amol Sharma
http://faq.cprogramming.com/cgi-bin/smartfaq.cgi?answer=1047589067&id=1043284376
--


Amol Sharma
Third Year Student
Computer Science and Engineering
MNNIT Allahabad




On Tue, Aug 9, 2011 at 10:20 PM, Decipher  wrote:

>
> Q1) How to find factorial of a number at pre-processor stage only ?
>
> Q2) In C++ NULL is defined as* #define NULL 0* while in C it is defined as
> *#define NULL (void *) 0 . *What difference it makes ?
>
> --
> 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/-/RLQTCpRt658J.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from 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] output?

2011-08-09 Thread SANDEEP CHUGH
it doesn't matter

On Tue, Aug 9, 2011 at 10:25 PM, siddharth srivastava
wrote:

>
>
> On 9 August 2011 22:20, tech rascal  wrote:
>
>> #include
>> int main()
>> {
>> char ch;
>> if((ch=printf("")))
>> printf("it matters");
>> else
>> printf("it doesn't matter");
>> return 0;
>> }
>>
>>
> output wud be : It doesn't matter
>

reason:  in the printf("") ---> this will return null character and assign
it to ch and null character has ascii value 0

so statement reduces to

if(0)

rest u knw..



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

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

2011-08-09 Thread Dipankar Patro
o/p:
It doesn't matter

Reason:
printf() returns the number of characters printed to screen.
since printf("") will return 0, hence the *else* is selected.

On 9 August 2011 22:25, siddharth srivastava  wrote:

>
>
> On 9 August 2011 22:20, tech rascal  wrote:
>
>> #include
>> int main()
>> {
>> char ch;
>> if((ch=printf("")))
>> printf("it matters");
>> else
>> printf("it doesn't matter");
>> return 0;
>> }
>>
>>
> It doesn't matter
>
>
>
>>
>> what will b the output??
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from 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.
>



-- 
___

Please do not print this e-mail until urgent requirement. Go Green!!
Save Papers <=> Save Trees

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

2011-08-09 Thread Amol Sharma
printf returns the numbers of character printed and here it prints nothing
i.e. 0 characters hence returns 0

and hence "it doesnt matter" gets printed
--


Amol Sharma
Third Year Student
Computer Science and Engineering
MNNIT Allahabad




On Tue, Aug 9, 2011 at 10:25 PM, tech rascal wrote:

> explanation??
>
>
> On Tue, Aug 9, 2011 at 10:24 PM, aditi garg wrote:
>
>> it doesnt matter
>>
>> On Tue, Aug 9, 2011 at 10:20 PM, tech rascal wrote:
>>
>>> #include
>>> int main()
>>> {
>>> char ch;
>>> if((ch=printf("")))
>>> printf("it matters");
>>> else
>>> printf("it doesn't matter");
>>> return 0;
>>> }
>>>
>>>
>>> what will b the output??
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "Algorithm Geeks" group.
>>> To post to this group, send email to algogeeks@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> algogeeks+unsubscr...@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>>
>>
>> --
>> Aditi Garg
>> Undergraduate Student
>> Electronics & Communication Divison
>> NETAJI SUBHAS INSTITUTE OF TECHNOLOGY
>> Sector 3, Dwarka
>> New Delhi
>>
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from 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] output?

2011-08-09 Thread siddharth srivastava
On 9 August 2011 22:25, tech rascal  wrote:

> explanation??
>
>
printf returns the no of characters printed
moreover you have an uninitialized char (with garbage value) so comparison
will always be false



>
> On Tue, Aug 9, 2011 at 10:24 PM, aditi garg wrote:
>
>> it doesnt matter
>>
>> On Tue, Aug 9, 2011 at 10:20 PM, tech rascal wrote:
>>
>>> #include
>>> int main()
>>> {
>>> char ch;
>>> if((ch=printf("")))
>>> printf("it matters");
>>> else
>>> printf("it doesn't matter");
>>> return 0;
>>> }
>>>
>>>
>>> what will b the output??
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "Algorithm Geeks" group.
>>> To post to this group, send email to algogeeks@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> algogeeks+unsubscr...@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>>
>>
>> --
>> Aditi Garg
>> Undergraduate Student
>> Electronics & Communication Divison
>> NETAJI SUBHAS INSTITUTE OF TECHNOLOGY
>> Sector 3, Dwarka
>> New Delhi
>>
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
Regards
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] output?

2011-08-09 Thread Varun Jakhoria
it doesn't matter

On Tue, Aug 9, 2011 at 10:24 PM, Jayanthi shravan
 wrote:
>
>   it matters..
> On Tue, Aug 9, 2011 at 10:20 PM, tech rascal 
> wrote:
>>
>>
>>
>> what will b the output??
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>
>
>
> --
> shravan
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
Varun Jakhoria
...it's only about 0's & 1's

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

2011-08-09 Thread siddharth srivastava
On 9 August 2011 22:20, tech rascal  wrote:

> #include
> int main()
> {
> char ch;
> if((ch=printf("")))
> printf("it matters");
> else
> printf("it doesn't matter");
> return 0;
> }
>
>
It doesn't matter



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

2011-08-09 Thread tech rascal
explanation??

On Tue, Aug 9, 2011 at 10:24 PM, aditi garg wrote:

> it doesnt matter
>
> On Tue, Aug 9, 2011 at 10:20 PM, tech rascal wrote:
>
>> #include
>> int main()
>> {
>> char ch;
>> if((ch=printf("")))
>> printf("it matters");
>> else
>> printf("it doesn't matter");
>> return 0;
>> }
>>
>>
>> what will b the output??
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>
>
> --
> Aditi Garg
> Undergraduate Student
> Electronics & Communication Divison
> NETAJI SUBHAS INSTITUTE OF TECHNOLOGY
> Sector 3, Dwarka
> New Delhi
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from 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] output?

2011-08-09 Thread Jayanthi shravan
  it matters..
On Tue, Aug 9, 2011 at 10:20 PM, tech rascal wrote:

>
>
>
> what will b the output??
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
shravan

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

2011-08-09 Thread aditi garg
it doesnt matter

On Tue, Aug 9, 2011 at 10:20 PM, tech rascal wrote:

> #include
> int main()
> {
> char ch;
> if((ch=printf("")))
> printf("it matters");
> else
> printf("it doesn't matter");
> return 0;
> }
>
>
> what will b the output??
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
Aditi Garg
Undergraduate Student
Electronics & Communication Divison
NETAJI SUBHAS INSTITUTE OF TECHNOLOGY
Sector 3, Dwarka
New Delhi

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

2011-08-09 Thread tech rascal
#include
int main()
{
char ch;
if((ch=printf("")))
printf("it matters");
else
printf("it doesn't matter");
return 0;
}


what will b the output??

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

2011-08-09 Thread Decipher

Q1) How to find factorial of a number at pre-processor stage only ?

Q2) In C++ NULL is defined as* #define NULL 0* while in C it is defined as 
*#define 
NULL (void *) 0 . *What difference it makes ?

-- 
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/-/RLQTCpRt658J.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] output help

2011-08-09 Thread SANDEEP CHUGH
i dnt get it.. any better explanation..

On Tue, Aug 9, 2011 at 1:13 PM, dinesh bansal  wrote:

> On a little-endian machine, bit structure will be represented as:
>
>  0x00 00 00 45
>
> which is bit.bit4 = 0010 (2 in decimal) bit.bit3 = 0010 (2 in decimal)
> bit.bit1 = 1 (1 in decimal)
>
> since bit.bit1 exists at the rightmost position, while displaying data as
> integer, compiler just repeats the same bit to all the remaining positions
> making it 0x (-1). You can confirm it while setting bit.bit1 to 0
>
> -Dinesh Bansal
>
>
> On Tue, Aug 9, 2011 at 12:24 PM, Rohit Srivastava 
> wrote:
>
>> #include
>> #include
>>
>> int main()
>> {
>> struct value
>> {
>> int bit1:1;
>> int bit3:4;
>> int bit4:4;
>> }bit={1,2,2};
>> printf("%d %d %d\n",bit.bit1,bit.bit3,bit.bit4);
>> getche();
>> return 0;
>> }
>>  the above code gives output : -1 2 2
>> any idea why???
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>
>
> --
> Dinesh Bansal
> The Law of Win says, "Let's not do it your way or my way; let's do it the
> best way."
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

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

2011-08-09 Thread Piyush Kapoor
hello

On Tue, Aug 9, 2011 at 9:47 PM, sagar pareek  wrote:

> How are you?
>
>
> On Tue, Aug 9, 2011 at 8:53 PM, arvind kumar  wrote:
>
>> hi
>>
>>
>> On Tue, Aug 9, 2011 at 8:24 PM, prashant gautam <
>> prashantgautam@gmail.com> wrote:
>>
>>> hello
>>>
>>>  --
>>> You received this message because you are subscribed to the Google Groups
>>> "Algorithm Geeks" group.
>>> To post to this group, send email to algogeeks@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> algogeeks+unsubscr...@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>
>
> --
> **Regards
> 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.
>



-- 
*Regards,*
*Piyush Kapoor,*
*2nd year,CSE
IT-BHU*

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] c question!

2011-08-09 Thread siddharth srivastava
>
> @sidharth: thanks a lot for correcting me :)
> @aditya : no. there was some mistake;
>
> in the code i pasted above it's giving segmentation fault. Is it cause i'm
> initializing h without using malloc??
> Please throw light on this problem
>

Pointer points to a location in memory. You can't use h without making h to
reference to some area in memory.



> And in the following code
> char *s;
> scanf("%s", s);
> why isn't it possible to store a string in s??
>
> Please explain both concepts.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from 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] MS question

2011-08-09 Thread saurabh singh
its still buggy,,,.The problem is with the sprintf functionIt
appends *null character too.*I dont think you are taking this into
consideration.Write your own routine for the same.Its not a hard job and it
will be worth the effort.

Input:
acbaaxa

your program's output

acba2

*Just fix the sscanf thing.Shortcuts always lead to bugs...:)*
(Apologies if I am wrong)

On Tue, Aug 9, 2011 at 9:41 PM, sagar pareek  wrote:

> @saurabh
> ur all test cases have count for each character >9 thats why its
> overwriting the second digit 
>
> modified code is:-
>
> #include
> #include
>
> main()
> {
>  int i,j=0,l,count;
>  char str[100],tmp;
>
>  printf("Please enter the string\n");
>  fgets(str,100,stdin);
>
>  l=strlen(str);
>  tmp=str[0]; count=1;
>
>  for(i=1;i<=l;i++)
>  {
>if(tmp==str[i])
>{ count++; printf("count=%d\n",count); }
>else
>{  if(count==1) str[j++]=tmp; else{ str[j++]=tmp;
> sprintf(&str[j++],"%d",count); if(count>9) j++; } count=1; tmp=str[i]; }
>  }
>   //str[j++]=tmp; sprintf(&str[j++],"%d",count);
>   str[j]='\0';
>
>  printf("%s\n",str);
> }
>
>
> Now it has no bug
>
>
> On Tue, Aug 9, 2011 at 8:53 PM, Dipankar Patro wrote:
>
>> Here is my code:
>> http://ideone.com/deosU
>>
>> Same as that of Sagar's :D
>> time O(n) and space O(1)
>>
>>
>>
>> On 9 August 2011 20:25, siddharam suresh  wrote:
>>
>>> saurabh
>>> test my program
>>> please tell me if any bug is there
>>> Thank you,
>>> Siddharam
>>>
>>>
>>>
>>> On Tue, Aug 9, 2011 at 8:18 PM, saurabh singh wrote:
>>>
 The code failed for all test cases I tried.


 On Tue, Aug 9, 2011 at 8:15 PM, ankit sambyal 
 wrote:

> ya got it now. I misunderstood the question
>
> --
> You received this message because you are subscribed to the Google
> Groups "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



 --
 Saurabh Singh
 B.Tech (Computer Science)
 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.

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



-- 
Saurabh Singh
B.Tech (Computer Science)
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] solve this!

2011-08-09 Thread Prakash D
yeah !! it should be the solution :)

On Tue, Aug 9, 2011 at 9:31 PM, programming love <
love.for.programm...@gmail.com> wrote:

> @prakash: Even i thought in the same way. But permutations are not being
> considered in
>
>  12C6* 6c3 * 6C2
>
> The ques asks for arrangements. Should we multiply by 6! * 6! (1 6! for
> each side)??
>
> is the answer
> 12C6* 6c3 * 6C2 * 6! * 6!??
>
> On Tue, Aug 9, 2011 at 9:22 PM, Prakash D  wrote:
>
>> the solution will be 12C6* 6c3 * 6C2
>>
>> because if you choose 6 people for the left side, then there is no option
>> for the right side(i.e. we can select only the remaining 6 people for right
>> side)
>>
>> also this 12C6 will provide all possible combinations for choosing 6
>> members for left or right and there is no need to add these both since this
>> 12C6 include all those possibilities. Correct me if i am wrong
>>
>>
>> On Tue, Aug 9, 2011 at 5:21 PM, sagar pareek wrote:
>>
>>> yeah
>>> sorry  one 2 will be used for either side then auto left and right will
>>> be fixed.
>>> thanks for correction
>>>
>>>
>>> On Tue, Aug 9, 2011 at 4:39 PM, programming love <
>>> love.for.programm...@gmail.com> wrote:
>>>
 got it!
 @sagar there shudn be 2's anywhere in the expression.
 The different combinations formed on the left hand side by choosing 6
 out of 12 will ensure different combinations of other 6 people on the 
 right.
 So 2*12C6 is not required.
 Example:
 P1,P3,P5,P7,P9, P11
 on left will leave
 P2, P4, P6, P8, P10 and P12 on right.
 If 2*12C6 is done, this combination is counted again.

 Please correct me if i'm wrong.
  --
 You received this message because you are subscribed to the Google
 Groups "Algorithm Geeks" group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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.
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from 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: max product!

2011-08-09 Thread Prakash D
cool.. i was lazy to look at your code :P

On Tue, Aug 9, 2011 at 9:32 PM, WgpShashank wrote:

> @CEG thats what i explained in given link dude isn't it :)
>
> @punnu & some others we need to find 3 Maxs & 2 Mins in 5 passes over array
> we can do it in single pass it self as explained in link time complexity
> will remain O(N) & single pass over over array .Do notify if still anything
> wrong direct through mail ?
>
>
>
> Thanks
> Shashank Mani
> Computer Science
> Birla Institute of Technology,Mesra
>
>  --
> 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/-/dhEutSsXWvMJ.
>
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from 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: Probability Puzzle

2011-08-09 Thread ritu
The statement "You randomly pulled one coin from the bag and tossed"
tells that all the  events of tossing the coin are independent hence
ans is 3/5

On Aug 7, 10:34 pm, Algo Lover  wrote:
> A bag contains 5 coins. Four of them are fair and one has heads on
> both sides. You randomly pulled one coin from the bag and tossed it 5
> times, heads turned up all five times. What is the probability that
> you toss next time, heads turns up. (All this time you don't know you
> were tossing a fair coin or not).

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

2011-08-09 Thread sagar pareek
How are you?

On Tue, Aug 9, 2011 at 8:53 PM, arvind kumar  wrote:

> hi
>
>
> On Tue, Aug 9, 2011 at 8:24 PM, prashant gautam <
> prashantgautam@gmail.com> wrote:
>
>> hello
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



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



Re: [algogeeks] MS question

2011-08-09 Thread sagar pareek
@saurabh
ur all test cases have count for each character >9 thats why its overwriting
the second digit 

modified code is:-
#include
#include

main()
{
 int i,j=0,l,count;
 char str[100],tmp;

 printf("Please enter the string\n");
 fgets(str,100,stdin);

 l=strlen(str);
 tmp=str[0]; count=1;

 for(i=1;i<=l;i++)
 {
   if(tmp==str[i])
   { count++; printf("count=%d\n",count); }
   else
   {  if(count==1) str[j++]=tmp; else{ str[j++]=tmp;
sprintf(&str[j++],"%d",count); if(count>9) j++; } count=1; tmp=str[i]; }
 }
  //str[j++]=tmp; sprintf(&str[j++],"%d",count);
  str[j]='\0';

 printf("%s\n",str);
}


Now it has no bug

On Tue, Aug 9, 2011 at 8:53 PM, Dipankar Patro  wrote:

> Here is my code:
> http://ideone.com/deosU
>
> Same as that of Sagar's :D
> time O(n) and space O(1)
>
>
>
> On 9 August 2011 20:25, siddharam suresh  wrote:
>
>> saurabh
>> test my program
>> please tell me if any bug is there
>> Thank you,
>> Siddharam
>>
>>
>>
>> On Tue, Aug 9, 2011 at 8:18 PM, saurabh singh wrote:
>>
>>> The code failed for all test cases I tried.
>>>
>>>
>>> On Tue, Aug 9, 2011 at 8:15 PM, ankit sambyal wrote:
>>>
 ya got it now. I misunderstood the question

 --
 You received this message because you are subscribed to the Google
 Groups "Algorithm Geeks" group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.

>>>
>>>
>>>
>>> --
>>> Saurabh Singh
>>> B.Tech (Computer Science)
>>> 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.
>>>
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from 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
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from 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.



Re: [algogeeks] c question!

2011-08-09 Thread rohit jangid
when you declared " h" it contains garbage address . h->a is meaningless .
read pointers chapter from K nd R for full details about pointers in C .
 On Aug 9, 2011 9:11 PM, "programming love" 
wrote:
> #includetypedef struct {char * a;
> }*nodeptr;
> main(){nodeptr h;h->a="programming";printf("hi %s\n", h->a);}
>
> @sidharth: thanks a lot for correcting me :)
> @aditya : no. there was some mistake;
>
> in the code i pasted above it's giving segmentation fault. Is it cause i'm
> initializing h without using malloc??
> Please throw light on this problem
> And in the following code
> char *s;
> scanf("%s", s);
> why isn't it possible to store a string in s??
>
> Please explain both concepts.
>
> --
> You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from 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: max product!

2011-08-09 Thread WgpShashank
@CEG thats what i explained in given link dude isn't it :)

@punnu & some others we need to find 3 Maxs & 2 Mins in 5 passes over array 
we can do it in single pass it self as explained in link time complexity 
will remain O(N) & single pass over over array .Do notify if still anything 
wrong direct through mail ?



Thanks 
Shashank Mani
Computer Science
Birla Institute of Technology,Mesra

-- 
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/-/dhEutSsXWvMJ.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] solve this!

2011-08-09 Thread programming love
@prakash: Even i thought in the same way. But permutations are not being
considered in

12C6* 6c3 * 6C2

The ques asks for arrangements. Should we multiply by 6! * 6! (1 6! for each
side)??

is the answer
12C6* 6c3 * 6C2 * 6! * 6!??

On Tue, Aug 9, 2011 at 9:22 PM, Prakash D  wrote:

> the solution will be 12C6* 6c3 * 6C2
>
> because if you choose 6 people for the left side, then there is no option
> for the right side(i.e. we can select only the remaining 6 people for right
> side)
>
> also this 12C6 will provide all possible combinations for choosing 6
> members for left or right and there is no need to add these both since this
> 12C6 include all those possibilities. Correct me if i am wrong
>
>
> On Tue, Aug 9, 2011 at 5:21 PM, sagar pareek wrote:
>
>> yeah
>> sorry  one 2 will be used for either side then auto left and right will be
>> fixed.
>> thanks for correction
>>
>>
>> On Tue, Aug 9, 2011 at 4:39 PM, programming love <
>> love.for.programm...@gmail.com> wrote:
>>
>>> got it!
>>> @sagar there shudn be 2's anywhere in the expression.
>>> The different combinations formed on the left hand side by choosing 6 out
>>> of 12 will ensure different combinations of other 6 people on the right. So
>>> 2*12C6 is not required.
>>> Example:
>>> P1,P3,P5,P7,P9, P11
>>> on left will leave
>>> P2, P4, P6, P8, P10 and P12 on right.
>>> If 2*12C6 is done, this combination is counted again.
>>>
>>> Please correct me if i'm wrong.
>>>  --
>>> You received this message because you are subscribed to the Google Groups
>>> "Algorithm Geeks" group.
>>> To post to this group, send email to algogeeks@googlegroups.com.
>>> To unsubscribe from 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.
>

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

2011-08-09 Thread Don
tree closestSharedAncestor(tree root, tree node1, tree node2, int
&result)
{
  tree returnValue = 0;

  if (root)
  {
if (root == node1) result += 1;
if (root == node2) result += 2;
int sum = 0;
tree returnLeft = closestSharedAncestor(root->left, node1, node2,
sum);
if (returnLeft) returnValuet = returnLeft;
else
{
  tree returnRight = closestSharedAncestor(root->right, node1,
node2, sum);
  if (returnRight) returnValue = returnRight;
  else if (sum == 3) returnValue = root;
}
result += sum;
  }
  return returnValue;
}

On Aug 9, 9:56 am, Raman  wrote:
> Can anyone give me the recursive algo to find closest ancestor of two nodes
> in a tree(not a BST).

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] solve this!

2011-08-09 Thread Prakash D
the solution will be 12C6* 6c3 * 6C2

because if you choose 6 people for the left side, then there is no option
for the right side(i.e. we can select only the remaining 6 people for right
side)

also this 12C6 will provide all possible combinations for choosing 6 members
for left or right and there is no need to add these both since this 12C6
include all those possibilities. Correct me if i am wrong


On Tue, Aug 9, 2011 at 5:21 PM, sagar pareek  wrote:

> yeah
> sorry  one 2 will be used for either side then auto left and right will be
> fixed.
> thanks for correction
>
>
> On Tue, Aug 9, 2011 at 4:39 PM, programming love <
> love.for.programm...@gmail.com> wrote:
>
>> got it!
>> @sagar there shudn be 2's anywhere in the expression.
>> The different combinations formed on the left hand side by choosing 6 out
>> of 12 will ensure different combinations of other 6 people on the right. So
>> 2*12C6 is not required.
>> Example:
>> P1,P3,P5,P7,P9, P11
>> on left will leave
>> P2, P4, P6, P8, P10 and P12 on right.
>> If 2*12C6 is done, this combination is counted again.
>>
>> Please correct me if i'm wrong.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from 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.



Re: [algogeeks] DBMS

2011-08-09 Thread Bipin kumar yadav
it should be 2^(m-1)-1

because in given m elements 1 element should be primary key, which will
combined with other attributes to form super key.
so there will be 2^(m-1) such subset now we subtract 1 for the phi.so this
should be 2^(m-1)-1.


correct me if i m wrong,,,

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] c question!

2011-08-09 Thread programming love
#includetypedef struct {char * a;
}*nodeptr;
main(){nodeptr h;h->a="programming";printf("hi %s\n", h->a);}

@sidharth: thanks a lot for correcting me :)
@aditya : no. there was some mistake;

in the code i pasted above it's giving segmentation fault. Is it cause i'm
initializing h without using malloc??
Please throw light on this problem
And in the following code
char *s;
scanf("%s", s);
why isn't it possible to store a string in s??

Please explain both concepts.

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Amazon question.

2011-08-09 Thread programming love
*Executing code with printf's for each iteration for better understanding.*


#include
main(){

int n, i, j, k, t1=0, t2=0, t3, a[30];
printf("Enter the number of elements\n");
scanf("%d", &n);
for(i=0; i=0;k--){

printf("iteration %d\n", t2);
for(j=k,i=0;(ihttp://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Re: need a pgm pls help me

2011-08-09 Thread Don
#include 
#include 

int main()
{
  char inFileName[80];
  char outFileName[80];
  int numSegments;
  int bytesPerSegment;

  printf("Enter file name:");
  fgets(inFileName,80,stdin);
  printf("Enter number of segments:");
  scanf("%d", &numSegments);

  FILE *f = fopen(inFileName, "rb");
  if (!f) return 0;

  // Get size of file to determine bytes per file segment
  fseek(f, 0, SEEK_END);
  int bytesPerSegment = 1 + (ftell(f) / numSegments);
  fseek(f,0,SEEK_SET);
  char *buffer = (char *)malloc(bytesPerSegment);
  for(int segment = 0; segment < numSegments; ++segment)
  {
sprintf(outFileName,"%s%d", inFileName,segment);
FILE *out = fopen(outFileName,"wb");
int len=fread(buffer, bytesPerSegment, 1, f);
fwrite(buffer, len, 1, out);
fclose(out);
  }
  return 1;
}

On Aug 9, 7:28 am, Divya Elangovan  wrote:
> pls help me..its very urgent
>
> need a program to divide a file into equal parts(segments)
>
> --
>
> *
>             **
> *
> *      **        **DIVI*

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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: Fwd: [algogeeks] Re: recursive nearest square

2011-08-09 Thread Ankuj Gupta
My bad but it can be made recursive :)

On Aug 9, 8:17 pm, Dave  wrote:
> @Ankuj: Yeah, but he asked for it to be recursive. Yours is iterative.
>
> Dave
>
> On Aug 9, 9:56 am, Ankuj Gupta  wrote:
>
>
>
>
>
>
>
> > we can do it in logn by using binary search approach found
> > n is the number whose square root has to be
>
> >         if(n==1)
> >                 return 1;
> >         if(n==0)
> >                 return 0;
> >         int low=0,high=n/2,mid,temp;
> >         while(1)
> >         {
> >                 mid = (low+high)/2;
> >                 temp = mid*mid;
> >                 if(temp==n)
> >                         return 1;
> >                 else if(temp  >                         low = mid+1;
> >                 else
> >                         high = mid-1;
> >                 if(low == mid || high == mid)
> >                         return 0;
> >         }
> > at the end high will have the required square root if not perfect
> > square or if perfect square mid will have the required answer

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

2011-08-09 Thread aditi garg
for software the technical ppr(frst round) is mcq or subjective?

On Tue, Aug 9, 2011 at 7:23 PM, Decipher  wrote:

> I applied to Texas Instruments last year for software profile and these are
> some of the questions that were asked in interview round :
>
> 1) How to find least common ancestor of two nodes in a tree ?
> 2) Some questions on virtual table and vptr ? Is Vtable created per class
> or per object ?
> 3) Some questions about code section , data section , linking and OS
> related concepts ?
>
> The written test was repeated according to some people who had applied
> earlier and consisted of Aptitude and Technical questions (separate tests
> for both) . I was able to answer many questions so was shortlisted for
> interview and later on for HR also . Although since I had applied off -
> campus they told me that results will be declared after the procedure is
> completed in other cities . And after 2 months they told me that there would
> be 1 telephonic interview if I am still interested in TI . But since I had
> already joined somewhere else I rejected the offer .
>
> Reply here if you still have any doubt !!
>
> --
> 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/-/7DNiCyE4TsoJ.
>
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
Aditi Garg
Undergraduate Student
Electronics & Communication Divison
NETAJI SUBHAS INSTITUTE OF TECHNOLOGY
Sector 3, Dwarka
New Delhi

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

2011-08-09 Thread Dipankar Patro
Here is my code:
http://ideone.com/deosU

Same as that of Sagar's :D
time O(n) and space O(1)


On 9 August 2011 20:25, siddharam suresh  wrote:

> saurabh
> test my program
> please tell me if any bug is there
> Thank you,
> Siddharam
>
>
>
> On Tue, Aug 9, 2011 at 8:18 PM, saurabh singh  wrote:
>
>> The code failed for all test cases I tried.
>>
>>
>> On Tue, Aug 9, 2011 at 8:15 PM, ankit sambyal wrote:
>>
>>> ya got it now. I misunderstood the question
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "Algorithm Geeks" group.
>>> To post to this group, send email to algogeeks@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> algogeeks+unsubscr...@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>>
>>
>> --
>> Saurabh Singh
>> B.Tech (Computer Science)
>> 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.
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from 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

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

2011-08-09 Thread arvind kumar
hi

On Tue, Aug 9, 2011 at 8:24 PM, prashant gautam <
prashantgautam@gmail.com> wrote:

> hello
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] c question!

2011-08-09 Thread rohit jangid
a new pointer type that can store the address of such structure

for example

nodeptr p;

will declare a pointer to that struct
but it is useless for me.
On Aug 9, 2011 8:19 PM, "programming love" 
wrote:
> @rohith, what if that statement is removed. Now, what will nodeptr stand
> for?
>
> On Tue, Aug 9, 2011 at 8:09 PM, rohit jangid 
wrote:
>
>> it will give error in line 3 because nodeptr is undefined till that
point..
>>
>> On Aug 9, 2011 8:03 PM, "programming love" <
love.for.programm...@gmail.com>
>> 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.
>>
>
> --
> You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from 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++ heap vs stack

2011-08-09 Thread siddharth srivastava
On 9 August 2011 10:32, Mohit Goel  wrote:

>
>
> what the reason behind it how do they differ in functonality..?



Here is a good and short expl:
http://ee.hawaii.edu/~tep/EE160/Book/chap14/subsection2.1.1.8.html

>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



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



  1   2   >