[algogeeks] Re: Highest reminder

2013-05-27 Thread Nikhil Kumar
Since we need to divide so the quotient should be at least 1, and we need greatest remainder, so we need the least no. which will give the quotient 1 upon dividing and that would be the no. you described. Also you would have noted the greatest remainder would be floor(n/2)-1 . On Thursday, 16 M

Re: [algogeeks] stack. Mid element in o(1)

2013-05-27 Thread Nikhil Agarwal
geeks+unsubscr...@googlegroups.com. >> >> >> > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to algogeeks+un

Re: [algogeeks] Number of paths

2013-02-21 Thread Nikhil Karnwal
No. of paths =(n+m-2)C(n-1) Total number of times u have to change the column is m-1 and row is n-1 thus u have total (n-1+m-1) operations to do and out of these operations u have to choose n-1 operation for changing rows. ok. On Thu, Feb 21, 2013 at 2:29 PM, Karthikeyan V.B wrote: > Assuming

[algogeeks] Crypt arithmetic!! Needed help in solving..

2013-02-01 Thread nikhil rao
Pls help needed in solving the below problem.. 1 )MULTIPLICATION TYPE A B C * D E C F G H I A C * A C A E * * A F A E C H 2. P X B * W Y A O A Z O O N X W * O X N P * * - O X N Z N O

Re: [algogeeks] Puzzle.. How to solve??

2013-01-30 Thread nikhil rao
Ya your rite Anmol . 4th was wrong i guess.. incomplete question. On Tuesday, 29 January 2013 12:58:07 UTC+5:30, Anmol Dhar wrote: > > Answer: > 1)-> (4) > 2)--> (2) > 3)---> (a) > 4)> doubt, for which team match fees you are asking? > 5)> (b) > Correct me if i'm wrong.

Re: [algogeeks] Puzzle.. How to solve??

2013-01-30 Thread nikhil rao
16 (From Team 5), 8 (From Team 8) > U -> 15 , 1 , 5 (From Team 3), 13 (From Team 8) > > Rewriting it. > L -> 2,3,4,6,8,9,16 > C -> 7,10,11,12,14 > U -> 1,5,13,15 > > > Now, all the questions can be answered. > Hope I'm cleared. > > Thanks &

Re: [algogeeks] Re: DP equation for interval problem

2013-01-29 Thread Nikhil Karnwal
n, Jan 28, 2013 at 12:54 AM, Nikhil Karnwal wrote: > >> Actually dp[i] represent the state in which u make a slice at appearing >> time of i th fruits.and match represent the overlapping fruits >> with i. >> so >> for each i dp[i]=max(dp[i],dp[j]+match); >> for a

[algogeeks] Puzzle.. How to solve??

2013-01-28 Thread nikhil rao
Dream teams are formed by television viewers by selecting five players from the sixteen players namely F1,F2,F3,F4,F5,F6,F7,F8,F9,F10,F11,F12,F13,F14,F15 and F16.The players belong to exactly one of the three teams namely Chelsea,Liverpool and United.Every Dream Team must have two players each

Re: [algogeeks] Re: DP equation for interval problem

2013-01-27 Thread Nikhil Karnwal
Actually dp[i] represent the state in which u make a slice at appearing time of i th fruits.and match represent the overlapping fruits with i. so for each i dp[i]=max(dp[i],dp[j]+match); for all j=[0,i] and match =overlapped fruits with i which are not sliced until the cut of j. Hope this will help

Re: [algogeeks] Re: Amazon Dynamic Programming problem

2013-01-16 Thread Nikhil Karnwal
This is a impartial game similar to *Take Away Game* that can be solved using game theory. solution of *lucifier* is correct. On Wed, Jan 16, 2013 at 1:57 AM, Don wrote: > Sprague–Grundy theorem > > On Jan 12, 6:28 pm, Nguyễn Thành Danh > wrote: > > Can you please explain by which theorem you u

Re: [algogeeks] Re: Minimum sum of Array

2013-01-07 Thread Nikhil Karnwal
@ Don but ur's solution complexity is O(S*N) which is large in case of large N and large numbers. Like in case of s=100 and N=10^5. Correct me if I am wrong. Nikhil Karnwal On Mon, Jan 7, 2013 at 9:04 PM, Don wrote: > Note that you don't need to store the entire P matrix. Yo

Re: [algogeeks] Re: Interview Question based on histogram

2012-05-20 Thread Nikhil Agarwal
d bar > i has height H[i], 0<=i plane is at zero. Water is held in the "pockets" between bars. Then > the "pocket" between H[i] and H[i+1] holds min(H[i],H[i+1]). To get > the total, just sum these for 0 <= i < N-1 . > > On May 17, 1:57 am, Nikhil A

Re: [algogeeks] new social network (be the owner of the website)

2012-05-14 Thread Nikhil Mishra
Company ain't listed yet. Even it gets, think about Offshore funds :-) -Nikhil On Mon, May 14, 2012 at 7:20 PM, abhi mehrotra < abhishekmehrotra.i...@gmail.com> wrote: > Not at all a spam dude just try googling "zurker" and read about it. > > regards > Abhi

Re: [algogeeks] new social network (be the owner of the website)

2012-05-14 Thread Nikhil Mishra
Definitely a spam ! :-) . Add + 1... On Mon, May 14, 2012 at 8:39 AM, abhi mehrotra < abhishekmehrotra.i...@gmail.com> wrote: > nope its real social network!! > > > On Sun, May 13, 2012 at 11:14 PM, Rahul wrote: > >> spam >> >> On 5/13/12, abhi mehrotra wrote: >> > Guys, >> > >> > As u all know

[algogeeks] Array Summation

2011-11-10 Thread Nikhil Kumar
--- Can you give me the algorithm to add using the above c array in the way desired in multiplication ( be careful about the way numbers are stored) -- Thank You and Regards, Nikhil Kumar +91-9916343619 Product Engineer Commonfloor.com -- You received this message because you are subscribed to

Re: [algogeeks] plzzzzzzzz heeeppppp!!!!!!!!!!1

2011-09-15 Thread Nikhil Kumar
; To unsubscribe from 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 Kumar , Software Engineer @ Ciena Gurgaon. B.E.( Information Technology ) , NSIT Delhi , 2007-201

Re: [algogeeks] plzzzzzzzz heeeppppp!!!!!!!!!!1

2011-09-14 Thread Nikhil Kumar
gt; To post to this group, send email to algogeeks@googlegroups.com. > To unsubscribe from 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 Kumar , Software E

Re: [algogeeks] Pgm

2011-09-11 Thread Nikhil Gupta
.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 a

Re: [algogeeks] printf

2011-09-03 Thread Nikhil Gupta
geeks@googlegroups.com. > To unsubscribe from 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'

Re: [algogeeks] Re: SAP!!

2011-08-31 Thread Nikhil Gupta
cribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to algogeeks@googlegroups.com. > To unsubscribe from this group, send email to > algogeeks+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google

[algogeeks] Pointer

2011-08-30 Thread Nikhil Gupta
I read a question : To swap two given strings using pointers. Are we supposed to declare two pointers and exchange their values, or use these pointers to swap each element of the two strings one by one? -- Nikhil Gupta NSIT, New Delhi, India -- You received this message because you are

[algogeeks] Some bit manipulation help

2011-08-28 Thread Nikhil Gupta
t) *&* mask[i]); *return* x; } Can anyone explain how this is working? -- 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 p

[algogeeks] Doubt

2011-08-28 Thread Nikhil Gupta
The following C program segfaults of IA-64, but works fine on IA-32. *int* main() { *int p; p *=* (*int)malloc(*sizeof*(*int*)); ***p *=* 10; *return* 0; } Why does it happen so? -- Nikhil Gupta Senior Co-ordinator, Publicity CSI, NSIT Students' B

Re: [algogeeks] Re: map problem

2011-08-24 Thread Nikhil Kumar
Post your pair functions ..I'm sure you're wrong there! -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@goog

Re: [algogeeks] Re: Find the non-duplicate element in sorted array in < O(n) time

2011-08-24 Thread Nikhil Kumar
flag=0; for(int i=0;ihttp://groups.google.com/group/algogeeks?hl=en.

[algogeeks] vertical sum

2011-08-24 Thread Nikhil Veliath
find the vertical sum of a binary tree . . . wat do we mean by vertical sum anyone any help -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, sen

Re: [algogeeks] Re: Multiprocessor scheduling

2011-08-24 Thread Nikhil Gupta
tried this logic on few trivial cases..still to test for the hard > ones. > > > On Wed, Aug 24, 2011 at 7:30 AM, saurabh singh wrote: > >> @Nikhil Gupta I tried on this strategy but I still could find better >> solutions. >> Another approach that I tried was : s

[algogeeks] Fwd: vertical sum

2011-08-24 Thread Nikhil Veliath
find vertical sum of a binary tree . . . wat do we mean by vertical sum -- Forwarded message -- From: "Nikhil Veliath" Date: 24 Aug 2011 21:18 Subject: vertical sum To: "algogeeks@googlegroups.com" find the vertical sum of a binary tree . . . wat do we

[algogeeks] Fwd: vertical sum

2011-08-24 Thread Nikhil Veliath
-- Forwarded message -- From: "Nikhil Veliath" Date: 24 Aug 2011 21:18 Subject: vertical sum To: "algogeeks@googlegroups.com" find the vertical sum of a binary tree . . . wat do we mean by vertical sum anyone any help -- You received this message becaus

Re: [algogeeks] Apti

2011-08-23 Thread Nikhil Gupta
sorry I wrote them in different order: if (a,b) and (b,a) are considered same then answer is 12 and if they are considered different it is 24. -- Nikhil Gupta Indian Institute of Technology Roorkee, Roorkee, Uttarakhand, India , 247667 Phone: +91 9634990161 email: nikgp...@iitr.ernet.in

Re: [algogeeks] Multiprocessor scheduling

2011-08-23 Thread Nikhil Gupta
this is done something like this: Keep all the processors in a line and keep checking if any processor is idle. If it is , then assign him the job according to "shortest job first" algo or "longest job first".If it has a job then move to the next processor. -- Nikhil Gupta

Re: [algogeeks] Apti

2011-08-23 Thread Nikhil Gupta
The answer can be given by writing all the prime factors as: N = 24 * 33 = 2^3 * 3*2 * 11 => answer will be : (3+1)*(2+1)*(1+1) = 24 This is the answer considering (a,b) and (b,a) different If you consider them same the answer is 24/2 = 12. Nikhil Gupta IIT Roorkee -- You received t

[algogeeks] Fwd: dhcp

2011-08-23 Thread Nikhil Veliath
-- Forwarded message -- From: Nikhil Veliath Date: Tue, Aug 23, 2011 at 2:15 PM Subject: dhcp To: algogeeks@googlegroups.com any links or sources how to implement a dhcp server. . . . .using daemon -- You received this message because you are subscribed to the Google Groups

[algogeeks] dhcp

2011-08-23 Thread Nikhil Veliath
any links or sources how to implement a dhcp server. . . . .using daemon -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks

[algogeeks] ds apti

2011-08-22 Thread Nikhil Veliath
need link for ds aptitude ! ! thanks for ur help -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroup

Re: [algogeeks] amazon q

2011-08-21 Thread Nikhil Gupta
ps > "Algorithm Geeks" group. > To post to this group, send email to algogeeks@googlegroups.com. > To unsubscribe from this group, send email to > algogeeks+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/algogeeks

[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"

Re: [algogeeks] Re: Directi

2011-08-19 Thread NIKHIL JAIN
some more questions apart from them 1. area of the largest square such that it lies only on the black square of chess such that the side of the chess square is 2 cm. 2. there is a rectangle area such that in it m number of roads are moving from east to west and n number of roads are moving from no

Re: [algogeeks] Re: Adobe Interview Puzzles Urgent !!

2011-08-19 Thread Nikhil Gupta
oups.google.com/d/msg/algogeeks/-/VRqgtJewfHsJ. > > To post to this group, send email to algogeeks@googlegroups.com. > To unsubscribe from this group, send email to > algogeeks+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group

Fwd: Re: [algogeeks] Re: array question

2011-08-15 Thread Nikhil Veliath
Dave tu mahan hai . . . . -- Forwarded message -- From: "Dipankar Patro" Date: 14 Aug 2011 23:27 Subject: Re: [algogeeks] Re: array question To: @Dave nice algo. Really like it. So the whole complexity depends on the sorting. On 14 August 2011 22:58, Dave wrote: > @Dipankar

Re: [algogeeks] array question

2011-08-14 Thread Nikhil Veliath
i feel binary search idea is the best guys i am having problem in finding out complexity...here is my solution to the above problem...whats the complexity... sort the 2 arraysa and b l=0,i=0,flag=0; while(a[i]=b[j]) { if(a[i]==b[j]) { printf("Common element is %d",a[i]); flag=1 break; }

Re: [algogeeks] an array question

2011-08-13 Thread Nikhil Veliath
@$ the ans should be 9823191 and not 98231910 On Sat, Aug 13, 2011 at 12:59 PM, Nikhil Veliath wrote: > @$ did not understand how the original array is sorted to give the number! > > On Sat, Aug 13, 2011 at 12:50 PM, *$* wrote: >> 1.scan the array and find the maximum digits o

Re: [algogeeks] an array question

2011-08-13 Thread Nikhil Veliath
@$ did not understand how the original array is sorted to give the number! On Sat, Aug 13, 2011 at 12:50 PM, *$* wrote: > 1.scan the array and find the maximum digits of integer. lets say m.. > 2.Again scan the array and pad the intergers whose digits are less that m (< > m) with zero's .. copy t

[algogeeks] pls help

2011-08-09 Thread NIKHIL
In a ternary Tree No of leaves 28. How many nodes it have? An AVL tree with height d. How many children it have? -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe f

Fwd: [algogeeks] Re: recursive nearest square

2011-08-09 Thread Nikhil Veliath
@dave:Ma mistake should have been nearest square root :) -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@goo

Re: [algogeeks] Re: directi prepration

2011-08-09 Thread NIKHIL JAIN
thnx can you please tell some of the written questions so that i will have an idea what kind of questions are being asked by them -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com

Re: [algogeeks] Re: directi prepration

2011-08-09 Thread NIKHIL JAIN
can any dce student give an idea whats the procedure and what are the questions asked by directi recruitment group -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe

[algogeeks] Fwd: recursive nearest square

2011-08-07 Thread Nikhil Veliath
-- Forwarded message -- From: "Nikhil Veliath" Date: 7 Aug 2011 20:11 Subject: recursive nearest square To: write a recursive code to print the nearest square of a number eg if no is 27 the nearest square is 5 it should also take care of large nos... -- Yo

[algogeeks] recursive nearest square

2011-08-07 Thread Nikhil Veliath
write a recursive code to print the nearest square of a number eg if no is 27 the nearest square is 5 it should also take care of large nos... -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to alg

Re: [algogeeks] recursion help!!!

2011-08-07 Thread Nikhil Veliath
ically > appreciate the power of recursion and learn it :) > > On Sun, Aug 7, 2011 at 8:03 PM, Nikhil Veliath wrote: >> >> i am having problems in writing code using recursion.any help >> !!...any links? >> >> -- >> You received this message because yo

[algogeeks] recursion nearest square

2011-08-07 Thread Nikhil Veliath
write a recursive code to print the nearest square of a number eg if no is 27 the nearest square is 5 it should also take care of large nos... -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to alg

[algogeeks] recursion help!!!

2011-08-07 Thread Nikhil Veliath
i am having problems in writing code using recursion.any help !!...any links? -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to

Re: [algogeeks] Re: c-aps

2011-08-07 Thread Nikhil Veliath
http://cquestionbank.blogspot.com/2008/02/c-pointer-questions-with-solutions.html On Sun, Aug 7, 2011 at 7:10 PM, soundar wrote: > try indiabix.com > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to

Re: [algogeeks] Fwd: max product

2011-08-07 Thread Nikhil Veliath
@puneet: Any code ? Finding the min 3 and max 3 nos witout using sort...so using 6 variables? On Sun, Aug 7, 2011 at 6:41 PM, Puneet Ginoria wrote: > find the first three largest nos. and 3 smallest number(negatives).. then > easily you can fig. out the solution.. > O(6n) solution i guess which

[algogeeks] Recursion Help

2011-08-07 Thread Nikhil Veliath
i am having problems in writing code using recursion.any help !!...any links? -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to

[algogeeks] max product!

2011-08-07 Thread Nikhil Veliath
given an array that has n nos . . . . find the maximum product of 3 nos and display the 3 nos . . . 25 9 6 8 -20 -5 -10 so max product 5000 the nos are -20 -10 25 give an O(n) solution and if possible try avoid using sort -- You received this message because you are subscribed to the Google G

[algogeeks] Fwd: max product

2011-08-07 Thread Nikhil Veliath
-- Forwarded message -- From: "Nikhil Veliath" Date: 7 Aug 2011 18:31 Subject: max product To: given an array that has n nos . . . . find the maximum product of 3 nos and display the 3 nos . . . 25 9 6 8 -20 -5 -10 so max product 5000 the nos are -20 -10 25 g

Re: [algogeeks] GS on campus

2011-08-06 Thread NIKHIL JAIN
which college -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this 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] Re: adobe

2011-08-05 Thread Nikhil Gupta
+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 thi

[algogeeks] Re: To reverse a linked list

2011-08-05 Thread Nikhil Gupta
Sorry. this program reverses the 1st k nodes of the linked list. Not the entire list. On Sat, Aug 6, 2011 at 12:48 AM, Nikhil Gupta wrote: > What is the error in the program? I tried to run it on ideone, but its > giving runtime error. > This is a program to reverse a linked list. >

[algogeeks] To reverse a linked list

2011-08-05 Thread Nikhil Gupta
); add(list,50); add(list,60); print(list); reverse(list,k-1); list->next=head; print(head2); del(head2); return 0; } -- Nikhil Gupta Senior Co-ordinator, Publicity CSI, NSIT Students' Branch NSIT, New Delhi, India -- You received this message because you are subscribed to the Googl

Re: [algogeeks] Question

2011-08-05 Thread Nikhil Gupta
the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to algogeeks@googlegroups.com. > To unsubscribe from this group, send email to > algogeeks+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.c

Re: [algogeeks] Question

2011-08-05 Thread Nikhil Gupta
bed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to algogeeks@googlegroups.com. > To unsubscribe from this group, send email to > algogeeks+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.co

Re: [algogeeks] amazon

2011-08-04 Thread Nikhil Gupta
wed here too >>>> >>>> >>>> On Thu, Aug 4, 2011 at 11:02 PM, arvind kumar wrote: >>>> >>>>> Yup..they asked us to code 2. >>>>> >>>>> >>>>> On Thu, Aug 4, 2011 at 11:01 PM, Kamakshii Aggarwal < >>>

Re: [algogeeks] Puzzle

2011-08-04 Thread Nikhil Gupta
Explain please. On Fri, Aug 5, 2011 at 12:01 AM, Kamakshii Aggarwal wrote: > @sagar:please explain.. > > > On Thu, Aug 4, 2011 at 11:59 PM, sagar pareek wrote: > >> 87.5 % >> >> >> On Thu, Aug 4, 2011 at 10:39 PM, Nikhil Gupta >> wrote: >> &

Re: [algogeeks] amazon

2011-08-04 Thread Nikhil Gupta
ed this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to algogeeks@googlegroups.com. > To unsubscribe from this group, send email to > algogeeks+unsubscr...@googlegroups.com. > For more options, visit this group

[algogeeks] Puzzle

2011-08-04 Thread Nikhil Gupta
T.I.M.E.) -- 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 unsubs

Re: [algogeeks] Puzzle

2011-08-04 Thread Nikhil Gupta
@priyanka, the ropes have a non uniform rate of burning. Means at some duration they will be burning faster, and slower at some. So you cannot say that first rope will take 30mins to burn completely, and by that time second rope is half burnt. > >> >> Nikhil Gupta -- You receiv

[algogeeks] Puzzle

2011-08-04 Thread Nikhil Gupta
You have 2 identical ropes that burn in 1 hour (with non-uniform rate). How will you measure 45 minutes using them? -- 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 G

Re: [algogeeks] Amazon Aptitude questions

2011-08-03 Thread NIKHIL JAIN
are they what they have asked recently and they consider c/c++ as a part of apti or have a pure c/c++ paper and apti paper -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To uns

Re: [algogeeks] c output

2011-08-01 Thread Nikhil Gupta
,++i); >>> >>> } >>> >>> output: 3 3 3 >>> >>> >>> >>> >>> >>> >>> >>> >>> Regards >>> by THANU >>> >>> -- >>> You received this message becaus

Re: [algogeeks] c output

2011-08-01 Thread Nikhil Gupta
> > Regards > by THANU > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to algogeeks@googlegroups.com. > To unsubscribe from this group, send email to > algogeeks+u

Re: [algogeeks] Pointer

2011-07-31 Thread Nikhil Gupta
http://ideone.com/YHxVe @Rajeev, check this. On Sun, Jul 31, 2011 at 7:28 PM, Nikhil Gupta wrote: > Whats the logic behind > **a^=*b;* > **b^=*a;* > **a^=*b;* > ?? > > On Sun, Jul 31, 2011 at 7:19 PM, rajeev bharshetty > wrote: > >> *#include* >> *int mai

Re: [algogeeks] Pointer

2011-07-31 Thread Nikhil Gupta
,*a,*b);* > **a^=*b;* > **b^=*a;* > **a^=*b;* > *printf("after""%d%d",*a,*b);* > *return 0;* > *}* > * > * > *This swaps pointers * > > On Sun, Jul 31, 2011 at 7:15 PM, Nikhil Gupta > wrote: > >> How to swap two pointers with

[algogeeks] Pointer

2011-07-31 Thread Nikhil Gupta
How to swap two pointers without using a temporary pointer ? -- 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 gr

Re: [algogeeks] Any help on bits?

2011-07-31 Thread Nikhil Gupta
> To post to this group, send email to algogeeks@googlegroups.com. > To unsubscribe from 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-ordi

[algogeeks] Any help on bits?

2011-07-31 Thread Nikhil Gupta
Given two integers A & B. Determine how many bits required to convert A to B. Write a function int BitSwapReqd(int A, int B); -- Nikhil Gupta -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send emai

Re: [algogeeks] Re: C doubt

2011-07-31 Thread Nikhil Gupta
group. > To post to this group, send email to algogeeks@googlegroups.com. > To unsubscribe from 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

Re: [algogeeks] Re: Novell - Puzzle

2011-07-31 Thread Nikhil Gupta
Google Groups > "Algorithm Geeks" group. > To post to this group, send email to algogeeks@googlegroups.com. > To unsubscribe from this group, send email to > algogeeks+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/al

Re: [algogeeks] Re: Novell - Puzzle

2011-07-31 Thread Nikhil Gupta
In the problem statement, the rabbits give birth to new ones after every 2 months. Not after each month. On Sun, Jul 31, 2011 at 12:51 PM, Tushar Bindal wrote: > @Nikhil > Once the rabbits are mature, they should be able to produce babies every > month. after 2 months a female pro

Re: [algogeeks] 32 bit?

2011-07-30 Thread Nikhil Gupta
One more query. What if the architecture is 64 bit, but the OS is 32 bit? (Example windows XP) What will be the size of a pointer variable then? On Sat, Jul 30, 2011 at 8:00 PM, Nikhil Gupta wrote: > @Aditi, Isn't the size of int variable 4 bytes in both the architectures? > >

Re: [algogeeks] 32 bit?

2011-07-30 Thread Nikhil Gupta
v bharshetty > wrote: > >> If pointer size is 4bytes then it is 32 bit machine and if 8 bytes it is >> 64 bit >> >> >> On Sat, Jul 30, 2011 at 11:51 AM, Nikhil Gupta > > wrote: >> >>> How do you find out if a machine is 32 bit or

Re: [algogeeks] Novell - Puzzle

2011-07-30 Thread Nikhil Gupta
Pardon. at end of 2nd month 1 pairs added 4th month 2 added 6th month 4 added 8th month 8 added 10th month 16 added 12 th month 32 added and after 12 months, we have a total of 128 pairs. Which means 256 rabbits. On Sun, Jul 31, 2011 at 12:46 AM, Nikhil Gupta wrote: > @Tushar, after ever

Re: [algogeeks] Novell - Puzzle

2011-07-30 Thread Nikhil Gupta
, 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.

Re: [algogeeks] Re: self referential struct. Contd.

2011-07-30 Thread Nikhil Gupta
t, Jul 30, 2011 at 8:33 PM, Nikhil Gupta > wrote: > >> As explained by someone above : Structure padding is done to try and make >> sure that variables start in memory at addresses that are a multiple of >> their size. This is more efficient at hardware level (needs less

Re: [algogeeks] Re: Novell - Puzzle

2011-07-30 Thread Nikhil Gupta
And 233 for cows. Shiv narayan's answer is correct. But he didn't add the main cow. On Sat, Jul 30, 2011 at 8:42 PM, Nikhil Gupta wrote: > For rabbits, answer is 256. > > > On Sat, Jul 30, 2011 at 8:33 PM, Tushar Bindal wrote: > >> for rabbits answer would be d

Re: [algogeeks] Re: Novell - Puzzle

2011-07-30 Thread Nikhil Gupta
egroups.com. >> To unsubscribe from 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

Re: [algogeeks] Re: self referential struct. Contd.

2011-07-30 Thread Nikhil Gupta
not on i386. There are CPU's that can only handle double precision floats if they are aligned on addresses that are a multiople of 8. On Sat, Jul 30, 2011 at 8:23 PM, tech rascal wrote: > @ Nikhil: please explain y these memory spaces r left empty??? or hw > structure padding increas

Re: [algogeeks] Recursive version of reversing linked list

2011-07-30 Thread Nikhil Gupta
legroups.com. > To unsubscribe from 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' Bran

Re: [algogeeks] Re: self referential struct. Contd.

2011-07-30 Thread Nikhil Gupta
t c; > >>> > char b; > >>> > }; > >>> > > >>> > a starts on 0, so no need for padding. > >>> > c needs 3 bytes in front of it, and b needs no padding. > >>> > this would bring the struct size to 9. HOWEVER, suppose th

Re: [algogeeks] Doubt

2011-07-30 Thread Nikhil Gupta
Thanks. Is there any way to implement 2's compliment on binary numbers? On Fri, Jul 29, 2011 at 7:13 PM, rajeev bharshetty wrote: > ~ does bitwise not on the operand . > It simply inverts all the bits . > > > On Fri, Jul 29, 2011 at 7:09 PM, Nikhil Gupta > wr

Re: [algogeeks] Write C code to check if an integer is a power of 2 or not in a single line?

2011-07-29 Thread Nikhil Gupta
ks@googlegroups.com. > To unsubscribe from 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' Bra

[algogeeks] 32 bit?

2011-07-29 Thread Nikhil Gupta
How do you find out if a machine is 32 bit or 64 bit? I was thinking since the size of pointer variable is different in the 2 configurations, we can declare a pointer and use sizeof() Will that work? Any other suggestions? -- Nikhil Gupta -- You received this message because you are

Re: [algogeeks] Doubt

2011-07-29 Thread Nikhil Gupta
e bits by 0 number of > times( effectively in this case u wont be shifting) > > On Fri, Jul 29, 2011 at 5:50 PM, Nikhil Gupta > wrote: > >> What is meant by the statement : >> >> byte0 = (num & x00FF) >> 0 >> >> And what is meant by the operators &quo

[algogeeks] Doubt

2011-07-29 Thread Nikhil Gupta
What is meant by the statement : byte0 = (num & x00FF) >> 0 And what is meant by the operators ">>" , "^" , "&" , "|" and how are they used? -- Nikhil Gupta Senior Co-ordinator, Publicity CSI, NSIT Students' Branch NSIT

Re: [algogeeks] self referential struct. Contd.

2011-07-28 Thread Nikhil Gupta
t; }; >> >> the size of this struct's node will be 12 not 9.., to make it a multiple >> of 4?? >> >> >> >> On 7/26/11, Nikhil Gupta wrote: >> > Padding is not a topic of self referential structure. >> > >> > Padding means that

Re: [algogeeks] Facebook Intern F2F Interview

2011-07-28 Thread Nikhil Jindal
Generate a random number from 1 to 100. If it is less than or equal to x, return true, else return false. This will ensure that ur returning true with x/100 probability. Cheers Nikhil Jindal On Thu, Jul 28, 2011 at 4:21 PM, KK wrote: > bool foo(int x) > > // Implement this functio

Re: [algogeeks] Re: Permutations in a string

2011-07-27 Thread Nikhil Gupta
uot;%d", &k); >n = strlen(str); >solve(0, 0); > } > > > On Jul 27, 7:49 pm, Rajeev Kumar wrote: > > One more thread is running parallel on the same topic.... > > Please refer : > http://comments.gmane.org/gmane.comp.programming.algogeeks/17279 >

[algogeeks] Permutations in a string

2011-07-27 Thread Nikhil Gupta
Given a string of length 5 (example "abcde"), write a program to print all the possible combinations OF LENGTH 3. In this case : abc, abd, abe, acd, ace, ade, bcd, bce, bde, cde Can someone provide a working code? -- Nikhil Gupta Senior Co-ordinator, Publicity CSI, NSIT Students&#x

[algogeeks] Lucky numbers

2011-07-26 Thread Nikhil Gupta
circularly arranged). This action is done until only one number is left. So given a range of numbers, you have to use an algo to tell which number will be left in the end. Example : 1 2 3 4 5 6 7 8 9 10 11 12 ... 1 3 5 7 9 11 13 15 17 19 . 1 5 9 13 17 21 25 . and so on. -- Nikhil

  1   2   3   >