Re: [algogeeks] Interview Question

2011-04-08 Thread ankur bhardwaj
For the 2nd ques, wat i think is the interviewer has kept the restriction of
not moving the data since you may have a linked list about which you donot
have much information about the structure of the node of the list(only know
about the next pointer) and hence you cannot move the data. For that, you
can free the middle node and copy the last node bit by bit at the location
of the middle node.

If you still dont want to use the method above, you will have to free the
middle node and reallocate the next node at the location of the middle node.
For this wat i could think was to use the realloc() and put it in a while
loop and terminate the loop only when the address returned matches with the
address possesed by the middle node. But this method is not efficient and
also unwise. If anyone can think of something better, he/she is invited

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

2011-04-08 Thread Balaji S
@pankaj: nice answer...well done..;)

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

2011-04-08 Thread cegprakash
for the second case it is possible only if the node contains the
previous node's address. Else there should be data movement

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

2011-04-08 Thread cegprakash
thanks for sharing this question

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



[algogeeks] ONLY FOR MEN

2011-04-08 Thread SUNITHA BUSETTY
   hot lipkiss
http://hotactressstoyou.blogspot.com/2011/04/lipkiss-2.html
   lipkiss in without dress
http://hotactressstoyou.blogspot.com/2011/04/lipkiss.html
seepika padukone sexy back look
http://hotactressstoyou.blogspot.com/2011/04/deepika-padukone.html
   sexy katrina kaif
http://hotactressstoyou.blogspot.com/2011/04/katrina-kaif.html
beauty keerthi chawla
http://hotactressstoyou.blogspot.com/2011/04/keerthi-chawla.html
   saloni sexy photos
http://hotactressstoyou.blogspot.com/2011/04/saloni.html
 deeksha seth in a hot saree
http://hotactressstoyou.blogspot.com/2011/04/deeksha-seth.html
 asin hot wallpapers
http://hotactressstoyou.blogspot.com/2011/04/asin.html
ramba in a red dress
http://hotactressstoyou.blogspot.com/2011/04/ramba.html
  sexy ilieana is in scert
http://hotactressstoyou.blogspot.com/2011/04/ileana.html

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



Re: [algogeeks] ONLY FOR MEN

2011-04-08 Thread Manikanta Babu
Hello Sunitha,

Can you please stop posting these kind of things into this google group.
Please go to some other appropriate group.

Thanks,
Mani

On Fri, Apr 8, 2011 at 3:56 PM, SUNITHA BUSETTY
sunitha.buse...@gmail.comwrote:

   hot lipkiss
 http://hotactressstoyou.blogspot.com/2011/04/lipkiss-2.html
   lipkiss in without dress
 http://hotactressstoyou.blogspot.com/2011/04/lipkiss.html
seepika padukone sexy back look
 http://hotactressstoyou.blogspot.com/2011/04/deepika-padukone.html
   sexy katrina kaif
 http://hotactressstoyou.blogspot.com/2011/04/katrina-kaif.html
beauty keerthi chawla
 http://hotactressstoyou.blogspot.com/2011/04/keerthi-chawla.html
   saloni sexy photos
 http://hotactressstoyou.blogspot.com/2011/04/saloni.html
 deeksha seth in a hot saree
 http://hotactressstoyou.blogspot.com/2011/04/deeksha-seth.html
 asin hot wallpapers
 http://hotactressstoyou.blogspot.com/2011/04/asin.html
ramba in a red dress
 http://hotactressstoyou.blogspot.com/2011/04/ramba.html
  sexy ilieana is in scert
 http://hotactressstoyou.blogspot.com/2011/04/ileana.html

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




-- 
Thanks  Regards,
Mani
http://www.sanidapa.com - The music Search engine

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

2011-04-08 Thread Vishnutej Mylavarapu
Hello,
I dont think this is the right place for u to post these kinda things.
Also,if the admin of this group is still active,kindly delete this user from
the group.
Thnx.
-Vishnutej

On Fri, Apr 8, 2011 at 4:04 PM, Manikanta Babu manikantabab...@gmail.comwrote:

 Hello Sunitha,

 Can you please stop posting these kind of things into this google group.
 Please go to some other appropriate group.

 Thanks,
 Mani

 On Fri, Apr 8, 2011 at 3:56 PM, SUNITHA BUSETTY sunitha.buse...@gmail.com
  wrote:

   hot lipkiss
 http://hotactressstoyou.blogspot.com/2011/04/lipkiss-2.html
   lipkiss in without dress
 http://hotactressstoyou.blogspot.com/2011/04/lipkiss.html
seepika padukone sexy back look
 http://hotactressstoyou.blogspot.com/2011/04/deepika-padukone.html
   sexy katrina kaif
 http://hotactressstoyou.blogspot.com/2011/04/katrina-kaif.html
beauty keerthi chawla
 http://hotactressstoyou.blogspot.com/2011/04/keerthi-chawla.html
   saloni sexy photos
 http://hotactressstoyou.blogspot.com/2011/04/saloni.html
 deeksha seth in a hot saree
 http://hotactressstoyou.blogspot.com/2011/04/deeksha-seth.html
 asin hot wallpapers
 http://hotactressstoyou.blogspot.com/2011/04/asin.html
ramba in a red dress
 http://hotactressstoyou.blogspot.com/2011/04/ramba.html
  sexy ilieana is in scert
 http://hotactressstoyou.blogspot.com/2011/04/ileana.html

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




 --
 Thanks  Regards,
 Mani
 http://www.sanidapa.com - The music Search engine

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




-- 

*-Vishnutej Mylavarapu.*

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

2011-04-08 Thread murthy.krishn...@gmail.com
For the second case,

Consider,

A - B - C - NULL

Accor 2 me he has asked to reverse d list to make it as C - A by deleting
B, which can be done like this,

temp-next = temp-next-next; // A-C-NULL
temp-next-next = temp; //A-C-A
temp = temp-next; //C-A-C
temp-next-next = NULL; //C-A-NULL

Correct me, If am wrong

Thanks,



now temp is poiting to
On Fri, Apr 8, 2011 at 2:13 PM, cegprakash cegprak...@gmail.com wrote:

 for the second case it is possible only if the node contains the
 previous node's address. Else there should be data movement

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




-- 
P.V.N.S.S. Krishna Murthy,
Intern at Broadcom Private Limited,
Bangalore,
Contact no:- +919845812996.

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

2011-04-08 Thread murthy.krishn...@gmail.com
hii,

Small correction

For the second case,

Consider,

A - B - C - NULL

Initially temp is pointing to A.

Accor 2 me he has asked to reverse d list to make it as C - A by deleting
B, which can be done like this,

temp-next = temp-next-next; // A-C-NULL
temp-next-next = temp; //A-C-A
temp = temp-next; //C-A-C
temp-next-next = NULL; //C-A-NULL

Correct me, If am wrong

Thanks,

On Fri, Apr 8, 2011 at 4:47 PM, murthy.krishn...@gmail.com 
murthy.krishn...@gmail.com wrote:

 For the second case,

 Consider,

 A - B - C - NULL

 Accor 2 me he has asked to reverse d list to make it as C - A by deleting
 B, which can be done like this,

 temp-next = temp-next-next; // A-C-NULL
 temp-next-next = temp; //A-C-A
 temp = temp-next; //C-A-C
 temp-next-next = NULL; //C-A-NULL

 Correct me, If am wrong

 Thanks,



 now temp is poiting to
 On Fri, Apr 8, 2011 at 2:13 PM, cegprakash cegprak...@gmail.com wrote:

 for the second case it is possible only if the node contains the
 previous node's address. Else there should be data movement

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




 --
 P.V.N.S.S. Krishna Murthy,
 Intern at Broadcom Private Limited,
 Bangalore,
 Contact no:- +919845812996.




-- 
P.V.N.S.S. Krishna Murthy,
Intern at Broadcom Private Limited,
Bangalore,
Contact no:- +919845812996.

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

2011-04-08 Thread Kunal Patil
Friends in my class appeared for it recently. They were asked OS n
Networking based questions.

On Thu, Apr 7, 2011 at 11:09 PM, nitish goyal nitishgoy...@gmail.comwrote:

 If anyone had telephonic interview at cisco regarding summer internship,
 then
 please the experience asap. I am having this interview tomorrow.

 --
 Regards,
 Nitish Goyal


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

2011-04-08 Thread saurabh agrawal
ou are given an array A of k values which contain int values in sorted
(asec) order. Find top k values (asec) which can either be the number from
the array A, or sum of any two numbers from A or sum of any three numbers
from A. So, if A's values are represented as : a1,a2,...,ak , the possible
numbers can be: a(i), a(i)+a(j), a(i)+a(j)+a(l) for any i,j,l  k

Ex: A[7] = {3,4,5,15,19,20,25}
output B[7] = {3,4,5,(3+4),(3+5),(4+5),(3+4+5)}

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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: Please help in verifying the speed of this algorithm - factorizing or prime finder.

2011-04-08 Thread Don
This link has an online application which factors large numbers using
the Elliptic Curve method.
http://www.alpertron.com.ar/ECM.HTM

Try a value like
12991627363868130524522557049357159496792541860595064869631.

On my computer this application factors this number in 15 seconds.
Anything relying on trial division would take longer than your
computer will last.

Don


On Apr 7, 9:11 am, harish hareeshgn...@gmail.com wrote:
 Hi All,

 I got a reply at another forum; here is the link for 
 thathttp://stackoverflow.com/questions/5581040/i-have-a-new-algorithm-to-...

 .. Don i believe you are correct.

 Thanks
 Harish

 On Apr 7, 4:56 pm, harish hareeshgn...@gmail.com wrote:

  Hi Don, I reposting my reply to you to all now..

  The GNFS mentioned here is polynomial time as I got to understand from
  wikipedia. I claim that the above algorithm is linear time.

  I putting the proof here for correctness and linear time (warning its
  big and messy). Also this one applies to the algorithm given in the
  blog:http://randomoneness.blogspot.com/2011/04/algorithm-to-find-factors-o...

  (The above given is a faster version of the one given in my blog)

  Analysis of algorithms:

  In below proof used:
  Operation A is:  While r is smaller than mL then, mL can be
  decremented by one and the new r can be computed as r + mR.
  As taking out one mL, means one mR is send to remainder. (first inner
  while loop)
  Operation B is:  While r is bigger than mL, then mL can be taken out
  from r and this basically increases mR by one. (2nd inner while loop)
  Operation C is:  Operations A and B can be repeated till, r not equals
  mL. When we arrive at the results, Operation C is
  exited. (main while loop)

  1. Proof of correctness: If the number is a perfect square root then,
  the answer is found when square root is found.
  For more reading on Square root 
  refer:http://en.wikipedia.org/wiki/Square_root
  Else if the number is not a perfect square, then r is not equal to 0.
  Hence it enters the while loop.
  Operation A: While mL is greater than r, then mL is decremented by 1,
  and r is incremented by mR.
  The step is correct because, mL * mR means mR added mL times. If one
  is taken from mL, then mR is added
  (mL-1) times. So, one mR is added less, when taking one out of mL.
  This mR is added to r. – (1)
  Operation B: While mL is less than r, then mR is incremented by 1 and
  r is decremented by mL. This
  step is correct because, mL * mR means mL added mR times. If one is
  added to mR, then mL is added (mR + 1)
  times in mL*mR. So if mR is incremented by 1, then to equate to N, mL
  can be taken away from r the
  remainder. – (2)
  Operation C: Operation A and B are repeated till mL is equal to r.
  This leads to the answer because:
  We start from the approximate square root of the number. As operation
  A and B, calculates the remainder r,
  when the factors are mL and mR. Operation A never leads to the answer
  as, r + mR is always greater than mL,
  as mL is smaller than mR. Operation B, leads to the answer. If for any
  case mL is a factor, then, when r is
  reduced by mL in operation B to mL (r becomes a factor of mL). As
  Operation A and B are correct (refer 1 and
  2), if there is a factor then this leads to r to be zero. And before r
  becomes zero, r should be equal to mL. At this
  point the answer is found.

  2. Proof that the number of Operations required is linear: Let’s take
  only the case of numbers which are not
  perfect squares.
  The algorithm consists of basic operations, of addition, subtraction
  and comparison. Let’s see how
  many times a different while loops are invoked.
  We take mL as nearest square root. And take mR  mL.
  There for Operation A is invoked only once during one iteration of the
  Operation C. This is because, by
  incrementing r by mR, increases r to be greater than mL (mR  mL) and
  hence invalidates the loop condition.
  The basic number of steps in Operation A is 3: 1. While loop
  evaluation, 2. decrement mL by 1 and 3. Increment
  r by mR.
  Operation B is repeated to find a r which is greater than mL. As mR
  varies as algorithm progress, its
  hard to calculate number of time r Operation B is repeated. The basic
  number of steps in Operation B is 3: 1.
  while loop evaluation, 2. Increment mR by 1 and 3. Decrement r by mL.
  However two things are certain, for worst case scenario i.e. N is
  prime number, mL is reduced to 1 and
  mR is incremented to N. From this we can conlude that, Operation B is
  repeated N-sqrt(N) times i.e. Increment
  mR to N from sqrt(N) and Operation A is repeated till mL becomes 1 i.e
  from sqrt(N) to 1. Based on this the
  number of steps required is:
  Operation B : N – sqrt(N)
  Operation A : sqrt(N)
  And the Operation C, which apart from the steps we calculate from
  Operation A and Operation B, will
  have 2 basic steps; 1. the main while evaluation, 2. the exit
  evaluation of one of the while either of Operation A
  

Re: [algogeeks] Re: Interview Question

2011-04-08 Thread Anurag atri
if innitially temp is pointing to A then there is no problem in deleting the
middle node ..

On Fri, Apr 8, 2011 at 4:49 PM, murthy.krishn...@gmail.com 
murthy.krishn...@gmail.com wrote:

 hii,

 Small correction


 For the second case,

 Consider,

 A - B - C - NULL

 Initially temp is pointing to A.


 Accor 2 me he has asked to reverse d list to make it as C - A by deleting
 B, which can be done like this,

 temp-next = temp-next-next; // A-C-NULL
 temp-next-next = temp; //A-C-A
 temp = temp-next; //C-A-C
 temp-next-next = NULL; //C-A-NULL

 Correct me, If am wrong

 Thanks,

 On Fri, Apr 8, 2011 at 4:47 PM, murthy.krishn...@gmail.com 
 murthy.krishn...@gmail.com wrote:

 For the second case,

 Consider,

 A - B - C - NULL

 Accor 2 me he has asked to reverse d list to make it as C - A by deleting
 B, which can be done like this,

 temp-next = temp-next-next; // A-C-NULL
 temp-next-next = temp; //A-C-A
 temp = temp-next; //C-A-C
 temp-next-next = NULL; //C-A-NULL

 Correct me, If am wrong

 Thanks,



 now temp is poiting to
  On Fri, Apr 8, 2011 at 2:13 PM, cegprakash cegprak...@gmail.com wrote:

 for the second case it is possible only if the node contains the
 previous node's address. Else there should be data movement

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




 --
 P.V.N.S.S. Krishna Murthy,
 Intern at Broadcom Private Limited,
 Bangalore,
 Contact no:- +919845812996.




 --
 P.V.N.S.S. Krishna Murthy,
 Intern at Broadcom Private Limited,
 Bangalore,
 Contact no:- +919845812996.

  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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
Anurag Atri
II year
Computer Engineering
Delhi College Of Engineering

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

2011-04-08 Thread Seçkin Can Şahin
I developed a website/facebookapp. I would appreciate it if you could give
feedback about it.

http://apps.facebook.com/wouldloveto/

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

2011-04-08 Thread Carl Barton
So it will post to other people that I would love to do something?

2011/4/8 Seçkin Can Şahin seckincansa...@gmail.com

 I developed a website/facebookapp. I would appreciate it if you could give
 feedback about it.

 http://apps.facebook.com/wouldloveto/

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

2011-04-08 Thread balaji a
Both say liesA is monkey and B is a human...

On Friday, April 8, 2011, Lavesh Rawat lavesh.ra...@gmail.com wrote:
 Island Puzzle


 There are people and strange monkeys on this island, and you can not tell
who is who. They speak either only the truth or only lies.
 Who are the following two guys?
 A: B is a lying monkey. I am human.
 B: A is telling the truth.

 Update Your Answers at : Click Here 
http://dailybrainteaser.blogspot.com/2011/04/8april.html?lavesh=lavesh


 Solution:Will be updated after 1 day


 --

 Never explain yourself. Your friends don’t need it
and your enemies won’t believe 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.



Re: [algogeeks] [brain teaser ] 8april

2011-04-08 Thread rohit agarwal
A: B is a lying monkey, I am a human.

If A is lying it means B is not lire and B is true.
but B says.

B: A is telling the truth.

This is a contradiction.

If B is true, that also means A is true and again A is saying that B is a
lire so this is a contradiction.




-- 
  *   Thanks and Regards*
┌─┐
│ Rohit Agarwal
│ Undergraduate (Third Year)
│ B.Tech (Information Technology)
│ NIT Durgapur http://www.nitdgp.ac.in
│ Blog: http://www.irelaxa.com/rohit
└─┘

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

2011-04-08 Thread Subhransu
What could be the efficient  algo for finding permutation of string.
Lets say a user enter a string abc.

The output should be 6(3*2*1) along with he combination of them like
   abc
   bca
   cab
   bac
   acb
   cba

*Subhransu Panigrahi
*
*Mobile:* *+91-9840931538*
 *Email:* subhransu.panigr...@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] Permutation of a string

2011-04-08 Thread Manish Pathak
 #include stdio.h
#include string.h
#include stdlib.h
int fact(int n);
void main()
{
char a[20],st_char;
static int i,j,k,n,ctr,main_ctr;
printf(Enter the string : );
//gets(a);
scanf(%s,a);

n=strlen(a);

if(n=1)
{
printf(please enter a valid string );
exit(0);
}

//label :
while(main_ctrn)  //loop till length
{
for(i=0;i=n-2;++i)//loop to print first character of string ex abc,acb
{
ctr=0;
printf(\n);
printf(%c,a[0]);
for(j=i+1;j=n-1;j++)//take
{
printf(%c,a[j]);
ctr++;
}

if(ctr!=n-1)
{
for(k=1;k=i;k++)//  print characters that left in above loop ex
from above i=2 print a[0], then j=3 print a[3], means to print a[1] and a[2]

{
printf(%c,a[k]);
ctr++;
}
}
}

st_char=a[0];//ex for abc string this change as a[0]=b;
for(i=0;i=n-2;i++)//a[1]=c;
a[i]=a[i+1];//a[2]=a;

a[n-1]=st_char;

main_ctr++;
}
printf(\nDesigned by Manish Pathak );
}

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

2011-04-08 Thread Dave
@Uttam: The negation of A is a lying monkey is A is not a lying
monkey. That means that A could be a truth-teller or A could be a
human (or both).

If B is telling the truth, then so is A, but then B is a liar. That is
a contradiction, so B is a liar. Then A is a liar.

Therefore A is a monkey, and B is not a lying monkey. Since we already
have established that B is a liar, it must be that B is a human.

Answer. A is a lying monkey, and B is a lying human.

Dave

On Apr 8, 12:39 pm, uttam tiwari utmbhu...@gmail.com wrote:
 ans: A is lying monkey
          B is lying human
 explanation:

 let A is speaking truth..den B will be a lying monkey accordingly..but
 B is  saying dat A is speaking truth..dat shud b a lie..as watever B
 will speak is a lie...so A cant speak truth..now...if A lies then
 recprocating his sentence ..B will be a lying human..and A is a
 monkey..now watever B speaks is also a lie without generating any
 contradiction.

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

2011-04-08 Thread Anand
1, You have 52 cards. How will you make your you distribute cards randomly.

2. You have given a binary tree. Given any node, print the all the nodes at
the same level.

3. You have given a binary tree and two given nodes. Find the distance
between two nodes.

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