Re: [algogeeks] Re: MICROSOFT WRITTEN

2011-10-02 Thread Varun Jakhoria
return (((-1+!x)y) | ((-1+!!x)z)) ;


On Sun, Oct 2, 2011 at 3:18 PM, ravi maggon maggonr...@gmail.com wrote:
 How about this answer:
 b?z:y

 int main() {
     int a=0,b,y=4,z=5,k;
     cinb;
     k=(((b+~a+1)7)1);//k will either be 0 or 1
     cout (z-int((bool)k(z-y)));
     return 0;
 }

 On Mon, Sep 12, 2011 at 5:32 PM, beginner shubh2...@gmail.com wrote:

 although multiplication operator is not allowed..
 but it's an attempt to write shorter...

 c++ implementation-

 int cond(int x, int y, int z){
  return  y*(int)((bool)x)+z*(1+(~(int)((bool)x)+1));
 }

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



 --
 Regards
 Ravi Maggon
 B.E. CSE, Final Year
 Thapar University

 www.algorithmguru.com

 Failure is the opportunity to begin again more intelligently

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

2011-08-12 Thread Varun Jakhoria
i didn't tried it  .. but it might  be internal conversion only , like
whenever we do +1 to the address of int it automatically convert it
into +4(i.e int size)

On Fri, Aug 12, 2011 at 11:34 AM, rohit rajuljain...@gmail.com wrote:

 int main()
 {
 int a[5]={1,2,3,4,5};
 printf(%d,a[4]-a[0])
 }
 why it show 4 not 16?

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

On Tue, Aug 9, 2011 at 10:24 PM, Jayanthi shravan
jayanthisra...@gmail.com wrote:

   it matters..
 On Tue, Aug 9, 2011 at 10:20 PM, tech rascal techrascal...@gmail.com
 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] 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
rahulraghavend...@gmail.com 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.



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 dondod...@gmail.com wrote:
 #include stdio.h
 #include stdlib.h

 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 divistyl...@gmail.com 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.



Re: [algogeeks] pls help

2011-08-05 Thread Varun Jakhoria
I think it can be done using bitwise ANDing with a mask

On Fri, Aug 5, 2011 at 12:58 PM, Gaurav Menghani
gaurav.mengh...@gmail.com wrote:
 An Implementation:

 #includeiostream
 #includestring
 using namespace std;

 string alphabet;
 int maxlen;
 void backtrack(string s,int l)
 {
  if(l==maxlen) { coutsendl; return; }
  s.push_back('-');
  for(int i=0;ialphabet.size();i++)
        { s[l]=alphabet[i]; backtrack(s,l+1); }
 }

 int main()
 {
  maxlen=3;
  alphabet=op;
  backtrack(,0);
  return 0;
 }


 On Fri, Aug 5, 2011 at 12:42 PM, Kamakshii Aggarwal
 kamakshi...@gmail.com wrote:
 @gaurav:i could not understand ur sol.can u explain it again..

 On Fri, Aug 5, 2011 at 12:32 PM, Gaurav Menghani gaurav.mengh...@gmail.com
 wrote:

 On Fri, Aug 5, 2011 at 12:20 PM, Kamakshii Aggarwal
 kamakshi...@gmail.com wrote:
  given a set of letters and a length N, produce all possible output.(Not
  permutation). For example, give the letter (p,o) and length of 3,
  produce
  the following output(in any order you want, not just my example order)
 
  ppp ppo poo pop opp opo oop ooo
 
  another example would be given (a,b) and length 2
 
  answer: ab aa bb ba
 
  --
  Regards,
  Kamakshi
  kamakshi...@gmail.com

 This can be done easily by backtracking

 void backtrack(string s, int l)
 {
   if(l == maxlen) { coutsendl; return; }

   s.push_back('-');
   for(int i=0;ialphabet.size();i++)
   {
     s[l]=alphabet[i];
     backtrack(s,l+1);
   }
 }

 --
 Gaurav Menghani

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




 --
 Gaurav Menghani

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