Re: [algogeeks] NIT Kurukshetra presents Online programming contest- ENCODER

2012-02-22 Thread Mohit Goel
check it now ... register your team  and engage  in codewar ..

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

2011-09-07 Thread Mohit Goel
How many processes are created in this snippet?
Main()
{
Fork();
Fork()  fork () || fork ();
Fork ();
}

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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-09-07 Thread Mohit Goel
a. 15
b. 19
c. 21
d. 27
e. 31
these are the only options.

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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-09-07 Thread Mohit Goel
20 is not in option ..so whats the 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] os

2011-09-07 Thread Mohit Goel
thnks everyone...

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

2011-09-05 Thread Mohit Goel
1) #include stdio.h
   #include stdlib.h

   #define SIZEOF(arr) (sizeof(arr)/sizeof(arr[0]))

   #define PrintInt(expr) printf(%s:%d\n,#expr,(expr))
   int main ()
  {
   /* The powers of 10 */
   int pot[] = {
0001,0010,0100,1000

   };
   int i;

   for(i=0;iSIZEOF(pot);i++)
   PrintInt(pot[i]);
   return 0;
  }

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

2011-09-05 Thread Mohit Goel
got it ..!! thnks everyone

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

2011-09-05 Thread Mohit Goel
1) #include stdio.h
   #define PrintInt(expr) printf(%s : %d\n,#expr,(expr))
   int max(int x, int y)
  {
   (x  y) ? return x : return y;
  }

   int main ()
  {
   int a = 10, b = 20;
PrintInt(a);
PrintInt(b);
PrintInt(max(a,b));
  }

2#include stdio.h
  void foo(const char **p) { }
   int main (int argc, char **argv)
  {
 foo(argv);
return 0;
  }
i  think sending a normal pointer to a function
requiring const pointer does not give any warning..but it still giving an
error

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



Re: [algogeeks] Re: Given an array A[] and a integer num. Find four no.s in the array whose sum is equal to given num.

2011-08-28 Thread Mohit Goel
This code may also work .give any counter examples...


#includeiostream
using namespace std;
void  find_sum(int num,int k,int j,int b);
 void display(int i,int j);
#define MAX 8

int res[4];   //array to store
4 numbers..
int arr[MAX] ={2,3,4,1,6,9,8,10};
int main()
{
int b,k,j,num;
coutenter desired number\n;
cinnum;
k=0;
j=b=0;
find_sum(num,k,j,b);


return 0;
}
void  find_sum(int num,int k,int j,int b)
{
int p,i;
if(k MAX)
{
if(j==3  arr[k]== num )
{
res[b]=arr[k];
display(0,b);  //FOUND 4 NUMBER ,PRINT THEM

}
else if(j == 3  arr[k]!=num)
{
for(p=k+1;pMAX;p++)
{
if(arr[p] == num)
{
res[b] =arr[p];
 display(0,b); //FOUND 4 NUMBER ,PRINT THEM

break;


}
}


}
else
{
for(i=k;iMAX;i++)
{
res[b] =arr[i];
find_sum(num-arr[i],i+1,j+1,b+1);

}
}
}
}

void display(int i,int j)
{
cout\n;
int k;
for(k=0;k=j;k++)
cout res[k];
}

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] how to find K most significant digit of a number..???

2011-08-13 Thread Mohit Goel


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

2011-08-13 Thread Mohit Goel
there are 5 possibilities ..5th one is_12_..other as specified by
ankit...


t(1) =2  (it can directly jump to anathor bank)
t(2) =3 ( _2_,_1_,_12_)

t(3) =5...
thats how fibonnaci goes on plz correct if 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] Re: Microsoft written!!!

2011-08-10 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.



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

2011-08-10 Thread Mohit Goel
@muthu raj:
it will also come out ,when loop condition will not be statisfied.i.e when
'p' is not the right child of its parent...in such a case it will not reach
root ..
in the ex given by u   it will stop at 4 .

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

2011-08-08 Thread Mohit Goel
#includestdio.h
#includeconio.h
struct abc
{
   char p[1];
};
int main()
{
struct abc *c =NULL;
 char name[]=abcde;
 c = (struct abc *) malloc (sizeof(struct abc));

 strcpy(c-p,name);
 printf(%s,c-p);
 getch();
 return 0;
}
why it is printing the whole string abcde..there is not enough memory
in array 'p'...

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

2011-08-08 Thread Mohit Goel
In c++ we should allocate the memory for the object on the stack or on the
heap? what effect it will have on the program .

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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-08 Thread Mohit Goel
what the reason behind it how do they differ in functonality..?

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] MICROSOFT INTERVIEW QUESTIONS faced by my frenz nd me

2011-08-07 Thread Mohit Goel
can anyone one explain output of question 1.

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

2011-08-03 Thread Mohit Goel
hey guys
does anyone know about WINSHUTTLE...its coming to ur campus...

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

2011-07-30 Thread Mohit Goel
yes ..u  r right ...thnks...

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



[algogeeks] finding element in rotated array

2011-07-29 Thread Mohit Goel
Given   a  sorted   array   of   n   integers   that   has   been
rotated   an   unknown   number   of
times, give an O(log n) algorithm that finds an element in the
array  You may assume
that the array was originally sorted in increasing order

EXAMPLE:

Input: find 5 in array (15 16 19 20 25 1 3 4 5 7 10 14)

Output: 8 (the index of 5 in the array)

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

2011-07-29 Thread Mohit Goel
but this works ,if array is rotated multiple times ,around different
pivots.

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

2011-07-02 Thread mohit goel
May be this can work.give any counter example...
int count;
main()
{
  int l,rope,cuts;
  scanf(%d%d,l,rope);
  count =0;

   find_cuts(l,rope);
   printf(cuts needed is %d,count);
   getch();
   return 0;
   }

 int find_cuts(int l,int rope)

 {

if(l==rope)
return count;
 count++;
 printf(%d,count);
 l=l/2;
 if(l==rope)
 return count;
 if(ropel)
 rope =rope-l;

 find_cuts(l,rope);

 }

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