Re: [algogeeks] Math Quiz

2011-08-21 Thread Vinuta J
Hey, can u pls explain the 1st statement.. 4*f(OED)=f(OBC)  --- from 
similarity ?

Y is it 4 times??

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



Re: [algogeeks]

2011-08-21 Thread muthu raj
Segregate the Odd and even nodes in the list by traversing in O(n). Then
print the resulting list in O(n). So no additional space required and
solution in O(n) time also :)
*Muthuraj R
IV th Year , ISE
PESIT , Bangalore*



On Fri, Aug 19, 2011 at 9:48 AM, priya ramesh 
love.for.programm...@gmail.com wrote:

 +1 sagar! i too have the same 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.


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

2011-08-21 Thread Puneet Chawla
If a,b are not equal then this statement will always return true status as
a^b=true so true bit-wise or-ed with anyone will return true.

On Sun, Aug 21, 2011 at 10:38 AM, SHUBHAM BANSAL
shubham.bans...@gmail.comwrote:

 ((a^b) | ((ab)1))
 sorry tht was bitwise or..by mistak i hd wrote logicl or
 SHUBHAM BANSAL
 COMP DEPT..
 NIT KKr



 On Sun, Aug 21, 2011 at 9:30 AM, Sanjay Rajpal srn...@gmail.com wrote:

 Yes if a or b are non zero, the result is always 1.
 Sanju
 :)



 On Sat, Aug 20, 2011 at 8:57 PM, Naman Mahor naman.ma...@gmail.comwrote:

 @sanjay
 assume that the value of a=0,b=0;
 so a^b=0
 and (ab)1 =0
 so answer will zero.
 so the result will not always 1. it can be 0 or 1 depends on the value of
 a n b.


 On Sun, Aug 21, 2011 at 12:12 AM, Sanjay Rajpal srn...@gmail.comwrote:

  || is a short-circuit operator(LOGICAL OR).

 if first condition is true, then second is not evaluated, only if first
 is false, second is evaluated.

 If a==b, then second condition will evaluate to true, else first
 condition will be evaluated, which are true here both.

 So the result is always 1.
 Sanju
 :)



 On Sat, Aug 20, 2011 at 11:37 AM, Atul Modi atul.a...@gmail.comwrote:

 || is not bitwise or...it is logical orso it is basically for the
 two ops (a^b) being succesful n (ab)1 returning 1 on successthus 
 the
 ans. is 1 i think

 On Sat, Aug 20, 2011 at 11:59 PM, Aditya Virmani 
 virmanisadi...@gmail.com wrote:

 @priya..wht if a=b=0 ? or a=b= 1000 

  On Sat, Aug 20, 2011 at 11:33 PM, priya ramesh 
 love.for.programm...@gmail.com wrote:

 the answer is 1
 sum=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.


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


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


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


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


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


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




-- 
With regards
  
Puneet Chawla
Computer Engineering Student
NIT Kurukshetra

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

2011-08-21 Thread Greeshma
hey how is area of ECD = 6?
EC is not a diagonal so its not 6

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

2011-08-21 Thread Puneet Chawla
only M is married.

On Sat, Aug 20, 2011 at 7:53 PM, Arun Vishwanathan
aaron.nar...@gmail.comwrote:

 @DK:if L is married to M according to you finally , then what does the
 third if then statement according to you mean when it is given that if L is
 not married then M is married?


 On Fri, Aug 19, 2011 at 10:35 PM, Dave dave_and_da...@juno.com wrote:

 @DK: What in the statement of the problem led you to believe that
 these were if-then statements?

 Dave

 On Aug 19, 3:15 pm, DK divyekap...@gmail.com wrote:
  Note that in the answer above, the table given is of the form:
 
  If condition is truethen what predicate is true
  -----
  M - married   N - not married
  N - married   L - not married
  L - not married  M - married
 
  --
  DK
 
 
 http://gplus.to/divyekapoorhttp://twitter.com/divyekapoorhttp://www.divye.in

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




 --
  People often say that motivation doesn't last. Well, neither does
 bathing - that's why we recommend it daily.

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




-- 
With regards
  
Puneet Chawla
Computer Engineering Student
NIT Kurukshetra

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

2011-08-21 Thread Greeshma
hey got it!
the ans s 2 :)

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

2011-08-21 Thread Sanjay Rajpal
see array is sorted when all zeros occur before 1s in each row.

Now see ur input. My algo will work only for sorted array.

On 8/20/11, rashmi i rash...@gmail.com wrote:
 will your solution work for:
 0001
 0010
 0100
 0110
 1000


 On Sun, Aug 21, 2011 at 10:29 AM, sachin sabbarwal sweetsachin...@gmail.com
 wrote:

 yes ,your example is sorted.

 On Sun, Aug 21, 2011 at 10:24 AM, Jagannath Prasad Das
 jpdasi...@gmail.com wrote:
  what does sorted row means???
  is it
  00011
  0
  1
  0
  where each row is sorted or among the rows also?
  On Sun, Aug 21, 2011 at 9:51 AM, Sanjay Rajpal srn...@gmail.com wrote:
 
  hey see this array is not sorted, I forgot to mention this in my first
  post, but cleared this in subsequent posts that the rows in the array
 are
  sorted.
 
  Plz see above posts.
  Sanju
  :)
 
 
 
  On Sat, Aug 20, 2011 at 9:05 PM, Abhishek 
 mailatabhishekgu...@gmail.com
  wrote:
 
  will this solution also work for..
 
  
  0101
  1011
  11010100
  0100
  1001
  0111
  
  plz clear your logic bit more..
 
  --
  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/-/A8HrLEBIIF8J.
  To post to this group, send email to algogeeks@googlegroups.com.
  To unsubscribe from 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.
 



 --
 Sachin Sabbarwal
 Nit Kurukshetra
 III year

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




 --
 R@$!-!
 DoN'T LimIt Ur cHaLlEngeS, ChAlLenGe uR LImItS.

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




-- 
Sanju
:)

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

2011-08-21 Thread Sanjay Rajpal
I think it will not be an error.

This is because X() will create a temporary object, and when the
object is returned in the function calling it, then default copy
constructor will do bitwise copy of data members in the calling
function.

Correct me if m wrong.

On 8/20/11, sachin sabbarwal algowithsac...@gmail.com wrote:
 class X()
 {

 X()
 {
 }



 X fun()
 {
 return X();  //error or what?? because constructor never returns
 anything so what this return statement will receive after executing x() and
 what it will return??
 }


 };

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




-- 
Sanju
:)

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

2011-08-21 Thread Puneet Chawla
It will show error

On Sun, Aug 21, 2011 at 12:21 PM, Sanjay Rajpal srn...@gmail.com wrote:

 I think it will not be an error.

 This is because X() will create a temporary object, and when the
 object is returned in the function calling it, then default copy
 constructor will do bitwise copy of data members in the calling
 function.

 Correct me if m wrong.

 On 8/20/11, sachin sabbarwal algowithsac...@gmail.com wrote:
  class X()
  {
 
  X()
  {
  }
 
 
 
  X fun()
  {
  return X();  //error or what?? because constructor never returns
  anything so what this return statement will receive after executing x()
 and
  what it will return??
  }
 
 
  };
 
  --
  You received this message because you are subscribed to the Google Groups
  Algorithm Geeks group.
  To post to this group, send email to algogeeks@googlegroups.com.
  To unsubscribe from this group, send email to
  algogeeks+unsubscr...@googlegroups.com.
  For more options, visit this group at
  http://groups.google.com/group/algogeeks?hl=en.
 
 


 --
 Sanju
 :)

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




-- 
With regards
  
Puneet Chawla
Computer Engineering Student
NIT Kurukshetra

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

2011-08-21 Thread Abhishek Yadav
But if you try making a copy constructor of your own and check whether it is
called or not.it does not.

On Sun, Aug 21, 2011 at 12:21 PM, Sanjay Rajpal srn...@gmail.com wrote:

 I think it will not be an error.

 This is because X() will create a temporary object, and when the
 object is returned in the function calling it, then default copy
 constructor will do bitwise copy of data members in the calling
 function.

 Correct me if m wrong.

 On 8/20/11, sachin sabbarwal algowithsac...@gmail.com wrote:
  class X()
  {
 
  X()
  {
  }
 
 
 
  X fun()
  {
  return X();  //error or what?? because constructor never returns
  anything so what this return statement will receive after executing x()
 and
  what it will return??
  }
 
 
  };
 
  --
  You received this message because you are subscribed to the Google Groups
  Algorithm Geeks group.
  To post to this group, send email to algogeeks@googlegroups.com.
  To unsubscribe from this group, send email to
  algogeeks+unsubscr...@googlegroups.com.
  For more options, visit this group at
  http://groups.google.com/group/algogeeks?hl=en.
 
 


 --
 Sanju
 :)

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

2011-08-21 Thread Tushar Bindal
if the cyclist would have left on time, then in those 20 minutes, he would
have covered 4miles at a speed of 12miles/h
so he would have been 1 mile before station whereas train would have been 5
miles before as it is on its normal time, so no change in its position.
then, when the cyclist covers that 1 mile, the train covers 5 miles so that
both of them meet at the station.
thus, speed of the train = 5*speed of cyclist = 60 miles/hour

On Sun, Aug 21, 2011 at 12:19 PM, prasanth n nprasnt...@gmail.com wrote:

 @gupta:

 can you explain your answer?


 On Sun, Aug 21, 2011 at 1:50 AM, D!leep Gupta dileep.smil...@gmail.comwrote:

 60mph

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




 --
 *prasanth*

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




-- 
Tushar Bindal
Computer Engineering
Delhi College of Engineering
Mob: +919818442705
E-Mail : tushicom...@gmail.com
Website: www.jugadengg.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.



[algogeeks] plzzzzzzzzzzz

2011-08-21 Thread jagrati verma
techendeavour is abt to visiting
so plz share some info.. abt written or interview.

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



Re: [algogeeks]

2011-08-21 Thread sukran dhawan
u mean dutch algorithm ?

On Sun, Aug 21, 2011 at 11:31 AM, muthu raj muthura...@gmail.com wrote:

 Segregate the Odd and even nodes in the list by traversing in O(n). Then
 print the resulting list in O(n). So no additional space required and
 solution in O(n) time also :)
 *Muthuraj R
 IV th Year , ISE
 PESIT , Bangalore*




 On Fri, Aug 19, 2011 at 9:48 AM, priya ramesh 
 love.for.programm...@gmail.com wrote:

 +1 sagar! i too have the same 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.


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

2011-08-21 Thread Puneet Chawla
class base
   {
   public:
   int bval;
   base(){bval=0;}
   };
class deri:public base
   {
   public:
   int dval;
   deri(){dval=1;}
   };
void SomeFunc(base *arr,int size)
{
for(int i=0; isize; i++,arr++)
   coutarr-bval;
coutendl;
}
int main()
{
base BaseArr[5];
SomeFunc(BaseArr,5);
deri DeriArr[5];
SomeFunc(DeriArr,5);
system(pause);
return 0;
}

0
01010
Will somebody tell me why it's showing this..??

-- 
With regards
  
Puneet

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

2011-08-21 Thread prasanth n
@tushar:

thanks

On Sun, Aug 21, 2011 at 12:27 PM, Tushar Bindal tushicom...@gmail.comwrote:

 if the cyclist would have left on time, then in those 20 minutes, he would
 have covered 4miles at a speed of 12miles/h
 so he would have been 1 mile before station whereas train would have been 5
 miles before as it is on its normal time, so no change in its position.
 then, when the cyclist covers that 1 mile, the train covers 5 miles so that
 both of them meet at the station.
 thus, speed of the train = 5*speed of cyclist = 60 miles/hour


 On Sun, Aug 21, 2011 at 12:19 PM, prasanth n nprasnt...@gmail.com wrote:

 @gupta:

 can you explain your answer?


 On Sun, Aug 21, 2011 at 1:50 AM, D!leep Gupta 
 dileep.smil...@gmail.comwrote:

 60mph

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




 --
 *prasanth*

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




 --
 Tushar Bindal
 Computer Engineering
 Delhi College of Engineering
 Mob: +919818442705
 E-Mail : tushicom...@gmail.com
 Website: www.jugadengg.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.




-- 
*prasanth*

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



Re: [algogeeks] c++

2011-08-21 Thread Abhishek Yadav
The code is correct..return X will make a temporary object and for that a
constructor and corresponding destructor will be called and that  object is
returned.

On Sun, Aug 21, 2011 at 12:24 PM, Puneet Chawla
puneetchawla...@gmail.comwrote:

 It will show error

 On Sun, Aug 21, 2011 at 12:21 PM, Sanjay Rajpal srn...@gmail.com wrote:

 I think it will not be an error.

 This is because X() will create a temporary object, and when the
 object is returned in the function calling it, then default copy
 constructor will do bitwise copy of data members in the calling
 function.

 Correct me if m wrong.

 On 8/20/11, sachin sabbarwal algowithsac...@gmail.com wrote:
  class X()
  {
 
  X()
  {
  }
 
 
 
  X fun()
  {
  return X();  //error or what?? because constructor never returns
  anything so what this return statement will receive after executing x()
 and
  what it will return??
  }
 
 
  };
 
  --
  You received this message because you are subscribed to the Google
 Groups
  Algorithm Geeks group.
  To post to this group, send email to algogeeks@googlegroups.com.
  To unsubscribe from this group, send email to
  algogeeks+unsubscr...@googlegroups.com.
  For more options, visit this group at
  http://groups.google.com/group/algogeeks?hl=en.
 
 


 --
 Sanju
 :)

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




 --
 With regards
   
 Puneet Chawla
 Computer Engineering Student
 NIT Kurukshetra

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

2011-08-21 Thread Naman Mahor
because the pointer of base class will move by 2 bytes every time but the
size of derived class is 4 byte.

On Sun, Aug 21, 2011 at 12:31 PM, Puneet Chawla
puneetchawla...@gmail.comwrote:

 class base
{
public:
int bval;
base(){bval=0;}
};
 class deri:public base
{
public:
int dval;
deri(){dval=1;}
};
 void SomeFunc(base *arr,int size)
 {
 for(int i=0; isize; i++,arr++)
coutarr-bval;
 coutendl;
 }
 int main()
 {
 base BaseArr[5];
 SomeFunc(BaseArr,5);
 deri DeriArr[5];
 SomeFunc(DeriArr,5);
 system(pause);
 return 0;
 }

 0
 01010
 Will somebody tell me why it's showing this..??

 --
 With regards
   
 Puneet

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

2011-08-21 Thread saurabh singh
kkk...not sure
assume no number is greater than 1000(I mentioned There has to be some
additional constraints to make the problem solvable)
Now check 1st element if not the desired element keep multiplying with 2 the
previous range till either one of these condition is satisfied
*1.An exception is caught*
*2.Number greater than 1000 occurs.*
suppose this happens for *1024 *for the given example.
then we will check out for (512+1024)/2 th element for the above condition.
If true than again branch like binary search.This way can element which on
left side doesn't gives any exception and maintains the constraints while on
the right it violates the same.So we may land up with the desired index and
can then perform binary search...

PS:There are lots of assumption in this approach and the more I write the
more I get convinced that its a plain stupid idea...


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

2011-08-21 Thread Puneet Chawla
Wil u please explain in context of o/p.means how 1 whn SomeFunc(DeriArr,5);
stmt is executed how 0 and 1 will come..???

On Sun, Aug 21, 2011 at 12:40 PM, Naman Mahor naman.ma...@gmail.com wrote:

 because the pointer of base class will move by 2 bytes every time but the
 size of derived class is 4 byte.


 On Sun, Aug 21, 2011 at 12:31 PM, Puneet Chawla puneetchawla...@gmail.com
  wrote:

 class base
{
public:
int bval;
base(){bval=0;}
};
 class deri:public base
{
public:
int dval;
deri(){dval=1;}
};
 void SomeFunc(base *arr,int size)
 {
 for(int i=0; isize; i++,arr++)
coutarr-bval;
 coutendl;
 }
 int main()
 {
 base BaseArr[5];
 SomeFunc(BaseArr,5);
 deri DeriArr[5];
 SomeFunc(DeriArr,5);
 system(pause);
 return 0;
 }

 0
 01010
 Will somebody tell me why it's showing this..??

 --
 With regards
   
 Puneet

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




-- 
With regards
  
Puneet

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



Re: [algogeeks]

2011-08-21 Thread Naman Mahor
#includeiostream
using namespace std;
class base
   {
   public:
   int bval;
   base(){bval=0;}
   };
class deri:public base
   {
   public:
   int dval;
   deri(){dval=1;}
   };
void SomeFunc(base *arr,int size)
{
for(int i=0; isize; i++,arr++)
{   coutarr-bvalendl;
 cout(arr-bval)endl;

}
coutendl;
}
int main()
{
base BaseArr[5];
SomeFunc(BaseArr,5);
deri DeriArr[5];
SomeFunc(DeriArr,5);
system(pause);
return 0;
}
see the output u will understant

On Sun, Aug 21, 2011 at 12:44 PM, Puneet Chawla
puneetchawla...@gmail.comwrote:

 Wil u please explain in context of o/p.means how 1 whn SomeFunc(DeriArr,5);
 stmt is executed how 0 and 1 will come..???


 On Sun, Aug 21, 2011 at 12:40 PM, Naman Mahor naman.ma...@gmail.comwrote:

 because the pointer of base class will move by 2 bytes every time but the
 size of derived class is 4 byte.


 On Sun, Aug 21, 2011 at 12:31 PM, Puneet Chawla 
 puneetchawla...@gmail.com wrote:

 class base
{
public:
int bval;
base(){bval=0;}
};
 class deri:public base
{
public:
int dval;
deri(){dval=1;}
};
 void SomeFunc(base *arr,int size)
 {
 for(int i=0; isize; i++,arr++)
coutarr-bval;
 coutendl;
 }
 int main()
 {
 base BaseArr[5];
 SomeFunc(BaseArr,5);
 deri DeriArr[5];
 SomeFunc(DeriArr,5);
 system(pause);
 return 0;
 }

 0
 01010
 Will somebody tell me why it's showing this..??

 --
 With regards
   
 Puneet

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




 --
 With regards
   
 Puneet

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

2011-08-21 Thread JAIDEV YADAV
dude u haven't used copy constructor properly .. check it out again ... you
are not copying actually ... thats it ...

On Sun, Aug 21, 2011 at 12:53 PM, Abhishek Yadav algowithabhis...@gmail.com
 wrote:

 Check this code: the thing i couldn't understand is when the object is
 being returned neither the copy constructor is being called nor the
  assignment operator overload is calledthen how the object is being
 copied into b. i don't think default copy constructor should be called if i
 have made our own copy constructor???
 #includeiostream
 using namespace std;
 #includeconio.h

 class X
 {
   public:
   int num;
 X(int a)
 {
 num=a;
  cout\n constructor;
 }

 X(const X t)
  {
 this-num=t.num;
 cout\nCopy ;
  }

 X operator=(const X t)
 {
  this-num =t.num;
 cout\n Assigment   ;
 return t;
  }

 X fun()
 {
cout\nin fun;
return X(7);
  }

 ~X()
 {
 cout\ndestruct ;
  }

 };

 int main()
 {
 {
 X a(1);
X b=a.fun();
cout\n\nb.num;
 }
 getch();
 }


 On Sun, Aug 21, 2011 at 12:33 PM, Abhishek Yadav 
 algowithabhis...@gmail.com wrote:

 The code is correct..return X will make a temporary object and for that a
 constructor and corresponding destructor will be called and that  object is
 returned.

 On Sun, Aug 21, 2011 at 12:24 PM, Puneet Chawla 
 puneetchawla...@gmail.com wrote:

 It will show error

 On Sun, Aug 21, 2011 at 12:21 PM, Sanjay Rajpal srn...@gmail.comwrote:

 I think it will not be an error.

 This is because X() will create a temporary object, and when the
 object is returned in the function calling it, then default copy
 constructor will do bitwise copy of data members in the calling
 function.

 Correct me if m wrong.

 On 8/20/11, sachin sabbarwal algowithsac...@gmail.com wrote:
  class X()
  {
 
  X()
  {
  }
 
 
 
  X fun()
  {
  return X();  //error or what?? because constructor never returns
  anything so what this return statement will receive after executing
 x() and
  what it will return??
  }
 
 
  };
 
  --
  You received this message because you are subscribed to the Google
 Groups
  Algorithm Geeks group.
  To post to this group, send email to algogeeks@googlegroups.com.
  To unsubscribe from this group, send email to
  algogeeks+unsubscr...@googlegroups.com.
  For more options, visit this group at
  http://groups.google.com/group/algogeeks?hl=en.
 
 


 --
 Sanju
 :)

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




 --
 With regards
   
 Puneet Chawla
 Computer Engineering Student
 NIT Kurukshetra

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




-- 
JaiDev Yadav
(National Yoga Champion)
Computer Engg. Dept.
National Institute of Technology
Kurukshetra,Haryana

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



Re: [algogeeks]

2011-08-21 Thread Sanjay Rajpal
@Naman : Can you tell me why the value of dval is accessed via bval of base
class ? I got ur point but still confused about it.

Sanju
:)



On Sun, Aug 21, 2011 at 12:16 AM, Naman Mahor naman.ma...@gmail.com wrote:

 #includeiostream
 using namespace std;

 class base
{
public:
int bval;
base(){bval=0;}
};
 class deri:public base
{
public:
int dval;
deri(){dval=1;}
};
 void SomeFunc(base *arr,int size)
 {
 for(int i=0; isize; i++,arr++)
 {   coutarr-bvalendl;
  cout(arr-bval)endl;


 }
 coutendl;
 }
 int main()
 {
 base BaseArr[5];
 SomeFunc(BaseArr,5);
 deri DeriArr[5];
 SomeFunc(DeriArr,5);
 system(pause);
 return 0;
 }
 see the output u will understant


 On Sun, Aug 21, 2011 at 12:44 PM, Puneet Chawla puneetchawla...@gmail.com
  wrote:

 Wil u please explain in context of o/p.means how 1 whn
 SomeFunc(DeriArr,5); stmt is executed how 0 and 1 will come..???


 On Sun, Aug 21, 2011 at 12:40 PM, Naman Mahor naman.ma...@gmail.comwrote:

 because the pointer of base class will move by 2 bytes every time but the
 size of derived class is 4 byte.


 On Sun, Aug 21, 2011 at 12:31 PM, Puneet Chawla 
 puneetchawla...@gmail.com wrote:

 class base
{
public:
int bval;
base(){bval=0;}
};
 class deri:public base
{
public:
int dval;
deri(){dval=1;}
};
 void SomeFunc(base *arr,int size)
 {
 for(int i=0; isize; i++,arr++)
coutarr-bval;
 coutendl;
 }
 int main()
 {
 base BaseArr[5];
 SomeFunc(BaseArr,5);
 deri DeriArr[5];
 SomeFunc(DeriArr,5);
 system(pause);
 return 0;
 }

 0
 01010
 Will somebody tell me why it's showing this..??

 --
 With regards
   
 Puneet

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




 --
 With regards
   
 Puneet

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

2011-08-21 Thread Abhishek Yadav
what are you trying to say?...can you please explain?

On Sun, Aug 21, 2011 at 1:35 PM, JAIDEV YADAV jaid...@gmail.com wrote:

 try to use X b = a ; b.fun() ;

 On Sun, Aug 21, 2011 at 1:33 PM, Abhishek Yadav 
 algowithabhis...@gmail.com wrote:

 ok...may be i forgot , can you please tell me correct code for the copy
 constructor..?


 On Sun, Aug 21, 2011 at 1:31 PM, JAIDEV YADAV jaid...@gmail.com wrote:

 dude u haven't used copy constructor properly .. check it out again ...
 you are not copying actually ... thats it ...

 On Sun, Aug 21, 2011 at 12:53 PM, Abhishek Yadav 
 algowithabhis...@gmail.com wrote:

 Check this code: the thing i couldn't understand is when the object is
 being returned neither the copy constructor is being called nor the
  assignment operator overload is calledthen how the object is being
 copied into b. i don't think default copy constructor should be called if i
 have made our own copy constructor???
 #includeiostream
 using namespace std;
 #includeconio.h

 class X
 {
   public:
   int num;
 X(int a)
 {
 num=a;
  cout\n constructor;
 }

 X(const X t)
  {
 this-num=t.num;
 cout\nCopy ;
  }

 X operator=(const X t)
 {
  this-num =t.num;
 cout\n Assigment   ;
 return t;
  }

 X fun()
 {
cout\nin fun;
return X(7);
  }

 ~X()
 {
 cout\ndestruct ;
  }

 };

 int main()
 {
 {
 X a(1);
X b=a.fun();
cout\n\nb.num;
 }
 getch();
 }


 On Sun, Aug 21, 2011 at 12:33 PM, Abhishek Yadav 
 algowithabhis...@gmail.com wrote:

 The code is correct..return X will make a temporary object and for that
 a constructor and corresponding destructor will be called and that  object
 is returned.

 On Sun, Aug 21, 2011 at 12:24 PM, Puneet Chawla 
 puneetchawla...@gmail.com wrote:

 It will show error

 On Sun, Aug 21, 2011 at 12:21 PM, Sanjay Rajpal srn...@gmail.comwrote:

 I think it will not be an error.

 This is because X() will create a temporary object, and when the
 object is returned in the function calling it, then default copy
 constructor will do bitwise copy of data members in the calling
 function.

 Correct me if m wrong.

 On 8/20/11, sachin sabbarwal algowithsac...@gmail.com wrote:
  class X()
  {
 
  X()
  {
  }
 
 
 
  X fun()
  {
  return X();  //error or what?? because constructor never
 returns
  anything so what this return statement will receive after executing
 x() and
  what it will return??
  }
 
 
  };
 
  --
  You received this message because you are subscribed to the Google
 Groups
  Algorithm Geeks group.
  To post to this group, send email to algogeeks@googlegroups.com.
  To unsubscribe from this group, send email to
  algogeeks+unsubscr...@googlegroups.com.
  For more options, visit this group at
  http://groups.google.com/group/algogeeks?hl=en.
 
 


 --
 Sanju
 :)

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




 --
 With regards
   
 Puneet Chawla
 Computer Engineering Student
 NIT Kurukshetra

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




 --
 JaiDev Yadav
 (National Yoga Champion)
 Computer Engg. Dept.
 National Institute of Technology
 Kurukshetra,Haryana

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




 --
 JaiDev Yadav
 (National Yoga Champion)
 Computer Engg. Dept.
 National Institute of Technology
 Kurukshetra,Haryana

  --
 You received this message because you are subscribed to the 

Re: [algogeeks] array problem

2011-08-21 Thread Dheeraj Sharma
while(a)
(
a=(a-1)
count++
)
counts number of 1s in number 'a'..
Loop can be breaken if count exceeds 16..

On 8/21/11, himanshu kansal himanshukansal...@gmail.com wrote:
 problem: There is an array containing integers.
 for every bit in the integer,you have to print a 1 if no of 1s
 corresponding to that bit is more than no of 0s corresponding to that
 bit (counting that bit in all the integers) otherwise print a 0(if no
 of 0s corresponding to that bit are more).

 this you have to do for all bits in the integers.

 assumption:integers are of 32bits.
 no of integers in array are odd...(i.e. there is no case like no. of
 1s=no. of 0s)

 i have  done this by counting the no of 1s and 0s for all bits.

 but can anyone suggest any other efficient approach (somewhat using
 bitwise operators).

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




-- 
*Dheeraj Sharma*
Comp Engg.
NIT Kurukshetra
+91 8950264227

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

2011-08-21 Thread Puneet Chawla
Similary as we  are counting set bits count 0's nd cmpare nd set 1 if
coutn(1)count(0) for each integer in array

On Sun, Aug 21, 2011 at 1:44 PM, Sanjay Rajpal srn...@gmail.com wrote:

 @Dheeraj : I think u should review the problem again.
 What u have posted is a way to find no. of set bits in a number.
 But problem is check a bit at a position in all number for no. of 1s and
 0s, not in a single number.
 This has to be done for all 32 bits.

 Sanju
 :)



 On Sun, Aug 21, 2011 at 1:11 AM, Dheeraj Sharma 
 dheerajsharma1...@gmail.com wrote:

 while(a)
 (
 a=(a-1)
 count++
 )
 counts number of 1s in number 'a'..
 Loop can be breaken if count exceeds 16..

 On 8/21/11, himanshu kansal himanshukansal...@gmail.com wrote:
  problem: There is an array containing integers.
  for every bit in the integer,you have to print a 1 if no of 1s
  corresponding to that bit is more than no of 0s corresponding to that
  bit (counting that bit in all the integers) otherwise print a 0(if no
  of 0s corresponding to that bit are more).
 
  this you have to do for all bits in the integers.
 
  assumption:integers are of 32bits.
  no of integers in array are odd...(i.e. there is no case like no. of
  1s=no. of 0s)
 
  i have  done this by counting the no of 1s and 0s for all bits.
 
  but can anyone suggest any other efficient approach (somewhat using
  bitwise operators).
 
  --
  You received this message because you are subscribed to the Google
 Groups
  Algorithm Geeks group.
  To post to this group, send email to algogeeks@googlegroups.com.
  To unsubscribe from this group, send email to
  algogeeks+unsubscr...@googlegroups.com.
  For more options, visit this group at
  http://groups.google.com/group/algogeeks?hl=en.
 
 


 --
 *Dheeraj Sharma*
 Comp Engg.
 NIT Kurukshetra
 +91 8950264227

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




-- 
With regards
  
Puneet

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

2011-08-21 Thread Dheeraj Sharma
yeah i took it in the another way..i ll post it v soon

On 8/21/11, himanshu kansal himanshukansal...@gmail.com wrote:
 problem: There is an array containing integers.
 for every bit in the integer,you have to print a 1 if no of 1s
 corresponding to that bit is more than no of 0s corresponding to that
 bit (counting that bit in all the integers) otherwise print a 0(if no
 of 0s corresponding to that bit are more).

 this you have to do for all bits in the integers.

 assumption:integers are of 32bits.
 no of integers in array are odd...(i.e. there is no case like no. of
 1s=no. of 0s)

 i have  done this by counting the no of 1s and 0s for all bits.

 but can anyone suggest any other efficient approach (somewhat using
 bitwise operators).

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




-- 
*Dheeraj Sharma*
Comp Engg.
NIT Kurukshetra
+91 8950264227

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



Re: [algogeeks]

2011-08-21 Thread sukran dhawan
can u elobarate on ur algo ? its a singly linked circular list .so its diff
to apply dutch method.

On Sun, Aug 21, 2011 at 11:31 AM, muthu raj muthura...@gmail.com wrote:

 Segregate the Odd and even nodes in the list by traversing in O(n). Then
 print the resulting list in O(n). So no additional space required and
 solution in O(n) time also :)
 *Muthuraj R
 IV th Year , ISE
 PESIT , Bangalore*




 On Fri, Aug 19, 2011 at 9:48 AM, priya ramesh 
 love.for.programm...@gmail.com wrote:

 +1 sagar! i too have the same 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.


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

2011-08-21 Thread jega...@gmail.com
Pls have a look at this site...
sqlauthority.com
On 21-Aug-2011 11:44 AM, sachin sabbarwal algowithsac...@gmail.com
wrote:
 plz suggest some link where i can get questions on sql queries to
practice.
 thanks in advance!!

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


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

2011-08-21 Thread Sanjay Rajpal
let n be the no.of integers in the array :

int i=1,a;
int zero,one;
for(int a=1;a=32;a++)
{
zero=0;
one=0;
for(int j=0;jn;j++)
{
if(a[j]  i)
{
one++;
}
else
{
zero++;
}
}
if(one  zero)
{
printf(1s are more \n);
}
else
{
printf(0s are more \n);
}
i=i1;
}

Correct me if m wrong.

Sanju
:)



On Sun, Aug 21, 2011 at 1:28 AM, Dheeraj Sharma dheerajsharma1...@gmail.com
 wrote:

 yeah i took it in the another way..i ll post it v soon

 On 8/21/11, himanshu kansal himanshukansal...@gmail.com wrote:
  problem: There is an array containing integers.
  for every bit in the integer,you have to print a 1 if no of 1s
  corresponding to that bit is more than no of 0s corresponding to that
  bit (counting that bit in all the integers) otherwise print a 0(if no
  of 0s corresponding to that bit are more).
 
  this you have to do for all bits in the integers.
 
  assumption:integers are of 32bits.
  no of integers in array are odd...(i.e. there is no case like no. of
  1s=no. of 0s)
 
  i have  done this by counting the no of 1s and 0s for all bits.
 
  but can anyone suggest any other efficient approach (somewhat using
  bitwise operators).
 
  --
  You received this message because you are subscribed to the Google Groups
  Algorithm Geeks group.
  To post to this group, send email to algogeeks@googlegroups.com.
  To unsubscribe from this group, send email to
  algogeeks+unsubscr...@googlegroups.com.
  For more options, visit this group at
  http://groups.google.com/group/algogeeks?hl=en.
 
 


 --
 *Dheeraj Sharma*
 Comp Engg.
 NIT Kurukshetra
 +91 8950264227

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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] convert a vector containing octal representation of a number to decimal number

2011-08-21 Thread sarvesh saran
Hi,

I have a vectorint A or an array (for C guys) that contains the octal
representation of a number.

So the array can be something like: [1,5,7] or [7,7,5,6,3,4,2] etc

i.e no number in the array can be = 8.

Now given this array, I need to convert it its decimal representation.

The naive way to do it would be to scan array from left to right, take each
digit, multiply by 8 pow (x) where x is from 0 to ...n and compute sum.

i.e something like:

int oct = 1;
int num = 0;

 for(array length){
num+= oct * A[i];
oct = oct * 8;
}

is there a faster way to do this? maybe using some STL container or algorithm. ?

thanks,
sarvesh

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



[algogeeks] Re: array problem

2011-08-21 Thread DheerajSharma
It would work i guess

On Aug 21, 1:49 pm, Sanjay Rajpal srn...@gmail.com wrote:
 let n be the no.of integers in the array :

 int i=1,a;
     int zero,one;
     for(int a=1;a=32;a++)
     {
         zero=0;
         one=0;
         for(int j=0;jn;j++)
         {
             if(a[j]  i)
             {
                 one++;
             }
             else
             {
                 zero++;
             }
         }
         if(one  zero)
         {
             printf(1s are more \n);
         }
         else
         {
             printf(0s are more \n);
         }
         i=i1;
     }

 Correct me if m wrong.

 Sanju
 :)

 On Sun, Aug 21, 2011 at 1:28 AM, Dheeraj Sharma dheerajsharma1...@gmail.com

  wrote:
  yeah i took it in the another way..i ll post it v soon

  On 8/21/11, himanshu kansal himanshukansal...@gmail.com wrote:
   problem: There is an array containing integers.
   for every bit in the integer,you have to print a 1 if no of 1s
   corresponding to that bit is more than no of 0s corresponding to that
   bit (counting that bit in all the integers) otherwise print a 0(if no
   of 0s corresponding to that bit are more).

   this you have to do for all bits in the integers.

   assumption:integers are of 32bits.
   no of integers in array are odd...(i.e. there is no case like no. of
   1s=no. of 0s)

   i have  done this by counting the no of 1s and 0s for all bits.

   but can anyone suggest any other efficient approach (somewhat using
   bitwise operators).

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

  --
  *Dheeraj Sharma*
  Comp Engg.
  NIT Kurukshetra
  +91 8950264227

  --
  You received this message because you are subscribed to the Google Groups
  Algorithm Geeks group.
  To post to this group, send email to algogeeks@googlegroups.com.
  To unsubscribe from 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-21 Thread Vijay Khandar
Can you explain me shortly how 5.375 is converted into normalised
form...How to find mantissa and Exponent in this case? Plz Explain
meVijay
On Sun, Aug 21, 2011 at 1:25 PM, Rahul Tiwari rahultiwari6...@gmail.comwrote:



 On Sun, Aug 21, 2011 at 11:11 AM, Rahul Tiwari 
 rahultiwari6...@gmail.comwrote:

 @vijay 
 u take normalised form of 5.375 wrong .
 actual normalised form of 5.375 = 0100  1010 1100    









 On Sun, Aug 21, 2011 at 10:12 AM, Vijay Khandar 
 vijaykhand...@gmail.comwrote:

 but why only o/p-00 00 AC 40 and not AC 40 00 00 or 00 AC 40 00 or 40 AC
 00 00etc , plz explain in detail how p[0] pts to 00 and p[1] pts to 00 and
 p[2] pts AC or 1010 1100 and p[3] pts to 40 or 0100  ONLY in this
 way..Vijay Khandar...


 On Sat, Aug 20, 2011 at 12:31 PM, Dipankar Patro dip10c...@gmail.comwrote:

 float is 4 bytes.
 so a=3.75 will be stored in 4 bytes in memory.

 the moment you have a pointer referring to the same memory location but
 type cast to (char *), the pointer will refer to character i.e. 1 byte.
 ^^ this explains the p[0] , p[1], p[2], p[3] - 4 bytes of the 3.75

 now finally the o/p
 00 00 AC 40
 ^^ it is in little endian format. i.e the data bytes are stored in
 memory is reverse format.

 On 20 August 2011 11:21, Vijay Khandar vijaykhand...@gmail.com wrote:

 If the binary equivalent of 5.375 in normalised form is - 0100 
 1010  1100   

 what is the o/p of following code-
 main()
 {
 float a=5.375;
 char *p;
 int i;
 p=(char *)a;
 for(i=0;i=3;i++)
 printf(%02X,(unsigned char)p[i]);
 }

 O/P= 00 00 AC 40
 Plz, Plz  anyone explain me in detail, how this o/p is coming?
 Vijay..

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




 --
 Rahul Tiwari aka   DONE 
 B Tech Final Year
 Information Technology
 Motilal Nehru National Institute of Technology , Allahabad
 9838339030




 --
 Rahul Tiwari aka   DONE 
 B Tech Final Year
 Information Technology
 Motilal Nehru National Institute of Technology , Allahabad
 9838339030

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

2011-08-21 Thread sagar pareek
This problem can be reduced if we are taking whole 32 bits...
Mean left most all 0's bits are also including
then if number is less than 65535 (2^16-1) then make it 0
as 16 bits are at least zero in this case

On Sun, Aug 21, 2011 at 2:19 PM, Sanjay Rajpal srn...@gmail.com wrote:

 let n be the no.of integers in the array :

 int i=1,a;
 int zero,one;
 for(int a=1;a=32;a++)
 {
 zero=0;
 one=0;
 for(int j=0;jn;j++)
 {
 if(a[j]  i)
 {
 one++;
 }
 else
 {
 zero++;
 }
 }
 if(one  zero)
 {
 printf(1s are more \n);
 }
 else
 {
 printf(0s are more \n);
 }
 i=i1;
 }

 Correct me if m wrong.

 Sanju
 :)



 On Sun, Aug 21, 2011 at 1:28 AM, Dheeraj Sharma 
 dheerajsharma1...@gmail.com wrote:

 yeah i took it in the another way..i ll post it v soon

 On 8/21/11, himanshu kansal himanshukansal...@gmail.com wrote:
  problem: There is an array containing integers.
  for every bit in the integer,you have to print a 1 if no of 1s
  corresponding to that bit is more than no of 0s corresponding to that
  bit (counting that bit in all the integers) otherwise print a 0(if no
  of 0s corresponding to that bit are more).
 
  this you have to do for all bits in the integers.
 
  assumption:integers are of 32bits.
  no of integers in array are odd...(i.e. there is no case like no. of
  1s=no. of 0s)
 
  i have  done this by counting the no of 1s and 0s for all bits.
 
  but can anyone suggest any other efficient approach (somewhat using
  bitwise operators).
 
  --
  You received this message because you are subscribed to the Google
 Groups
  Algorithm Geeks group.
  To post to this group, send email to algogeeks@googlegroups.com.
  To unsubscribe from this group, send email to
  algogeeks+unsubscr...@googlegroups.com.
  For more options, visit this group at
  http://groups.google.com/group/algogeeks?hl=en.
 
 


 --
 *Dheeraj Sharma*
 Comp Engg.
 NIT Kurukshetra
 +91 8950264227

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

2011-08-21 Thread Dheeraj Sharma
yeah bt..when we talk abt the complexity..we consider abt the worst case

On 8/21/11, himanshu kansal himanshukansal...@gmail.com wrote:
 problem: There is an array containing integers.
 for every bit in the integer,you have to print a 1 if no of 1s
 corresponding to that bit is more than no of 0s corresponding to that
 bit (counting that bit in all the integers) otherwise print a 0(if no
 of 0s corresponding to that bit are more).

 this you have to do for all bits in the integers.

 assumption:integers are of 32bits.
 no of integers in array are odd...(i.e. there is no case like no. of
 1s=no. of 0s)

 i have  done this by counting the no of 1s and 0s for all bits.

 but can anyone suggest any other efficient approach (somewhat using
 bitwise operators).

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




-- 
*Dheeraj Sharma*
Comp Engg.
NIT Kurukshetra
+91 8950264227

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

2011-08-21 Thread Dheeraj Sharma
complexity nd all?
O(n^4) works?

On 8/21/11, prasanth n nprasnt...@gmail.com wrote:
 given a matrix with +ve and -ve numbers, find the submatrix with maximum
 sum??

 --
 *prasanth*

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




-- 
*Dheeraj Sharma*
Comp Engg.
NIT Kurukshetra
+91 8950264227

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



Re: [algogeeks]

2011-08-21 Thread Dheeraj Sharma
if we take two pointers..one ahead of another initially..then jump one
of the pointer twice..until it reaches the beginning(printing the
valu) n similar for the another pointer
does ptr-next-next means ha.f travelling the list?

On 8/21/11, muthu raj muthura...@gmail.com wrote:
 Segregate the Odd and even nodes in the list by traversing in O(n). Then
 print the resulting list in O(n). So no additional space required and
 solution in O(n) time also :)
 *Muthuraj R
 IV th Year , ISE
 PESIT , Bangalore*



 On Fri, Aug 19, 2011 at 9:48 AM, priya ramesh 
 love.for.programm...@gmail.com wrote:

 +1 sagar! i too have the same 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.


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




-- 
*Dheeraj Sharma*
Comp Engg.
NIT Kurukshetra
+91 8950264227

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



Re: [algogeeks]

2011-08-21 Thread Dheeraj Sharma
if we take two pointers..one ahead of another initially..then jump one
of the pointer twice..until it reaches the beginning(printing the
valu) n similar for the another pointer
does ptr-next-next means ha.f travelling the list?

On 8/21/11, muthu raj muthura...@gmail.com wrote:
 Segregate the Odd and even nodes in the list by traversing in O(n). Then
 print the resulting list in O(n). So no additional space required and
 solution in O(n) time also :)
 *Muthuraj R
 IV th Year , ISE
 PESIT , Bangalore*



 On Fri, Aug 19, 2011 at 9:48 AM, priya ramesh 
 love.for.programm...@gmail.com wrote:

 +1 sagar! i too have the same 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.


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




-- 
*Dheeraj Sharma*
Comp Engg.
NIT Kurukshetra
+91 8950264227

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] convert a vector containing octal representation of a number to decimal number

2011-08-21 Thread Nitin Nizhawan
int num = 0;
for(int i=0;iA.size();i++){
   num=num||(A[i]3*i);
}
printf(%d,num);

I think this will do.

On Sun, Aug 21, 2011 at 2:25 PM, sarvesh saran
aquarian.thun...@gmail.comwrote:

 Hi,

 I have a vectorint A or an array (for C guys) that contains the octal
 representation of a number.

 So the array can be something like: [1,5,7] or [7,7,5,6,3,4,2] etc

 i.e no number in the array can be = 8.

 Now given this array, I need to convert it its decimal representation.

 The naive way to do it would be to scan array from left to right, take each
 digit, multiply by 8 pow (x) where x is from 0 to ...n and compute sum.

 i.e something like:

 int oct = 1;
 int num = 0;

  for(array length){
 num+= oct * A[i];
 oct = oct * 8;
 }

 is there a faster way to do this? maybe using some STL container or 
 algorithm. ?

 thanks,
 sarvesh


  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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] convert a vector containing octal representation of a number to decimal number

2011-08-21 Thread Nitin Nizhawan
int num = 0;
for(int i=0;iA.size();i++){
   num=num||(A[i]3*i);
}
printf(%d,num);

I think this will do. Given the number is with in the range of integer.

On Sun, Aug 21, 2011 at 3:40 PM, Nitin Nizhawan nitin.nizha...@gmail.comwrote:

 int num = 0;
 for(int i=0;iA.size();i++){
num=num||(A[i]3*i);
 }
 printf(%d,num);

 I think this will do.


 On Sun, Aug 21, 2011 at 2:25 PM, sarvesh saran aquarian.thun...@gmail.com
  wrote:

 Hi,

 I have a vectorint A or an array (for C guys) that contains the octal
 representation of a number.

 So the array can be something like: [1,5,7] or [7,7,5,6,3,4,2] etc

 i.e no number in the array can be = 8.

 Now given this array, I need to convert it its decimal representation.

 The naive way to do it would be to scan array from left to right, take
 each digit, multiply by 8 pow (x) where x is from 0 to ...n and compute sum.

 i.e something like:

 int oct = 1;
 int num = 0;

  for(array length){
 num+= oct * A[i];
 oct = oct * 8;
 }

 is there a faster way to do this? maybe using some STL container or 
 algorithm. ?

 thanks,
 sarvesh


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

2011-08-21 Thread SuDhir mIsHra
#includestdio.h
#define FUNC1(i) (i*(i-1))
#define FUNC2(i) (i==0?1:i*FUNC1(i-1))
main()
{
int i=8;


printf(\n%d,FUNC2(i));
}

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

2011-08-21 Thread Udit Gupta
@somya can you plz explain...what do software engineering concepts hae to do
with the gd round??

On Tue, Aug 16, 2011 at 7:47 PM, siva viknesh sivavikne...@gmail.comwrote:

 hi can u plz tell me in which areas of aps did they concentrate .. i
 mean the topics...work and time, probability ..like thatthere were
 c / cpp aps ???

 On Aug 16, 7:11 pm, somya mishra somya.bvm...@gmail.com wrote:
  no probs mate all the best
 
 
 
 
 
 
 
  On Tue, Aug 16, 2011 at 10:01 AM, karthik fbk fbk@gmail.com wrote:
   thnk you .
 
   On Tue, Aug 16, 2011 at 7:27 PM, somya mishra somya.bvm...@gmail.com
 wrote:
 
   decent level nt very tough bt also nt very easy also
 
   On Tue, Aug 16, 2011 at 6:37 PM, karthik fbk fbk@gmail.com
 wrote:
 
   What about verbal sections ? How tough were verbal questions ?
   What type of questions were asked in verbal section ?
 
   On Tue, Aug 16, 2011 at 6:34 PM, somya mishra 
 somya.bvm...@gmail.comwrote:
 
   ya first round was rs agarwal type question. for gd round do go
   thoroughly thru ur software engineer concepts interview round was
 pretty
   easy jst some general quest nothing much technical
 
   On Tue, Aug 16, 2011 at 6:23 PM, karthik fbk fbk@gmail.com
 wrote:
 
   Have Deloitte visited any of your colleges ?
   If so can you plz share your interview experience ?
   What questions were asked in written ? Were the quants questions so
   difficult or as same as R S Agarwal type questions ?
 
   If you have any additional information , plz share it ..
 
   --
   You received this message because you are subscribed to the Google
   Groups Algorithm Geeks group.
   To post to this group, send email to algogeeks@googlegroups.com.
   To unsubscribe from this group, send email to
   algogeeks+unsubscr...@googlegroups.com.
   For more options, visit this group at
  http://groups.google.com/group/algogeeks?hl=en.
 
--
   You received this message because you are subscribed to the Google
   Groups Algorithm Geeks group.
   To post to this group, send email to algogeeks@googlegroups.com.
   To unsubscribe from this group, send email to
   algogeeks+unsubscr...@googlegroups.com.
   For more options, visit this group at
  http://groups.google.com/group/algogeeks?hl=en.
 
--
   You received this message because you are subscribed to the Google
 Groups
   Algorithm Geeks group.
   To post to this group, send email to algogeeks@googlegroups.com.
   To unsubscribe from this group, send email to
   algogeeks+unsubscr...@googlegroups.com.
   For more options, visit this group at
  http://groups.google.com/group/algogeeks?hl=en.
 
--
   You received this message because you are subscribed to the Google
 Groups
   Algorithm Geeks group.
   To post to this group, send email to algogeeks@googlegroups.com.
   To unsubscribe from this group, send email to
   algogeeks+unsubscr...@googlegroups.com.
   For more options, visit this group at
  http://groups.google.com/group/algogeeks?hl=en.
 
--
   You received this message because you are subscribed to the Google
 Groups
   Algorithm Geeks group.
   To post to this group, send email to algogeeks@googlegroups.com.
   To unsubscribe from this group, send email to
   algogeeks+unsubscr...@googlegroups.com.
   For more options, visit this group at
  http://groups.google.com/group/algogeeks?hl=en.

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



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



Re: [algogeeks] c question what is output?

2011-08-21 Thread sagar pareek
FUNC2(i) =  i==0?i*(i-1*(i-1-1))

8==0?1:8*(8-1*(8-1-1))
8==0?1:8*(8-6)
8==0?1:8*2
8==0?1:16

hence it will return 16

On Sun, Aug 21, 2011 at 11:40 AM, SuDhir mIsHra
sudhir08.mis...@gmail.comwrote:

 #includestdio.h
 #define FUNC1(i) (i*(i-1))
 #define FUNC2(i) (i==0?1:i*FUNC1(i-1))
 main()
 {
 int i=8;


 printf(\n%d,FUNC2(i));
 }

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

2011-08-21 Thread Naman Mahor
 8==0?1:8* (8-1*(8-1-1))
this will execute as 8*(8-1(8-2)) = 8*(8-1*6)8*(8-6)===8*2===16


On Sat, Aug 20, 2011 at 7:02 PM, SuDhir mIsHra sudhir08.mis...@gmail.comwrote:

 #includestdio.h
 #define FUNC1(i) (i*(i-1))
 #define FUNC2(i) (i==0?1:i*FUNC1(i-1))
 main()
 {
 int i=8;


 printf(\n%d,FUNC2(i));
 }

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

2011-08-21 Thread Sanjay Rajpal
+1 to sagar
Sanju
:)



On Sun, Aug 21, 2011 at 3:26 AM, sagar pareek sagarpar...@gmail.com wrote:

 FUNC2(i) =  i==0?i*(i-1*(i-1-1))

 8==0?1:8*(8-1*(8-1-1))
 8==0?1:8*(8-6)
 8==0?1:8*2
 8==0?1:16

 hence it will return 16


 On Sun, Aug 21, 2011 at 11:40 AM, SuDhir mIsHra sudhir08.mis...@gmail.com
  wrote:

  #includestdio.h
 #define FUNC1(i) (i*(i-1))
 #define FUNC2(i) (i==0?1:i*FUNC1(i-1))
 main()
 {
 int i=8;


 printf(\n%d,FUNC2(i));
 }

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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] convert a vector containing octal representation of a number to decimal number

2011-08-21 Thread sarvesh saran
Hi Nitin,

thanks that makes sense. I will try that out.

I have another question. Is there a  really fast way of converting a
hexadecimal string say 02F9A to its decimal representation in C++?

thanks,
Sarvesh

thanks,
Sarvesh

On Sun, Aug 21, 2011 at 3:41 PM, Nitin Nizhawan nitin.nizha...@gmail.comwrote:

 int num = 0;
 for(int i=0;iA.size();i++){
num=num||(A[i]3*i);
 }
 printf(%d,num);

 I think this will do. Given the number is with in the range of integer.


 On Sun, Aug 21, 2011 at 3:40 PM, Nitin Nizhawan 
 nitin.nizha...@gmail.comwrote:

 int num = 0;
 for(int i=0;iA.size();i++){
num=num||(A[i]3*i);
 }
 printf(%d,num);

 I think this will do.


 On Sun, Aug 21, 2011 at 2:25 PM, sarvesh saran 
 aquarian.thun...@gmail.com wrote:

 Hi,

 I have a vectorint A or an array (for C guys) that contains the octal
 representation of a number.

 So the array can be something like: [1,5,7] or [7,7,5,6,3,4,2] etc

 i.e no number in the array can be = 8.

 Now given this array, I need to convert it its decimal representation.

 The naive way to do it would be to scan array from left to right, take
 each digit, multiply by 8 pow (x) where x is from 0 to ...n and compute sum.

 i.e something like:

 int oct = 1;
 int num = 0;

  for(array length){
 num+= oct * A[i];
 oct = oct * 8;
 }

 is there a faster way to do this? maybe using some STL container or 
 algorithm. ?

 thanks,
 sarvesh


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

2011-08-21 Thread Prakash D
FUNC2(8)

== 8==0? 1: 8 * FUNC1(8-1)
== 8==0? 1: 8*( 8-1* 8-1-1)

==  8 * (8-8-2)
== -16

but why 16??

On Sat, Aug 20, 2011 at 7:02 PM, SuDhir mIsHra sudhir08.mis...@gmail.comwrote:

 #includestdio.h
 #define FUNC1(i) (i*(i-1))
 #define FUNC2(i) (i==0?1:i*FUNC1(i-1))
 main()
 {
 int i=8;


 printf(\n%d,FUNC2(i));
 }

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

2011-08-21 Thread Prakash D
got it

8==0? 1: 8*( 8 -1* 8-1-1)

== 8*( 8 - {1* 8-1-1})

== 8 * (8-6)
== 16

but why???

On Sun, Aug 21, 2011 at 4:03 PM, Prakash D cegprak...@gmail.com wrote:

 == 8==0? 1: 8*( 8-1* 8-1-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.



Re: [algogeeks] why the output 16

2011-08-21 Thread sagar pareek
@prakash
before posting u should check what others already posted  :D  :D

On Sun, Aug 21, 2011 at 4:03 PM, Prakash D cegprak...@gmail.com wrote:

 FUNC2(8)

 == 8==0? 1: 8 * FUNC1(8-1)
 == 8==0? 1: 8*( 8-1* 8-1-1)

 ==  8 * (8-8-2)
 == -16

 but why 16??

 On Sat, Aug 20, 2011 at 7:02 PM, SuDhir mIsHra 
 sudhir08.mis...@gmail.comwrote:

 #includestdio.h
 #define FUNC1(i) (i*(i-1))
 #define FUNC2(i) (i==0?1:i*FUNC1(i-1))
 main()
 {
 int i=8;


 printf(\n%d,FUNC2(i));
 }

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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] convert a vector containing octal representation of a number to decimal number

2011-08-21 Thread Sanjay Rajpal
Hi your intention was logical OR or BITWISE OR ?

u did Logical.
Sanju
:)



On Sun, Aug 21, 2011 at 3:30 AM, sarvesh saran
aquarian.thun...@gmail.comwrote:

 Hi Nitin,

 thanks that makes sense. I will try that out.

 I have another question. Is there a  really fast way of converting a
 hexadecimal string say 02F9A to its decimal representation in C++?

 thanks,
 Sarvesh

 thanks,
 Sarvesh


 On Sun, Aug 21, 2011 at 3:41 PM, Nitin Nizhawan 
 nitin.nizha...@gmail.comwrote:

 int num = 0;
 for(int i=0;iA.size();i++){
num=num||(A[i]3*i);
 }
 printf(%d,num);

 I think this will do. Given the number is with in the range of integer.


 On Sun, Aug 21, 2011 at 3:40 PM, Nitin Nizhawan nitin.nizha...@gmail.com
  wrote:

 int num = 0;
 for(int i=0;iA.size();i++){
num=num||(A[i]3*i);
 }
 printf(%d,num);

 I think this will do.


 On Sun, Aug 21, 2011 at 2:25 PM, sarvesh saran 
 aquarian.thun...@gmail.com wrote:

 Hi,

 I have a vectorint A or an array (for C guys) that contains the octal
 representation of a number.

 So the array can be something like: [1,5,7] or [7,7,5,6,3,4,2] etc

 i.e no number in the array can be = 8.

 Now given this array, I need to convert it its decimal representation.

 The naive way to do it would be to scan array from left to right, take
 each digit, multiply by 8 pow (x) where x is from 0 to ...n and compute 
 sum.

 i.e something like:

 int oct = 1;
 int num = 0;

  for(array length){
 num+= oct * A[i];
 oct = oct * 8;
 }

 is there a faster way to do this? maybe using some STL container or 
 algorithm. ?

 thanks,
 sarvesh


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

2011-08-21 Thread Prakash D
:P.. no comments when i saw

On Sun, Aug 21, 2011 at 4:07 PM, sagar pareek sagarpar...@gmail.com wrote:

 @prakash
 before posting u should check what others already posted  :D  :D

 On Sun, Aug 21, 2011 at 4:03 PM, Prakash D cegprak...@gmail.com wrote:

 FUNC2(8)

 == 8==0? 1: 8 * FUNC1(8-1)
 == 8==0? 1: 8*( 8-1* 8-1-1)

 ==  8 * (8-8-2)
 == -16

 but why 16??

 On Sat, Aug 20, 2011 at 7:02 PM, SuDhir mIsHra sudhir08.mis...@gmail.com
  wrote:

 #includestdio.h
 #define FUNC1(i) (i*(i-1))
 #define FUNC2(i) (i==0?1:i*FUNC1(i-1))
 main()
 {
 int i=8;


 printf(\n%d,FUNC2(i));
 }

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



Re: [algogeeks] why the output 16

2011-08-21 Thread Vijay Khandar
FUNC1(i) (i*(i-1))=so put i-1 as it is on i=so (i-1*(i-1-1)) and i=8
so(8-1*(8-1-1))=(8-1(6))=2 and mul bu 8=16

On Sun, Aug 21, 2011 at 4:03 PM, Prakash D cegprak...@gmail.com wrote:

 FUNC2(8)

 == 8==0? 1: 8 * FUNC1(8-1)
 == 8==0? 1: 8*( 8-1* 8-1-1)

 ==  8 * (8-8-2)
 == -16

 but why 16??

  On Sat, Aug 20, 2011 at 7:02 PM, SuDhir mIsHra sudhir08.mis...@gmail.com
  wrote:

  #includestdio.h
 #define FUNC1(i) (i*(i-1))
 #define FUNC2(i) (i==0?1:i*FUNC1(i-1))
 main()
 {
 int i=8;


 printf(\n%d,FUNC2(i));
 }

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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] convert a vector containing octal representation of a number to decimal number

2011-08-21 Thread Prakash D
A[i]3*i

why is it needed to convert from base 8 to base 10??

On Sun, Aug 21, 2011 at 4:07 PM, Sanjay Rajpal srn...@gmail.com wrote:

 Hi your intention was logical OR or BITWISE OR ?

 u did Logical.
 Sanju
 :)



 On Sun, Aug 21, 2011 at 3:30 AM, sarvesh saran aquarian.thun...@gmail.com
  wrote:

 Hi Nitin,

 thanks that makes sense. I will try that out.

 I have another question. Is there a  really fast way of converting a
 hexadecimal string say 02F9A to its decimal representation in C++?

 thanks,
 Sarvesh

 thanks,
 Sarvesh


 On Sun, Aug 21, 2011 at 3:41 PM, Nitin Nizhawan nitin.nizha...@gmail.com
  wrote:

 int num = 0;
 for(int i=0;iA.size();i++){
num=num||(A[i]3*i);
 }
 printf(%d,num);

 I think this will do. Given the number is with in the range of integer.


 On Sun, Aug 21, 2011 at 3:40 PM, Nitin Nizhawan 
 nitin.nizha...@gmail.com wrote:

 int num = 0;
 for(int i=0;iA.size();i++){
num=num||(A[i]3*i);
 }
 printf(%d,num);

 I think this will do.


 On Sun, Aug 21, 2011 at 2:25 PM, sarvesh saran 
 aquarian.thun...@gmail.com wrote:

 Hi,

 I have a vectorint A or an array (for C guys) that contains the octal
 representation of a number.

 So the array can be something like: [1,5,7] or [7,7,5,6,3,4,2] etc

 i.e no number in the array can be = 8.

 Now given this array, I need to convert it its decimal representation.

 The naive way to do it would be to scan array from left to right, take
 each digit, multiply by 8 pow (x) where x is from 0 to ...n and compute 
 sum.

 i.e something like:

 int oct = 1;
 int num = 0;

  for(array length){
 num+= oct * A[i];
 oct = oct * 8;
 }

 is there a faster way to do this? maybe using some STL container or 
 algorithm. ?

 thanks,
 sarvesh


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



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


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


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


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



Re: [algogeeks] convert a vector containing octal representation of a number to decimal number

2011-08-21 Thread sarvesh saran
Hi Prakash,

I'll paste the exact description of the problem:

A non-empty array A of N elements contains octal representation of a
non-negative integer K, i.e. each element of A belongs to the interval [0;
7] (both ends included).

Write a function that returns the number of bits set to 1 in the binary
representation of K.

thanks,

Sarvesh






i.e take any decimal number, convert to base 8 and then store each digit of
base 8 representation in an array.

So the question is, given such an array get back the original number.

thanks,
Sarvesh

On Sun, Aug 21, 2011 at 4:13 PM, Prakash D cegprak...@gmail.com wrote:

 A[i]3*i

 why is it needed to convert from base 8 to base 10??

 On Sun, Aug 21, 2011 at 4:07 PM, Sanjay Rajpal srn...@gmail.com wrote:

 Hi your intention was logical OR or BITWISE OR ?

 u did Logical.
 Sanju
 :)



 On Sun, Aug 21, 2011 at 3:30 AM, sarvesh saran 
 aquarian.thun...@gmail.com wrote:

 Hi Nitin,

 thanks that makes sense. I will try that out.

 I have another question. Is there a  really fast way of converting a
 hexadecimal string say 02F9A to its decimal representation in C++?

 thanks,
 Sarvesh

 thanks,
 Sarvesh


 On Sun, Aug 21, 2011 at 3:41 PM, Nitin Nizhawan 
 nitin.nizha...@gmail.com wrote:

 int num = 0;
 for(int i=0;iA.size();i++){
num=num||(A[i]3*i);
 }
 printf(%d,num);

 I think this will do. Given the number is with in the range of integer.


 On Sun, Aug 21, 2011 at 3:40 PM, Nitin Nizhawan 
 nitin.nizha...@gmail.com wrote:

 int num = 0;
 for(int i=0;iA.size();i++){
num=num||(A[i]3*i);
 }
 printf(%d,num);

 I think this will do.


 On Sun, Aug 21, 2011 at 2:25 PM, sarvesh saran 
 aquarian.thun...@gmail.com wrote:

 Hi,

 I have a vectorint A or an array (for C guys) that contains the
 octal representation of a number.

 So the array can be something like: [1,5,7] or [7,7,5,6,3,4,2] etc

 i.e no number in the array can be = 8.

 Now given this array, I need to convert it its decimal representation.

 The naive way to do it would be to scan array from left to right, take
 each digit, multiply by 8 pow (x) where x is from 0 to ...n and compute 
 sum.

 i.e something like:

 int oct = 1;
 int num = 0;

  for(array length){
 num+= oct * A[i];
 oct = oct * 8;
 }

 is there a faster way to do this? maybe using some STL container or 
 algorithm. ?

 thanks,
 sarvesh


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



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


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


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


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


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



Re: [algogeeks] c question what is output?

2011-08-21 Thread Ayswarya Srinivasan
doesn it work like below ?



func2(8)= 8 * func1(7)

func1(7)= 7*6

so i=8*7*6???



On Sun, Aug 21, 2011 at 3:58 PM, Sanjay Rajpal srn...@gmail.com wrote:

 +1 to sagar
 Sanju
 :)



 On Sun, Aug 21, 2011 at 3:26 AM, sagar pareek sagarpar...@gmail.comwrote:

 FUNC2(i) =  i==0?i*(i-1*(i-1-1))

 8==0?1:8*(8-1*(8-1-1))
 8==0?1:8*(8-6)
 8==0?1:8*2
 8==0?1:16

 hence it will return 16


 On Sun, Aug 21, 2011 at 11:40 AM, SuDhir mIsHra 
 sudhir08.mis...@gmail.com wrote:

  #includestdio.h
 #define FUNC1(i) (i*(i-1))
 #define FUNC2(i) (i==0?1:i*FUNC1(i-1))
 main()
 {
 int i=8;


 printf(\n%d,FUNC2(i));
 }

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




-- 
Regards,
Ayswarya 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 question what is output?

2011-08-21 Thread Sanjay Rajpal
Nopes, its a funda of PRE-PROCESSOR directives.

Look before the object code is generated for the program, all the occurences
of the MACROs are replaced with their expansions as such as in the
definition.

So what u r doing is completely wrong.

For more info on MACROs, refer any text book of C.
Sanju
:)



On Sun, Aug 21, 2011 at 4:05 AM, Ayswarya Srinivasan
krsayswa...@gmail.comwrote:

 doesn it work like below ?



 func2(8)= 8 * func1(7)

 func1(7)= 7*6

 so i=8*7*6???



 On Sun, Aug 21, 2011 at 3:58 PM, Sanjay Rajpal srn...@gmail.com wrote:

 +1 to sagar
 Sanju
 :)



 On Sun, Aug 21, 2011 at 3:26 AM, sagar pareek sagarpar...@gmail.comwrote:

 FUNC2(i) =  i==0?i*(i-1*(i-1-1))

 8==0?1:8*(8-1*(8-1-1))
 8==0?1:8*(8-6)
 8==0?1:8*2
 8==0?1:16

 hence it will return 16


 On Sun, Aug 21, 2011 at 11:40 AM, SuDhir mIsHra 
 sudhir08.mis...@gmail.com wrote:

  #includestdio.h
 #define FUNC1(i) (i*(i-1))
 #define FUNC2(i) (i==0?1:i*FUNC1(i-1))
 main()
 {
 int i=8;


 printf(\n%d,FUNC2(i));
 }

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




 --
  Regards,
 Ayswarya 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.


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



[algogeeks] Re: c question what is output?

2011-08-21 Thread Anjul Sharma
is 336 the answer??

On Aug 21, 11:10 am, SuDhir mIsHra sudhir08.mis...@gmail.com wrote:
 #includestdio.h
 #define FUNC1(i) (i*(i-1))
 #define FUNC2(i) (i==0?1:i*FUNC1(i-1))
 main()
 {
         int i=8;

         printf(\n%d,FUNC2(i));







 }

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



Re: [algogeeks] Re: c question what is output?

2011-08-21 Thread Sanjay Rajpal
16

8*(8-1*(8-1-1))


Sanju
:)



On Sun, Aug 21, 2011 at 4:10 AM, Anjul Sharma annurocks1...@gmail.comwrote:

 is 336 the answer??

 On Aug 21, 11:10 am, SuDhir mIsHra sudhir08.mis...@gmail.com wrote:
  #includestdio.h
  #define FUNC1(i) (i*(i-1))
  #define FUNC2(i) (i==0?1:i*FUNC1(i-1))
  main()
  {
  int i=8;
 
  printf(\n%d,FUNC2(i));
 
 
 
 
 
 
 
  }

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

2011-08-21 Thread sagar pareek
Arey yaar just see the my post...
i explained it step by step :)

On Sun, Aug 21, 2011 at 4:43 PM, Sanjay Rajpal srn...@gmail.com wrote:

 16

 8*(8-1*(8-1-1))


 Sanju
 :)



 On Sun, Aug 21, 2011 at 4:10 AM, Anjul Sharma annurocks1...@gmail.comwrote:

 is 336 the answer??

 On Aug 21, 11:10 am, SuDhir mIsHra sudhir08.mis...@gmail.com wrote:
  #includestdio.h
  #define FUNC1(i) (i*(i-1))
  #define FUNC2(i) (i==0?1:i*FUNC1(i-1))
  main()
  {
  int i=8;
 
  printf(\n%d,FUNC2(i));
 
 
 
 
 
 
 
  }

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

2011-08-21 Thread Abhishek
check this link..
http://en.wikipedia.org/wiki/Single_precision_floating-point_format

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

2011-08-21 Thread somya mishra
like user interface design etc

On Sat, Aug 20, 2011 at 10:06 AM, Udit Gupta uditgupta...@gmail.com wrote:

 @somya can you plz explain...what do software engineering concepts hae to
 do with the gd round??


 On Tue, Aug 16, 2011 at 7:47 PM, siva viknesh sivavikne...@gmail.comwrote:

 hi can u plz tell me in which areas of aps did they concentrate .. i
 mean the topics...work and time, probability ..like thatthere were
 c / cpp aps ???

 On Aug 16, 7:11 pm, somya mishra somya.bvm...@gmail.com wrote:
  no probs mate all the best
 
 
 
 
 
 
 
  On Tue, Aug 16, 2011 at 10:01 AM, karthik fbk fbk@gmail.com
 wrote:
   thnk you .
 
   On Tue, Aug 16, 2011 at 7:27 PM, somya mishra somya.bvm...@gmail.com
 wrote:
 
   decent level nt very tough bt also nt very easy also
 
   On Tue, Aug 16, 2011 at 6:37 PM, karthik fbk fbk@gmail.com
 wrote:
 
   What about verbal sections ? How tough were verbal questions ?
   What type of questions were asked in verbal section ?
 
   On Tue, Aug 16, 2011 at 6:34 PM, somya mishra 
 somya.bvm...@gmail.comwrote:
 
   ya first round was rs agarwal type question. for gd round do go
   thoroughly thru ur software engineer concepts interview round was
 pretty
   easy jst some general quest nothing much technical
 
   On Tue, Aug 16, 2011 at 6:23 PM, karthik fbk fbk@gmail.com
 wrote:
 
   Have Deloitte visited any of your colleges ?
   If so can you plz share your interview experience ?
   What questions were asked in written ? Were the quants questions
 so
   difficult or as same as R S Agarwal type questions ?
 
   If you have any additional information , plz share it ..
 
   --
   You received this message because you are subscribed to the Google
   Groups Algorithm Geeks group.
   To post to this group, send email to algogeeks@googlegroups.com.
   To unsubscribe from this group, send email to
   algogeeks+unsubscr...@googlegroups.com.
   For more options, visit this group at
  http://groups.google.com/group/algogeeks?hl=en.
 
--
   You received this message because you are subscribed to the Google
   Groups Algorithm Geeks group.
   To post to this group, send email to algogeeks@googlegroups.com.
   To unsubscribe from this group, send email to
   algogeeks+unsubscr...@googlegroups.com.
   For more options, visit this group at
  http://groups.google.com/group/algogeeks?hl=en.
 
--
   You received this message because you are subscribed to the Google
 Groups
   Algorithm Geeks group.
   To post to this group, send email to algogeeks@googlegroups.com.
   To unsubscribe from this group, send email to
   algogeeks+unsubscr...@googlegroups.com.
   For more options, visit this group at
  http://groups.google.com/group/algogeeks?hl=en.
 
--
   You received this message because you are subscribed to the Google
 Groups
   Algorithm Geeks group.
   To post to this group, send email to algogeeks@googlegroups.com.
   To unsubscribe from this group, send email to
   algogeeks+unsubscr...@googlegroups.com.
   For more options, visit this group at
  http://groups.google.com/group/algogeeks?hl=en.
 
--
   You received this message because you are subscribed to the Google
 Groups
   Algorithm Geeks group.
   To post to this group, send email to algogeeks@googlegroups.com.
   To unsubscribe from this group, send email to
   algogeeks+unsubscr...@googlegroups.com.
   For more options, visit this group at
  http://groups.google.com/group/algogeeks?hl=en.

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


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


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



Re: [algogeeks] Re: Puzzle

2011-08-21 Thread rahul aravind
consider the last two cases
N married  L not married
L not married M married
so now tak M and N
compare it with first case
M married N not married
therfore,only m married

On Sun, Aug 21, 2011 at 1:06 PM, Tushar Bindal tushicom...@gmail.comwrote:

 @arun

 if L is not married, then M must be married
 but if L is married then M can be married or not married,
 so if we say L is married to M, there is no problem in that


 On Sun, Aug 21, 2011 at 12:53 PM, Ravindra Singh Poonia 
 ravindrasinghpoo...@gmail.com wrote:

 only M is married


 On Sat, Aug 20, 2011 at 11:24 PM, Puneet Chawla 
 puneetchawla...@gmail.com wrote:

 only M is married.


 On Sat, Aug 20, 2011 at 7:53 PM, Arun Vishwanathan 
 aaron.nar...@gmail.com wrote:

 @DK:if L is married to M according to you finally , then what does the
 third if then statement according to you mean when it is given that if L is
 not married then M is married?


 On Fri, Aug 19, 2011 at 10:35 PM, Dave dave_and_da...@juno.com wrote:

 @DK: What in the statement of the problem led you to believe that
 these were if-then statements?

 Dave

 On Aug 19, 3:15 pm, DK divyekap...@gmail.com wrote:
  Note that in the answer above, the table given is of the form:
 
  If condition is truethen what predicate is true
  -----
  M - married   N - not married
  N - married   L - not married
  L - not married  M - married
 
  --
  DK
 
 
 http://gplus.to/divyekapoorhttp://twitter.com/divyekapoorhttp://www.divye.in

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




 --
  People often say that motivation doesn't last. Well, neither does
 bathing - that's why we recommend it daily.

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




 --
 With regards
   
 Puneet Chawla
 Computer Engineering Student
 NIT Kurukshetra

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




 --
 Thanks  Regards,
 *Ravindra Singh* (RHCE)
 Mobile No. +91-9896949235
 Mail ID- ravindrasinghpoo...@gmail.com
 Computer Engg. Dept. NIT Kurukshetra Haryana (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.




 --
 Tushar Bindal
 Computer Engineering
 Delhi College of Engineering
 Mob: +919818442705
 E-Mail : tushicom...@gmail.com
 Website: www.jugadengg.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.



Re: [algogeeks] Google Question:Given a BST and a number, Find the closest node to that number in the BST.

2011-08-21 Thread rahul aravind
@Abhishek:nice algo dude..

On Sat, Aug 20, 2011 at 12:56 PM, Abhishek Yadav algowithabhis...@gmail.com
 wrote:

 Hey i tried it now and got to another solution
 O(log n) solution:
 1. try searching for the number , if found,return the node, otherwise, you
 will ultimately reach a leaf node say 'nd'
 2.  Now the two candidates for the answer would be
1. TreeSuccessor(nd)  2. TreePredecessor(nd)
 Now compare the original number with these two and minimum would be the
 answer.

 (TreeSuccessor and TreePredecessor are the next and previous node resp. in
 the Inorder traversal of the tree.)

 On Sat, Aug 20, 2011 at 12:46 PM, Dipankar Patro dip10c...@gmail.comwrote:

 why traverse the whole tree?

 at each root keep the difference in a min_diff and min_ele.
 if the entered value is less root then move to left or right.
 repeat above two until whole tree is checked or min_diff becomes 0.

 pseudo code:

 min_diff = INF; // global variables
 min_ele = 0;

 find_min_diff(node *root, int num)
 {

  if (root == null)
  return;

 // update the difference
  if(abs(root-val - num)  min_diff)
  {
   min_diff = abs(root-val - num);
   min_ele = root-val;
  }
  if ( min_diff == 0)
   return; // search is over

 // proceed to next element in tree which might be closer to the num
  if ( num  root- val)
find_min_ele(root-left, num);
  else
find_min_ele(root-right, num);
 }

 ^^ Complexity : O(logn)

 On 20 August 2011 12:36, Abhishek Yadav algowithabhis...@gmail.comwrote:

 yes, the interviewer said that there is a solution in O(log n)


 On Sat, Aug 20, 2011 at 12:29 PM, sukran dhawan 
 sukrandha...@gmail.comwrote:

 ur traversing the tree once so it shud be o(n).does the question demand
 0(logn) ?

 On Sat, Aug 20, 2011 at 12:27 PM, Abhishek Yadav 
 algowithabhis...@gmail.com wrote:

 what would be the complexity of your solution O(n) or O(log n)..?

  On Sat, Aug 20, 2011 at 12:19 PM, sukran dhawan 
 sukrandha...@gmail.com wrote:

 traverse bst inorder and each time u encounter a node find the
 difference between the element and given element in question . if the
 absolute difference is minimum after traversing the tree that is the 
 element
 . u can getback the element using another element which keeps sign of the
 element so that original element can be obtained from diff

 On Sat, Aug 20, 2011 at 12:15 PM, Abhishek Yadav 
 algowithabhis...@gmail.com wrote:

 Given a BST and a number, Find the closest node to that number in the
 BST. Give an algorithm for that.
 Let there be binary search tree having nodes with values
 12,34,64,23,64,25,76,6 and the number given is 28, then the answer
 would be 25 as it is the closest node.

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


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


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


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


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




 --

 ___

 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 

Re: [algogeeks] Re: c question what is output?

2011-08-21 Thread Dipankar Patro
+1 to 16.

whats the confusion here?

On 21 August 2011 16:44, sagar pareek sagarpar...@gmail.com wrote:

 Arey yaar just see the my post...
 i explained it step by step :)


 On Sun, Aug 21, 2011 at 4:43 PM, Sanjay Rajpal srn...@gmail.com wrote:

 16

 8*(8-1*(8-1-1))


 Sanju
 :)



 On Sun, Aug 21, 2011 at 4:10 AM, Anjul Sharma annurocks1...@gmail.comwrote:

 is 336 the answer??

 On Aug 21, 11:10 am, SuDhir mIsHra sudhir08.mis...@gmail.com wrote:
  #includestdio.h
  #define FUNC1(i) (i*(i-1))
  #define FUNC2(i) (i==0?1:i*FUNC1(i-1))
  main()
  {
  int i=8;
 
  printf(\n%d,FUNC2(i));
 
 
 
 
 
 
 
  }

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




-- 
___

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] c++

2011-08-21 Thread Jagannath Prasad Das
Copy constructor should have been called two times!!1

On Sun, Aug 21, 2011 at 1:38 PM, Abhishek Yadav
algowithabhis...@gmail.comwrote:

 what are you trying to say?...can you please explain?h


 On Sun, Aug 21, 2011 at 1:35 PM, JAIDEV YADAV jaid...@gmail.com wrote:

 try to use X b = a ; b.fun() ;

 On Sun, Aug 21, 2011 at 1:33 PM, Abhishek Yadav 
 algowithabhis...@gmail.com wrote:

 ok...may be i forgot , can you please tell me correct code for the copy
 constructor..?


 On Sun, Aug 21, 2011 at 1:31 PM, JAIDEV YADAV jaid...@gmail.com wrote:

 dude u haven't used copy constructor properly .. check it out again ...
 you are not copying actually ... thats it ...

 On Sun, Aug 21, 2011 at 12:53 PM, Abhishek Yadav 
 algowithabhis...@gmail.com wrote:

 Check this code: the thing i couldn't understand is when the object is
 being returned neither the copy constructor is being called nor the
  assignment operator overload is calledthen how the object is being
 copied into b. i don't think default copy constructor should be called if 
 i
 have made our own copy constructor???
 #includeiostream
 using namespace std;
 #includeconio.h

 class X
 {
   public:
   int num;
 X(int a)
 {
 num=a;
  cout\n constructor;
 }

 X(const X t)
  {
 this-num=t.num;
 cout\nCopy ;
  }

 X operator=(const X t)
 {
  this-num =t.num;
 cout\n Assigment   ;
 return t;
  }

 X fun()
 {
cout\nin fun;
return X(7);
  }

 ~X()
 {
 cout\ndestruct ;
  }

 };

 int main()
 {
 {
 X a(1);
X b=a.fun();
cout\n\nb.num;
 }
 getch();
 }


 On Sun, Aug 21, 2011 at 12:33 PM, Abhishek Yadav 
 algowithabhis...@gmail.com wrote:

 The code is correct..return X will make a temporary object and for
 that a constructor and corresponding destructor will be called and that
  object is returned.

 On Sun, Aug 21, 2011 at 12:24 PM, Puneet Chawla 
 puneetchawla...@gmail.com wrote:

 It will show error

 On Sun, Aug 21, 2011 at 12:21 PM, Sanjay Rajpal srn...@gmail.comwrote:

 I think it will not be an error.

 This is because X() will create a temporary object, and when the
 object is returned in the function calling it, then default copy
 constructor will do bitwise copy of data members in the calling
 function.

 Correct me if m wrong.

 On 8/20/11, sachin sabbarwal algowithsac...@gmail.com wrote:
  class X()
  {
 
  X()
  {
  }
 
 
 
  X fun()
  {
  return X();  //error or what?? because constructor never
 returns
  anything so what this return statement will receive after
 executing x() and
  what it will return??
  }
 
 
  };
 
  --
  You received this message because you are subscribed to the Google
 Groups
  Algorithm Geeks group.
  To post to this group, send email to algogeeks@googlegroups.com.
  To unsubscribe from this group, send email to
  algogeeks+unsubscr...@googlegroups.com.
  For more options, visit this group at
  http://groups.google.com/group/algogeeks?hl=en.
 
 


 --
 Sanju
 :)

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




 --
 With regards
   
 Puneet Chawla
 Computer Engineering Student
 NIT Kurukshetra

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




 --
 JaiDev Yadav
 (National Yoga Champion)
 Computer Engg. Dept.
 National Institute of Technology
 Kurukshetra,Haryana

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




 --
 JaiDev Yadav
 (National Yoga Champion)

Re: [algogeeks] C-Question

2011-08-21 Thread Vijay Khandar
Thank u very much Abhishek for this link, Now I got it ...But also u
explain me in following..
5.375 is represents 0100  1010 1100     means 4 0 A C 0
0 0 0in Hex now how it prints 00 00 AC 40 means can it accepts fm right to
left or L to R I m little bit confusing in p[0] p[1] p[2]and p[3]
how these r printing 0 0 AC 40plz Explain
On Sun, Aug 21, 2011 at 4:57 PM, Abhishek mailatabhishekgu...@gmail.comwrote:

 check this link..
 http://en.wikipedia.org/wiki/Single_precision_floating-point_format

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

 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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++

2011-08-21 Thread priya ramesh
it is not an error.

check this code: I compiled it

#includeiostream
using namespace std;

class X
{
public:
X()
{
}
};
main(){

}

X fun()
{
return X();
}

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



Re: [algogeeks] C-Question

2011-08-21 Thread Puneet Chawla
Compiler is little endian so as u have typecasted it to char pointer then
0100  1010 1100     means 4 0 A C 0 0 0 0 it will show
o/p byte by byte from LSB.

On Sun, Aug 21, 2011 at 5:47 PM, Vijay Khandar vijaykhand...@gmail.comwrote:

 Thank u very much Abhishek for this link, Now I got it ...But also
 u explain me in following..
 5.375 is represents 0100  1010 1100     means 4 0 A C 0
 0 0 0in Hex now how it prints 00 00 AC 40 means can it accepts fm right to
 left or L to R I m little bit confusing in p[0] p[1] p[2]and p[3]
 how these r printing 0 0 AC 40plz Explain
  On Sun, Aug 21, 2011 at 4:57 PM, Abhishek 
 mailatabhishekgu...@gmail.comwrote:

 check this link..
 http://en.wikipedia.org/wiki/Single_precision_floating-point_format

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

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




-- 
With regards
  
Puneet

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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-21 Thread Puneet Chawla
forgot to mention last byte 00 then 2nd last 00 and so on AC then 40

On Sun, Aug 21, 2011 at 6:00 PM, Puneet Chawla puneetchawla...@gmail.comwrote:

 Compiler is little endian so as u have typecasted it to char pointer then
 0100  1010 1100     means 4 0 A C 0 0 0 0 it will show
 o/p byte by byte from LSB.


 On Sun, Aug 21, 2011 at 5:47 PM, Vijay Khandar vijaykhand...@gmail.comwrote:

 Thank u very much Abhishek for this link, Now I got it ...But also
 u explain me in following..
 5.375 is represents 0100  1010 1100     means 4 0 A C
 0 0 0 0in Hex now how it prints 00 00 AC 40 means can it accepts fm right to
 left or L to R I m little bit confusing in p[0] p[1] p[2]and p[3]
 how these r printing 0 0 AC 40plz Explain
  On Sun, Aug 21, 2011 at 4:57 PM, Abhishek mailatabhishekgu...@gmail.com
  wrote:

 check this link..
 http://en.wikipedia.org/wiki/Single_precision_floating-point_format

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

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




 --
 With regards
   
 Puneet




-- 
With regards
  
Puneet Chawla
Computer Engineering Student
NIT Kurukshetra

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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-21 Thread Vijay Khandar
I was thinking the same ..byte by byte from R to L thank u very
muchNow i have got it..On Sun, Aug 21, 2011 at 6:01 PM,
Puneet Chawla puneetchawla...@gmail.com wrote:

 forgot to mention last byte 00 then 2nd last 00 and so on AC then 40


 On Sun, Aug 21, 2011 at 6:00 PM, Puneet Chawla 
 puneetchawla...@gmail.comwrote:

 Compiler is little endian so as u have typecasted it to char pointer then
 0100  1010 1100     means 4 0 A C 0 0 0 0 it will show
 o/p byte by byte from LSB.


 On Sun, Aug 21, 2011 at 5:47 PM, Vijay Khandar 
 vijaykhand...@gmail.comwrote:

 Thank u very much Abhishek for this link, Now I got it ...But
 also u explain me in following..
 5.375 is represents 0100  1010 1100     means 4 0 A C
 0 0 0 0in Hex now how it prints 00 00 AC 40 means can it accepts fm right to
 left or L to R I m little bit confusing in p[0] p[1] p[2]and p[3]
 how these r printing 0 0 AC 40plz Explain
   On Sun, Aug 21, 2011 at 4:57 PM, Abhishek 
 mailatabhishekgu...@gmail.com wrote:

 check this link..
 http://en.wikipedia.org/wiki/Single_precision_floating-point_format

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

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




 --
 With regards
   
 Puneet




 --
 With regards
   
 Puneet Chawla
 Computer Engineering Student
 NIT Kurukshetra

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

On Sun, Aug 21, 2011 at 6:01 PM, Puneet Chawla puneetchawla...@gmail.comwrote:

 forgot to mention last byte 00 then 2nd last 00 and so on AC then 40


 On Sun, Aug 21, 2011 at 6:00 PM, Puneet Chawla 
 puneetchawla...@gmail.comwrote:

 Compiler is little endian so as u have typecasted it to char pointer then
 0100  1010 1100     means 4 0 A C 0 0 0 0 it will show
 o/p byte by byte from LSB.


 On Sun, Aug 21, 2011 at 5:47 PM, Vijay Khandar 
 vijaykhand...@gmail.comwrote:

 Thank u very much Abhishek for this link, Now I got it ...But
 also u explain me in following..
 5.375 is represents 0100  1010 1100     means 4 0 A C
 0 0 0 0in Hex now how it prints 00 00 AC 40 means can it accepts fm right to
 left or L to R I m little bit confusing in p[0] p[1] p[2]and p[3]
 how these r printing 0 0 AC 40plz Explain
   On Sun, Aug 21, 2011 at 4:57 PM, Abhishek 
 mailatabhishekgu...@gmail.com wrote:

 check this link..
 http://en.wikipedia.org/wiki/Single_precision_floating-point_format

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

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




 --
 With regards
   
 Puneet




 --
 With regards
   
 Puneet Chawla
 Computer Engineering Student
 NIT Kurukshetra

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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-21 Thread aditya kumar
thnks all . yeah sure will post the questions :)

On Sat, Aug 20, 2011 at 4:29 PM, Akash Mukherjee akash...@gmail.com wrote:

 @aditya - basic os  networking, ds - esp trees(esp bsts)  algo

 if needed, refer cracking the coding interview. do post the questions asked
 once its over :)

 On Sat, Aug 20, 2011 at 4:25 PM, aditya kumar 
 aditya.kumar130...@gmail.com wrote:

 PESIT


 On Sat, Aug 20, 2011 at 4:23 PM, Sanjay Rajpal srn...@gmail.com wrote:

 which college ?


 Sanju
 :)


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

2011-08-21 Thread Jagannath Prasad Das
A(OED)=1/4 A(OCB)  from similarity area relationship
A(OED)+A(ODC)=6;
A(ODC)+A(OCB)=12;
solve them
A(OED)=2 sq units

On Sun, Aug 21, 2011 at 12:06 PM, Greeshma greeshma.0...@gmail.com wrote:

 hey got it!
 the ans s 2 :)

 --
 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/-/r4I_8-_6hy8J.

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

2011-08-21 Thread priya ramesh
A data structure is required for storing a set of integers such that each of
the following operations can be done in (log n) time, where n is the number
of elements in the set. Deletion of the smallest element Insertion of an
element if it is not already present in the set Which of the following data
structures can be used for this purpose?

·  Pick one of the choices


A heap can be used but not a balanced binary search tree


A balanced binary search tree can be used but not a heap


Both balanced binary search tree and heap can be used


Neither balanced binary search tree nor heap can be used

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

2011-08-21 Thread vaibhavmittal11

Hint: It is a dp of the form f(n+3) = a*f(n+2) + b*f(n+1) + c*f(n)
Figure a, b, c urself..

VM
NSIT, Dwarka
3rd year, COE

On , Amol Sharma amolsharm...@gmail.com wrote:
Plz help me in solving a simple problem on spoj  
http://www.spoj.pl/problems/MAIN113/


i am not able to conclude a general formula for any 'n'i derived  
one but found it wrong...plz some one guide !!



--






Amol Sharma
Third Year Student
Computer Science and Engineering
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.



Re: [algogeeks] amazon q

2011-08-21 Thread priya ramesh
so which is the right option??

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

2011-08-21 Thread Akash Mukherjee
heap is true but i am not getting y we can't use a balanced binary tree

searching for the smallest is logn(leftmost node), then deleting it is logn

so, should it be both??

thanx :)

On Sun, Aug 21, 2011 at 6:54 PM, sukran dhawan sukrandha...@gmail.comwrote:

 its heap


 On Sun, Aug 21, 2011 at 6:52 PM, Puneet Chawla 
 puneetchawla...@gmail.comwrote:

 I think Heap DS should be used as to delete smallest element jst apply min
 heap and delete it and for insertion add the element and apply max or min as
 needed Max heap = Min heap both have complexities =O(logn)


 On Sun, Aug 21, 2011 at 6:46 PM, priya ramesh 
 love.for.programm...@gmail.com wrote:

 A data structure is required for storing a set of integers such that each
 of the following operations can be done in (log n) time, where n is the
 number of elements in the set. Deletion of the smallest element Insertion of
 an element if it is not already present in the set Which of the following
 data structures can be used for this purpose?

 ·  Pick one of the choices


 A heap can be used but not a balanced binary search tree


 A balanced binary search tree can be used but not a heap


 Both balanced binary search tree and heap can be used


 Neither balanced binary search tree nor heap can be used

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




 --
 With regards
   
 Puneet Chawla
 Computer Engineering Student
 NIT Kurukshetra

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

2011-08-21 Thread code pool
Can anyone give me an example of big-endian compiler..???

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

2011-08-21 Thread navneet kumar
hi all,
has Directi visited any of your campus?? if yes then can you share some
details...
Regards,
Navneet Kumar

-- 
Department of Information Technology,
Indian Institute of Information Technology and Management Gwalior, MP, INDIA

Contact no.:+91-9977935740

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

2011-08-21 Thread MAC
can anyone suggest good link to review Algos and OS concepts

-- 
thanks
--mac

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

2011-08-21 Thread vartika
Does any one have any idea about the placement procedure of Success
Factors? The kind of questions that they ask in the written test and/
or interview?
Please reply..

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



[algogeeks] Re: any good link?

2011-08-21 Thread Navneet
geeksforgeeks.org
careercup.com

On Aug 21, 7:13 pm, MAC macatad...@gmail.com wrote:
 can anyone suggest good link to review Algos and OS concepts

 --
 thanks
 --mac

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

2011-08-21 Thread sarvesh saran
No idea how to solve the problem except the brute force O(n3) approach.I am
looking for a better solution than this. Because of O(1) complexity you
cannot copy and sort the input.


A zero-indexed array A consisting of N integers is given. A triplet (P, Q,
R) is triangular if and
A[P] + A[Q]  A[R],
A[Q] + A[R]  A[P],
A[R] + A[P]  A[Q].

For example, consider array A such that

A[0] = 10 A[1] = 2 A[2] = 5
A[3] = 1 A[4] = 8 A[5] = 20
Triplet (0, 2, 4) is triangular.

public int triangle(int[] A)

that, given a zero-indexed array A consisting of N integers, returns 1 if
there exists a triangular triplet for this array and returns 0 otherwise.

Assume that:

N is an integer within the range [0..100,000];
each element of array A is an integer within the
range[-2,147,483,648..2,147,483,647].
For example, given array A such that

A[0] = 10 A[1] = 2 A[2] = 5
A[3] = 1 A[4] = 8 A[5] = 20
the function should return 1, as explained above. Given arrayA such that

A[0] = 10 A[1] = 50 A[2] = 5
A[3] = 1
the function should return 0.
Expected worst-case time complexity: O(n log n)
Expected worst-case space complexity: O(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.



Re: [algogeeks] triangle numbers in an array

2011-08-21 Thread Sanjay Rajpal
Simply sort the array and check for a[i]+a[i+1]  a[i+2] for i=0 to n-3.


Sanju
:)



On Sun, Aug 21, 2011 at 7:28 AM, sarvesh saran
aquarian.thun...@gmail.comwrote:

  No idea how to solve the problem except the brute force O(n3) approach.I
 am looking for a better solution than this. Because of O(1) complexity you
 cannot copy and sort the input.


 A zero-indexed array A consisting of N integers is given. A triplet (P, Q,
 R) is triangular if and
 A[P] + A[Q]  A[R],
 A[Q] + A[R]  A[P],
 A[R] + A[P]  A[Q].

 For example, consider array A such that

 A[0] = 10 A[1] = 2 A[2] = 5
 A[3] = 1 A[4] = 8 A[5] = 20
 Triplet (0, 2, 4) is triangular.

 public int triangle(int[] A)

 that, given a zero-indexed array A consisting of N integers, returns 1 if
 there exists a triangular triplet for this array and returns 0 otherwise.

 Assume that:

 N is an integer within the range [0..100,000];
 each element of array A is an integer within the
 range[-2,147,483,648..2,147,483,647].
 For example, given array A such that

 A[0] = 10 A[1] = 2 A[2] = 5
 A[3] = 1 A[4] = 8 A[5] = 20
 the function should return 1, as explained above. Given arrayA such that

 A[0] = 10 A[1] = 50 A[2] = 5
 A[3] = 1
 the function should return 0.
 Expected worst-case time complexity: O(n log n)
 Expected worst-case space complexity: O(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.


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

2011-08-21 Thread sarvesh saran
Hi Sanjay,

*Because of O(1) complexity you cannot copy and sort the input array.

*thanks,
Sarvesh*
*

On Sun, Aug 21, 2011 at 8:00 PM, Sanjay Rajpal srn...@gmail.com wrote:

 Simply sort the array and check for a[i]+a[i+1]  a[i+2] for i=0 to n-3.


 Sanju
 :)



 On Sun, Aug 21, 2011 at 7:28 AM, sarvesh saran aquarian.thun...@gmail.com
  wrote:

  No idea how to solve the problem except the brute force O(n3) approach.I
 am looking for a better solution than this. Because of O(1) complexity you
 cannot copy and sort the input.


 A zero-indexed array A consisting of N integers is given. A triplet (P, Q,
 R) is triangular if and
 A[P] + A[Q]  A[R],
 A[Q] + A[R]  A[P],
 A[R] + A[P]  A[Q].

 For example, consider array A such that

 A[0] = 10 A[1] = 2 A[2] = 5
 A[3] = 1 A[4] = 8 A[5] = 20
 Triplet (0, 2, 4) is triangular.

 public int triangle(int[] A)

 that, given a zero-indexed array A consisting of N integers, returns 1 if
 there exists a triangular triplet for this array and returns 0 otherwise.

 Assume that:

 N is an integer within the range [0..100,000];
 each element of array A is an integer within the
 range[-2,147,483,648..2,147,483,647].
 For example, given array A such that

 A[0] = 10 A[1] = 2 A[2] = 5
 A[3] = 1 A[4] = 8 A[5] = 20
 the function should return 1, as explained above. Given arrayA such that

 A[0] = 10 A[1] = 50 A[2] = 5
 A[3] = 1
 the function should return 0.
 Expected worst-case time complexity: O(n log n)
 Expected worst-case space complexity: O(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.


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

2011-08-21 Thread Sanjay Rajpal
By O(1) we mean that we can use variables, can't use something that equals
size of the i/p array.

Use Quick sort, sorting is done in-place which O(n log n) in time, and O(1)
in space.
Sanju
:)



On Sun, Aug 21, 2011 at 7:31 AM, sarvesh saran
aquarian.thun...@gmail.comwrote:

 Hi Sanjay,

 *Because of O(1) complexity you cannot copy and sort the input array.

 *thanks,
 Sarvesh
  *
 *

 On Sun, Aug 21, 2011 at 8:00 PM, Sanjay Rajpal srn...@gmail.com wrote:

  Simply sort the array and check for a[i]+a[i+1]  a[i+2] for i=0 to n-3.


 Sanju
 :)



   On Sun, Aug 21, 2011 at 7:28 AM, sarvesh saran 
 aquarian.thun...@gmail.com wrote:

No idea how to solve the problem except the brute force O(n3)
 approach.I am looking for a better solution than this. Because of O(1)
 complexity you cannot copy and sort the input.


 A zero-indexed array A consisting of N integers is given. A triplet (P,
 Q, R) is triangular if and
 A[P] + A[Q]  A[R],
 A[Q] + A[R]  A[P],
 A[R] + A[P]  A[Q].

 For example, consider array A such that

 A[0] = 10 A[1] = 2 A[2] = 5
 A[3] = 1 A[4] = 8 A[5] = 20
 Triplet (0, 2, 4) is triangular.

 public int triangle(int[] A)

 that, given a zero-indexed array A consisting of N integers, returns 1 if
 there exists a triangular triplet for this array and returns 0 otherwise.

 Assume that:

 N is an integer within the range [0..100,000];
 each element of array A is an integer within the
 range[-2,147,483,648..2,147,483,647].
 For example, given array A such that

 A[0] = 10 A[1] = 2 A[2] = 5
 A[3] = 1 A[4] = 8 A[5] = 20
 the function should return 1, as explained above. Given arrayA such that

 A[0] = 10 A[1] = 50 A[2] = 5
 A[3] = 1
 the function should return 0.
 Expected worst-case time complexity: O(n log n)
 Expected worst-case space complexity: O(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.


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

2011-08-21 Thread sarvesh saran
Hi Sanjay,

The input is a constant vector. So it cannot be modified. Space requirement
is O(1) so it cannot be copied.

thanks,
Sarvesh

On Sun, Aug 21, 2011 at 8:04 PM, Sanjay Rajpal srn...@gmail.com wrote:

 By O(1) we mean that we can use variables, can't use something that equals
 size of the i/p array.

 Use Quick sort, sorting is done in-place which O(n log n) in time, and O(1)
 in space.
 Sanju
 :)



 On Sun, Aug 21, 2011 at 7:31 AM, sarvesh saran aquarian.thun...@gmail.com
  wrote:

 Hi Sanjay,

 *Because of O(1) complexity you cannot copy and sort the input array.

 *thanks,
 Sarvesh
  *
 *

 On Sun, Aug 21, 2011 at 8:00 PM, Sanjay Rajpal srn...@gmail.com wrote:

  Simply sort the array and check for a[i]+a[i+1]  a[i+2] for i=0 to
 n-3.


 Sanju
 :)



   On Sun, Aug 21, 2011 at 7:28 AM, sarvesh saran 
 aquarian.thun...@gmail.com wrote:

No idea how to solve the problem except the brute force O(n3)
 approach.I am looking for a better solution than this. Because of O(1)
 complexity you cannot copy and sort the input.


 A zero-indexed array A consisting of N integers is given. A triplet (P,
 Q, R) is triangular if and
 A[P] + A[Q]  A[R],
 A[Q] + A[R]  A[P],
 A[R] + A[P]  A[Q].

 For example, consider array A such that

 A[0] = 10 A[1] = 2 A[2] = 5
 A[3] = 1 A[4] = 8 A[5] = 20
 Triplet (0, 2, 4) is triangular.

 public int triangle(int[] A)

 that, given a zero-indexed array A consisting of N integers, returns 1
 if there exists a triangular triplet for this array and returns 0 
 otherwise.

 Assume that:

 N is an integer within the range [0..100,000];
 each element of array A is an integer within the
 range[-2,147,483,648..2,147,483,647].
 For example, given array A such that

 A[0] = 10 A[1] = 2 A[2] = 5
 A[3] = 1 A[4] = 8 A[5] = 20
 the function should return 1, as explained above. Given arrayA such that

 A[0] = 10 A[1] = 50 A[2] = 5
 A[3] = 1
 the function should return 0.
 Expected worst-case time complexity: O(n log n)
 Expected worst-case space complexity: O(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.


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


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


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


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



[algogeeks] Doubt

2011-08-21 Thread Nikhil Gupta
http://www.ideone.com/kRaMj

I found this in the algogeeks forum only. Can anyone explain how value of i
is still 0, but *p shows 2 although their addresses are the same.

-- 
Nikhil Gupta

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

2011-08-21 Thread sarvesh saran
Hi Sanjay

I think i forgot to mention that in my original post..so sorry about that.
It is a constant array and should not be modified.

thanks,
Sarvesh



On Sun, Aug 21, 2011 at 8:08 PM, sarvesh saran
aquarian.thun...@gmail.comwrote:

 Hi Sanjay,

 The input is a constant vector. So it cannot be modified. Space requirement
 is O(1) so it cannot be copied.

 thanks,
 Sarvesh


 On Sun, Aug 21, 2011 at 8:04 PM, Sanjay Rajpal srn...@gmail.com wrote:

 By O(1) we mean that we can use variables, can't use something that equals
 size of the i/p array.

 Use Quick sort, sorting is done in-place which O(n log n) in time, and
 O(1) in space.
 Sanju
 :)



 On Sun, Aug 21, 2011 at 7:31 AM, sarvesh saran 
 aquarian.thun...@gmail.com wrote:

 Hi Sanjay,

 *Because of O(1) complexity you cannot copy and sort the input array.

 *thanks,
 Sarvesh
  *
 *

 On Sun, Aug 21, 2011 at 8:00 PM, Sanjay Rajpal srn...@gmail.com wrote:

  Simply sort the array and check for a[i]+a[i+1]  a[i+2] for i=0 to
 n-3.


 Sanju
 :)



   On Sun, Aug 21, 2011 at 7:28 AM, sarvesh saran 
 aquarian.thun...@gmail.com wrote:

No idea how to solve the problem except the brute force O(n3)
 approach.I am looking for a better solution than this. Because of O(1)
 complexity you cannot copy and sort the input.


 A zero-indexed array A consisting of N integers is given. A triplet (P,
 Q, R) is triangular if and
 A[P] + A[Q]  A[R],
 A[Q] + A[R]  A[P],
 A[R] + A[P]  A[Q].

 For example, consider array A such that

 A[0] = 10 A[1] = 2 A[2] = 5
 A[3] = 1 A[4] = 8 A[5] = 20
 Triplet (0, 2, 4) is triangular.

 public int triangle(int[] A)

 that, given a zero-indexed array A consisting of N integers, returns 1
 if there exists a triangular triplet for this array and returns 0 
 otherwise.

 Assume that:

 N is an integer within the range [0..100,000];
 each element of array A is an integer within the
 range[-2,147,483,648..2,147,483,647].
 For example, given array A such that

 A[0] = 10 A[1] = 2 A[2] = 5
 A[3] = 1 A[4] = 8 A[5] = 20
 the function should return 1, as explained above. Given arrayA such
 that

 A[0] = 10 A[1] = 50 A[2] = 5
 A[3] = 1
 the function should return 0.
 Expected worst-case time complexity: O(n log n)
 Expected worst-case space complexity: O(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.


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

2011-08-21 Thread MAC
thanks .. any os specific ??

--mac

On Sun, Aug 21, 2011 at 7:57 PM, Navneet navneetn...@gmail.com wrote:

 geeksforgeeks.org
 careercup.com

 On Aug 21, 7:13 pm, MAC macatad...@gmail.com wrote:
  can anyone suggest good link to review Algos and OS concepts
 
  --
  thanks
  --mac

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




-- 
thanks
--mac

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

2011-08-21 Thread Ankur Khurana
can somebody please explain this ?

On Sun, Aug 21, 2011 at 8:08 PM, Nikhil Gupta nikhilgupta2...@gmail.comwrote:

 http://www.ideone.com/kRaMj

 I found this in the algogeeks forum only. Can anyone explain how value of i
 is still 0, but *p shows 2 although their addresses are the same.

 --
 Nikhil Gupta

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




-- 
Ankur Khurana
Computer Science
Netaji Subhas Institute Of Technology
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] triangle numbers in an array

2011-08-21 Thread sarvesh saran
Hi,

I have posted this in stackoverflow. So you may choose to join here as well
(this question was asked in an adobe written test)

http://stackoverflow.com/questions/7138874/find-triangular-triplet-in-an-array

thanks,
Sarvesh

On Sun, Aug 21, 2011 at 8:09 PM, sarvesh saran
aquarian.thun...@gmail.comwrote:

 Hi Sanjay

 I think i forgot to mention that in my original post..so sorry about that.
 It is a constant array and should not be modified.

 thanks,
 Sarvesh




 On Sun, Aug 21, 2011 at 8:08 PM, sarvesh saran aquarian.thun...@gmail.com
  wrote:

 Hi Sanjay,

 The input is a constant vector. So it cannot be modified. Space
 requirement is O(1) so it cannot be copied.

 thanks,
 Sarvesh


 On Sun, Aug 21, 2011 at 8:04 PM, Sanjay Rajpal srn...@gmail.com wrote:

 By O(1) we mean that we can use variables, can't use something that
 equals size of the i/p array.

 Use Quick sort, sorting is done in-place which O(n log n) in time, and
 O(1) in space.
 Sanju
 :)



 On Sun, Aug 21, 2011 at 7:31 AM, sarvesh saran 
 aquarian.thun...@gmail.com wrote:

 Hi Sanjay,

 *Because of O(1) complexity you cannot copy and sort the input array.

 *thanks,
 Sarvesh
  *
 *

 On Sun, Aug 21, 2011 at 8:00 PM, Sanjay Rajpal srn...@gmail.comwrote:

  Simply sort the array and check for a[i]+a[i+1]  a[i+2] for i=0 to
 n-3.


 Sanju
 :)



   On Sun, Aug 21, 2011 at 7:28 AM, sarvesh saran 
 aquarian.thun...@gmail.com wrote:

No idea how to solve the problem except the brute force O(n3)
 approach.I am looking for a better solution than this. Because of O(1)
 complexity you cannot copy and sort the input.


 A zero-indexed array A consisting of N integers is given. A triplet
 (P, Q, R) is triangular if and
 A[P] + A[Q]  A[R],
 A[Q] + A[R]  A[P],
 A[R] + A[P]  A[Q].

 For example, consider array A such that

 A[0] = 10 A[1] = 2 A[2] = 5
 A[3] = 1 A[4] = 8 A[5] = 20
 Triplet (0, 2, 4) is triangular.

 public int triangle(int[] A)

 that, given a zero-indexed array A consisting of N integers, returns 1
 if there exists a triangular triplet for this array and returns 0 
 otherwise.

 Assume that:

 N is an integer within the range [0..100,000];
 each element of array A is an integer within the
 range[-2,147,483,648..2,147,483,647].
 For example, given array A such that

 A[0] = 10 A[1] = 2 A[2] = 5
 A[3] = 1 A[4] = 8 A[5] = 20
 the function should return 1, as explained above. Given arrayA such
 that

 A[0] = 10 A[1] = 50 A[2] = 5
 A[3] = 1
 the function should return 0.
 Expected worst-case time complexity: O(n log n)
 Expected worst-case space complexity: O(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.


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

2011-08-21 Thread Kamakshii Aggarwal
But on dev c it is showing o/p as 2 2 ..
I too have a doubt,a similar question was asked in atrenta's written paper.

On Sun, Aug 21, 2011 at 8:14 PM, Ankur Khurana ankur.kkhur...@gmail.comwrote:

 can somebody please explain this ?


 On Sun, Aug 21, 2011 at 8:08 PM, Nikhil Gupta 
 nikhilgupta2...@gmail.comwrote:

 http://www.ideone.com/kRaMj

 I found this in the algogeeks forum only. Can anyone explain how value of
 i is still 0, but *p shows 2 although their addresses are the same.

 --
 Nikhil Gupta

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




 --
 Ankur Khurana
 Computer Science
 Netaji Subhas Institute Of Technology
 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.




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



Re: [algogeeks] triangle numbers in an array

2011-08-21 Thread Sanjay Rajpal
if u r saying i/p array can't be modified and complexity O(n logn)time and
O(1) space, then i dont there exists any way to do that.

if complexity is not the matter, then brute force way of three nested loops
is the solution O(n^3) since here the original array will not be modified.


Sanju
:)



On Sun, Aug 21, 2011 at 7:48 AM, sarvesh saran
aquarian.thun...@gmail.comwrote:

 Hi,

 I have posted this in stackoverflow. So you may choose to join here as well
 (this question was asked in an adobe written test)


 http://stackoverflow.com/questions/7138874/find-triangular-triplet-in-an-array

 thanks,
 Sarvesh


 On Sun, Aug 21, 2011 at 8:09 PM, sarvesh saran aquarian.thun...@gmail.com
  wrote:

 Hi Sanjay

 I think i forgot to mention that in my original post..so sorry about that.
 It is a constant array and should not be modified.

 thanks,
 Sarvesh




 On Sun, Aug 21, 2011 at 8:08 PM, sarvesh saran 
 aquarian.thun...@gmail.com wrote:

 Hi Sanjay,

 The input is a constant vector. So it cannot be modified. Space
 requirement is O(1) so it cannot be copied.

 thanks,
 Sarvesh


 On Sun, Aug 21, 2011 at 8:04 PM, Sanjay Rajpal srn...@gmail.com wrote:

  By O(1) we mean that we can use variables, can't use something that
 equals size of the i/p array.

 Use Quick sort, sorting is done in-place which O(n log n) in time, and
 O(1) in space.
 Sanju
 :)



 On Sun, Aug 21, 2011 at 7:31 AM, sarvesh saran 
 aquarian.thun...@gmail.com wrote:

 Hi Sanjay,

 *Because of O(1) complexity you cannot copy and sort the input array.

 *thanks,
 Sarvesh
  *
 *

 On Sun, Aug 21, 2011 at 8:00 PM, Sanjay Rajpal srn...@gmail.comwrote:

  Simply sort the array and check for a[i]+a[i+1]  a[i+2] for i=0 to
 n-3.


 Sanju
 :)



   On Sun, Aug 21, 2011 at 7:28 AM, sarvesh saran 
 aquarian.thun...@gmail.com wrote:

No idea how to solve the problem except the brute force O(n3)
 approach.I am looking for a better solution than this. Because of O(1)
 complexity you cannot copy and sort the input.


 A zero-indexed array A consisting of N integers is given. A triplet
 (P, Q, R) is triangular if and
 A[P] + A[Q]  A[R],
 A[Q] + A[R]  A[P],
 A[R] + A[P]  A[Q].

 For example, consider array A such that

 A[0] = 10 A[1] = 2 A[2] = 5
 A[3] = 1 A[4] = 8 A[5] = 20
 Triplet (0, 2, 4) is triangular.

 public int triangle(int[] A)

 that, given a zero-indexed array A consisting of N integers, returns
 1 if there exists a triangular triplet for this array and returns 0
 otherwise.

 Assume that:

 N is an integer within the range [0..100,000];
 each element of array A is an integer within the
 range[-2,147,483,648..2,147,483,647].
 For example, given array A such that

 A[0] = 10 A[1] = 2 A[2] = 5
 A[3] = 1 A[4] = 8 A[5] = 20
 the function should return 1, as explained above. Given arrayA such
 that

 A[0] = 10 A[1] = 50 A[2] = 5
 A[3] = 1
 the function should return 0.
 Expected worst-case time complexity: O(n log n)
 Expected worst-case space complexity: O(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.


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


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


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




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


-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this 

Re: [algogeeks] triangle numbers in an array

2011-08-21 Thread Sanjay Rajpal
after sorting the array, check if the sum of first two elements in sorted
array is  third element, if it is true, then all the conditions will hold,
otherwise proceed with 2nd,3rd and 4th element.

keep doing till u find a triplet, there u break out of the loop.
Sanju
:)



On Sun, Aug 21, 2011 at 8:24 AM, sarvesh saran
aquarian.thun...@gmail.comwrote:

 Hi Sanjay,

 Yes. That makes sense.

 What do I do after the array is sorted?


 thanks,
 Sarvesh


 On Sun, Aug 21, 2011 at 8:40 PM, Sanjay Rajpal srn...@gmail.com wrote:

  if u r saying i/p array can't be modified and complexity O(n logn)time
 and O(1) space, then i dont there exists any way to do that.

 if complexity is not the matter, then brute force way of three nested
 loops is the solution O(n^3) since here the original array will not be
 modified.


 Sanju
 :)



 On Sun, Aug 21, 2011 at 7:48 AM, sarvesh saran 
 aquarian.thun...@gmail.com wrote:

 Hi,

 I have posted this in stackoverflow. So you may choose to join here as
 well (this question was asked in an adobe written test)


 http://stackoverflow.com/questions/7138874/find-triangular-triplet-in-an-array

 thanks,
 Sarvesh


 On Sun, Aug 21, 2011 at 8:09 PM, sarvesh saran 
 aquarian.thun...@gmail.com wrote:

 Hi Sanjay

 I think i forgot to mention that in my original post..so sorry about
 that. It is a constant array and should not be modified.

 thanks,
 Sarvesh




 On Sun, Aug 21, 2011 at 8:08 PM, sarvesh saran 
 aquarian.thun...@gmail.com wrote:

 Hi Sanjay,

 The input is a constant vector. So it cannot be modified. Space
 requirement is O(1) so it cannot be copied.

 thanks,
 Sarvesh


 On Sun, Aug 21, 2011 at 8:04 PM, Sanjay Rajpal srn...@gmail.comwrote:

  By O(1) we mean that we can use variables, can't use something that
 equals size of the i/p array.

 Use Quick sort, sorting is done in-place which O(n log n) in time, and
 O(1) in space.
 Sanju
 :)



 On Sun, Aug 21, 2011 at 7:31 AM, sarvesh saran 
 aquarian.thun...@gmail.com wrote:

 Hi Sanjay,

 *Because of O(1) complexity you cannot copy and sort the input
 array.

 *thanks,
 Sarvesh
  *
 *

 On Sun, Aug 21, 2011 at 8:00 PM, Sanjay Rajpal srn...@gmail.comwrote:

  Simply sort the array and check for a[i]+a[i+1]  a[i+2] for i=0
 to n-3.


 Sanju
 :)



   On Sun, Aug 21, 2011 at 7:28 AM, sarvesh saran 
 aquarian.thun...@gmail.com wrote:

No idea how to solve the problem except the brute force O(n3)
 approach.I am looking for a better solution than this. Because of O(1)
 complexity you cannot copy and sort the input.


 A zero-indexed array A consisting of N integers is given. A triplet
 (P, Q, R) is triangular if and
 A[P] + A[Q]  A[R],
 A[Q] + A[R]  A[P],
 A[R] + A[P]  A[Q].

 For example, consider array A such that

 A[0] = 10 A[1] = 2 A[2] = 5
 A[3] = 1 A[4] = 8 A[5] = 20
 Triplet (0, 2, 4) is triangular.

 public int triangle(int[] A)

 that, given a zero-indexed array A consisting of N integers,
 returns 1 if there exists a triangular triplet for this array and 
 returns 0
 otherwise.

 Assume that:

 N is an integer within the range [0..100,000];
 each element of array A is an integer within the
 range[-2,147,483,648..2,147,483,647].
 For example, given array A such that

 A[0] = 10 A[1] = 2 A[2] = 5
 A[3] = 1 A[4] = 8 A[5] = 20
 the function should return 1, as explained above. Given arrayA such
 that

 A[0] = 10 A[1] = 50 A[2] = 5
 A[3] = 1
 the function should return 0.
 Expected worst-case time complexity: O(n log n)
 Expected worst-case space complexity: O(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.


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

Re: [algogeeks] amazon q

2011-08-21 Thread Nikhil Gupta
Its both. Both can perform the operations in a maximum of O(logn) time.

On Sun, Aug 21, 2011 at 7:13 PM, priya ramesh 
love.for.programm...@gmail.com wrote:

 i have the same doubt :)


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




-- 
Nikhil Gupta
Senior Co-ordinator, Publicity
CSI, NSIT Students' Branch
NSIT, New Delhi, 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] triangle numbers in an array

2011-08-21 Thread sarvesh saran
thanks a lot sanjay! will try that immediately.

I have another problem to solve. It has a rather long description? Can I
send you an email for it instead?

thanks,
Sarvesh

On Sun, Aug 21, 2011 at 8:59 PM, Sanjay Rajpal srn...@gmail.com wrote:

 after sorting the array, check if the sum of first two elements in sorted
 array is  third element, if it is true, then all the conditions will hold,
 otherwise proceed with 2nd,3rd and 4th element.

 keep doing till u find a triplet, there u break out of the loop.
 Sanju
 :)



 On Sun, Aug 21, 2011 at 8:24 AM, sarvesh saran aquarian.thun...@gmail.com
  wrote:

 Hi Sanjay,

 Yes. That makes sense.

 What do I do after the array is sorted?


 thanks,
 Sarvesh


 On Sun, Aug 21, 2011 at 8:40 PM, Sanjay Rajpal srn...@gmail.com wrote:

  if u r saying i/p array can't be modified and complexity O(n logn)time
 and O(1) space, then i dont there exists any way to do that.

 if complexity is not the matter, then brute force way of three nested
 loops is the solution O(n^3) since here the original array will not be
 modified.


 Sanju
 :)



 On Sun, Aug 21, 2011 at 7:48 AM, sarvesh saran 
 aquarian.thun...@gmail.com wrote:

 Hi,

 I have posted this in stackoverflow. So you may choose to join here as
 well (this question was asked in an adobe written test)


 http://stackoverflow.com/questions/7138874/find-triangular-triplet-in-an-array

 thanks,
 Sarvesh


 On Sun, Aug 21, 2011 at 8:09 PM, sarvesh saran 
 aquarian.thun...@gmail.com wrote:

 Hi Sanjay

 I think i forgot to mention that in my original post..so sorry about
 that. It is a constant array and should not be modified.

 thanks,
 Sarvesh




 On Sun, Aug 21, 2011 at 8:08 PM, sarvesh saran 
 aquarian.thun...@gmail.com wrote:

 Hi Sanjay,

 The input is a constant vector. So it cannot be modified. Space
 requirement is O(1) so it cannot be copied.

 thanks,
 Sarvesh


 On Sun, Aug 21, 2011 at 8:04 PM, Sanjay Rajpal srn...@gmail.comwrote:

  By O(1) we mean that we can use variables, can't use something that
 equals size of the i/p array.

 Use Quick sort, sorting is done in-place which O(n log n) in time,
 and O(1) in space.
 Sanju
 :)



 On Sun, Aug 21, 2011 at 7:31 AM, sarvesh saran 
 aquarian.thun...@gmail.com wrote:

 Hi Sanjay,

 *Because of O(1) complexity you cannot copy and sort the input
 array.

 *thanks,
 Sarvesh
  *
 *

 On Sun, Aug 21, 2011 at 8:00 PM, Sanjay Rajpal srn...@gmail.comwrote:

  Simply sort the array and check for a[i]+a[i+1]  a[i+2] for i=0
 to n-3.


 Sanju
 :)



   On Sun, Aug 21, 2011 at 7:28 AM, sarvesh saran 
 aquarian.thun...@gmail.com wrote:

No idea how to solve the problem except the brute force O(n3)
 approach.I am looking for a better solution than this. Because of 
 O(1)
 complexity you cannot copy and sort the input.


 A zero-indexed array A consisting of N integers is given. A
 triplet (P, Q, R) is triangular if and
 A[P] + A[Q]  A[R],
 A[Q] + A[R]  A[P],
 A[R] + A[P]  A[Q].

 For example, consider array A such that

 A[0] = 10 A[1] = 2 A[2] = 5
 A[3] = 1 A[4] = 8 A[5] = 20
 Triplet (0, 2, 4) is triangular.

 public int triangle(int[] A)

 that, given a zero-indexed array A consisting of N integers,
 returns 1 if there exists a triangular triplet for this array and 
 returns 0
 otherwise.

 Assume that:

 N is an integer within the range [0..100,000];
 each element of array A is an integer within the
 range[-2,147,483,648..2,147,483,647].
 For example, given array A such that

 A[0] = 10 A[1] = 2 A[2] = 5
 A[3] = 1 A[4] = 8 A[5] = 20
 the function should return 1, as explained above. Given arrayA
 such that

 A[0] = 10 A[1] = 50 A[2] = 5
 A[3] = 1
 the function should return 0.
 Expected worst-case time complexity: O(n log n)
 Expected worst-case space complexity: O(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.


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

[algogeeks] FIORANO

2011-08-21 Thread cdr
Has Fiorano come 4 recruitment anywhere...?Plz tell me abt the written test 
and interview process...thanks in advance

-- 
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/-/gngjkPjBIpYJ.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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: another q on ds!

2011-08-21 Thread Dumanshu
first option is correct. Because we are not allowed to use any extra
space.

On Aug 21, 6:36 pm, priya ramesh love.for.programm...@gmail.com
wrote:
 A Most efficient data structure is designed to optimize the following
 operations. Pop, Push, Min. The best possible time-complexities with no
 extra space, respectively would be:

 ·  Pick one of the choices

 O(1), O(1), O(N)

 O(1), O(N), O(1)

 O(N), O(1), O(1)

 O(1), O(1), O(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.



Re: [algogeeks] SAP!!

2011-08-21 Thread Kamakshii Aggarwal
which college?

On Sun, Aug 21, 2011 at 8:56 PM, rashmi i rash...@gmail.com wrote:


 Hey, SAP is visiting our college. Any idea about the pattern of the campus
 selection  process? As in type of questions asked? Thanks
 --
 R@$!-!
 DoN'T LimIt Ur cHaLlEngeS, ChAlLenGe uR LImItS.

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



[algogeeks] Re: amazon q

2011-08-21 Thread Dumanshu
We can't use a heap. Balanced BST is correct because Deletion of the
smallest element Insertion of an
element if it is not already present in the set - for this we need
to search for the element and searching in heap is O(n).

On Aug 21, 6:16 pm, priya ramesh love.for.programm...@gmail.com
wrote:
 A data structure is required for storing a set of integers such that each of
 the following operations can be done in (log n) time, where n is the number
 of elements in the set. Deletion of the smallest element Insertion of an
 element if it is not already present in the set Which of the following data
 structures can be used for this purpose?

 ·  Pick one of the choices

 A heap can be used but not a balanced binary search tree

 A balanced binary search tree can be used but not a heap

 Both balanced binary search tree and heap can be used

 Neither balanced binary search tree nor heap can be used

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