Re: [algogeeks] file opening mode

2010-06-17 Thread sharad kumar
plzzz dont post ur homework questions here
look them on google

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

2010-06-17 Thread jalaj jaiswal
write an algo which gives the lowest common ancestor of two nodes in a
general tree(not binary specifically)

-- 
With Regards,
Jalaj Jaiswal
+919026283397
B.TECH IT
IIIT ALLAHABAD

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

2010-06-17 Thread Dave
No. The greedy algorithm also works on the U.S. coinage system, where
the coins are 1, 5, 10, 25. Again, the rule is that there must be a 1
unit coin, and each coin has at least twice the value of the
preceeding one.

Dave

On Jun 16, 11:34 pm, Rohit Saraf rohit.kumar.sa...@gmail.com wrote:
 @Dave: The greedy will only work if the coins are k,2k,3k,4k, nk without
 any of these missing
              Clear?
 (Perhaps i did not write it clearly as i was on mobile)
 --
 Rohit Saraf
 Second Year Undergraduate,
 Dept. of Computer Science and Engineering
 IIT Bombayhttp://www.cse.iitb.ac.in/~rohitfeb14



 On Thu, Jun 17, 2010 at 10:00 AM, Dave dave_and_da...@juno.com wrote:
  The greedy algorithm doesn't work, e.g., when the coins are 1, 5, and
  8 units, and you want to make 15 units. In this case, the greedy
  algorithm would choose 8, 5, 1, 1, whereas the optimal is 5, 5, 5. I
  believe the criterion for the greedy algorithm are that the smallest
  coin be 1 unit and each successive coin be at least twice the value of
  its predecessor.

  Dave

  On Jun 16, 9:19 pm, Rohit Saraf rohit.kumar.sa...@gmail.com wrote:
   If the coins are all multiple of some number k, you can greedily give
   as much as possible to the higher domination. Otherwise still, there
   is an optimal substructure and u can make a recurrence and use
   memoization(i.e. DP)

   --
   --
   Rohit Saraf
   Second Year Undergraduate,
   Dept. of Computer Science and Engineering
   IIT Bombayhttp://www.cse.iitb.ac.in/~rohitfeb14

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

 - Show quoted text -

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

2010-06-17 Thread Rohit Saraf
Yes right, i forgot the 1
--
Rohit Saraf
Second Year Undergraduate,
Dept. of Computer Science and Engineering
IIT Bombay
http://www.cse.iitb.ac.in/~rohitfeb14


On Thu, Jun 17, 2010 at 6:05 PM, Dave dave_and_da...@juno.com wrote:

 No. The greedy algorithm also works on the U.S. coinage system, where
 the coins are 1, 5, 10, 25. Again, the rule is that there must be a 1
 unit coin, and each coin has at least twice the value of the
 preceeding one.

 Dave

 On Jun 16, 11:34 pm, Rohit Saraf rohit.kumar.sa...@gmail.com wrote:
  @Dave: The greedy will only work if the coins are k,2k,3k,4k, nk
 without
  any of these missing
   Clear?
  (Perhaps i did not write it clearly as i was on mobile)
  --
  Rohit Saraf
  Second Year Undergraduate,
  Dept. of Computer Science and Engineering
  IIT Bombayhttp://www.cse.iitb.ac.in/~rohitfeb14
 
 
 
  On Thu, Jun 17, 2010 at 10:00 AM, Dave dave_and_da...@juno.com wrote:
   The greedy algorithm doesn't work, e.g., when the coins are 1, 5, and
   8 units, and you want to make 15 units. In this case, the greedy
   algorithm would choose 8, 5, 1, 1, whereas the optimal is 5, 5, 5. I
   believe the criterion for the greedy algorithm are that the smallest
   coin be 1 unit and each successive coin be at least twice the value of
   its predecessor.
 
   Dave
 
   On Jun 16, 9:19 pm, Rohit Saraf rohit.kumar.sa...@gmail.com wrote:
If the coins are all multiple of some number k, you can greedily give
as much as possible to the higher domination. Otherwise still, there
is an optimal substructure and u can make a recurrence and use
memoization(i.e. DP)
 
--
--
Rohit Saraf
Second Year Undergraduate,
Dept. of Computer Science and Engineering
IIT Bombayhttp://www.cse.iitb.ac.in/~rohitfeb14
 
   --
   You received this message because you are subscribed to the Google
 Groups
   Algorithm Geeks group.
   To post to this group, send email to algoge...@googlegroups.com.
   To unsubscribe from this group, send email to
   algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@googlegroups.com
 algogeeks%2bunsubscr...@googlegroups­.com
   .
   For more options, visit this group at
  http://groups.google.com/group/algogeeks?hl=en.- Hide quoted text -
 
  - Show quoted text -

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

2010-06-17 Thread chinna
plz can u provide material -reg:design and analysis of algorithms.
basics of algorithms and psudocode notation,time and space
complexity's ..etc
thank u

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

2010-06-17 Thread saadi
( WE APOLOGIZE IF YOU RECEIVE MULTIPLE COPIES OF THIS MESSAGE )

=
Journal of Emerging Trends in Computing and Information Sciences
Call for Research Papers
http://cisjournal.org/
ISSN: 2079-8407
=

Dear Sir/ Madam,

Journal of Emerging Trends in Computing and Information Sciences (ISSN
2079-8407) is an International refereed research publishing journal,
dedicated to the latest advancement of all theoretical and scientific
aspects of Computing and Information Sciences. The objectives of the
journal are to promote and publish original high quality research and
to provide a forum to the researchers and industry practitioners for
exchanging ideas, knowledge, and experience.

We welcome original research and industry experience papers. Submitted
papers should meet the internationally accepted criteria and
manuscripts should follow the style of the journal for the purpose of
both reviewing and editing. All the submissions will be published free
of cost after peer-reviewed by the panel of experts associated with
journal. For more information please visit http://cisjournal.org/.


Sincerely Yours,

Managing Editor
Journal of Emerging Trends in Computing and Information Sciences
URL: http://www.cisjournal.org
E-mail: c...@cisjournal.org/

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from 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] towers of hanoi O(1) time

2010-06-17 Thread Anand
@Jitendra: Could not understand in which peg the plates should be. Can you
please let us know

On Tue, Jun 15, 2010 at 9:12 AM, Jitendra Kushwaha jitendra.th...@gmail.com
 wrote:

 Dear Anuj,

 Its easy to do.
 lets take an example
 say we have 4 disks. We will require 2^4-1 = 15 steps to solve it.
 Now suppose we are at 6th step..
 write it binary form using 4 bits(since we have 4 disks)   0110
 now from left 0 means 4th disk is on initial peg
 second bit 1 means disk 3 is on left of the previous disk
 third bit 1 means it is above previous disk
 fourth bit 0 means it is on right of previuos disk

 so the solution is something like
 1: 4|1
 2:
 3: 3|2

 1: is initial peg   (left of 1 means 3 and right means 2)
 2: is final peg

 hope it is clear how to solve this in O(no_of_disk) complexity
 you can refer this link :
 http://britton.disted.camosun.bc.ca/jbhanoi.htm 
 http://britton.disted.camosun.bc.ca/jbhanoi.htm


 comment for any related doubts :)

 --
 Regards
 Jitendra Kushwaha
 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 algoge...@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@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 algoge...@googlegroups.com.
To unsubscribe from 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] Width of the tree

2010-06-17 Thread Anand
Any guys suggest any algo on how to find the width of the tree.

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

2010-06-17 Thread aejeet
take root as the start node and do a DFS traversal on this tree. This
can be done in linear time. DFS traversal will give [entry time, exit
time] for each node. Now do an inorder traversal of the tree to find
the first node such that the entry  exit time of both the input nodes
(whose ancestor we r trying to find) is nested within this node. This
node is the required ancestor





On Jun 17, 6:00 am, jalaj jaiswal jalaj.jaiswa...@gmail.com wrote:
 write an algo which gives the lowest common ancestor of two nodes in a
 general tree(not binary specifically)

 --
 With Regards,
 Jalaj Jaiswal
 +919026283397
 B.TECH IT
 IIIT ALLAHABAD

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



[algogeeks] OS problems

2010-06-17 Thread amit
1. a mad user tries to allocate 1 gb memory using calloc.
but the program fails after allocationg about 800mg(appx. i dont
remember). Tell me what could have gone wrong?

2.
We know disabling interrupts works only if it is single processor(i.e
local disabling of interrupts).

Consider this case where we have a SMP(symmetric multi proc) the
processor. Processor-1 wants to perform some critical operation so it
disables all the interrupts.

What will happen when processor-2 throws an interrupt.

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

2010-06-17 Thread Vivek Sundararajan
@Anand: Thank you :)

On 17 June 2010 16:14, Vivek Sundararajan s.vivek.ra...@gmail.com wrote:

 Hi Anand, your dedicated and neatly formated reply is much appreciated! :)


 On 16 June 2010 23:59, divya jain sweetdivya@gmail.com wrote:

 yes u need to start frm beg..



 On 16 June 2010 17:15, Vivek Sundararajan s.vivek.ra...@gmail.comwrote:

 so, this means that i can traverse the list only from the beginning of
 the link list right?

 what if im given a pointer pointing to some node other than the head of
 the doubly linked list? will i be able to traverse in any direction now?

 please let me know if im missing something :)

 Thank you,
 Vivek


 On 16 June 2010 15:37, divya jain sweetdivya@gmail.com wrote:

 u can xor linked list. such that every node link contains the xor of its
 prev nd next node address.. since for 1st node prev is null ( 0) so its 
 link
 contains only next. now to calculate next of 2nd node xor its link with 1st
 node's link nd u ll get 3 rd node.s adddress nd so on..

 u can also use sum. store in link the sum of prev node n next node
 address.. bt this cn result in overflow. so xor method is better


 On 16 June 2010 09:14, sharad kumar sharad20073...@gmail.com wrote:

 u have to use XOR linked list

 --
 You received this message because you are subscribed to the Google
 Groups Algorithm Geeks group.
 To post to this group, send email to algoge...@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@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 algoge...@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@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 algoge...@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@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 algoge...@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




 --
 Reduce, Reuse and Recycle
 Regards,
 Vivek.S




-- 
Reduce, Reuse and Recycle
Regards,
Vivek.S

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

2010-06-17 Thread amit
Give an O(n) algorithm to sort the
items by color (all reds before all blues before all yellows) such
that the numbers
for identical colors stay sorted.


A[]={3B,1R,4Y,2R,5B,7Y}
Ans={1R,2R,3B,7B,4Y,7Y}

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

2010-06-17 Thread Vivek Sundararajan
http://www.topcoder.com/tc?module=Staticd1=tutorialsd2=lowestCommonAncestor

The above link gives a detailed explanation about LCA and RMQ

On 17 June 2010 15:30, jalaj jaiswal jalaj.jaiswa...@gmail.com wrote:

 write an algo which gives the lowest common ancestor of two nodes in a
 general tree(not binary specifically)

 --
 With Regards,
 Jalaj Jaiswal
 +919026283397
 B.TECH IT
 IIIT ALLAHABAD

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




-- 
Reduce, Reuse and Recycle
Regards,
Vivek.S

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

2010-06-17 Thread divya
write a code to construct tree from inorder nd preorder traversal..

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

2010-06-17 Thread Amir hossein Shahriari
if you can access parent in your tree find the path from the nodes to the
root
then process the two lists from their end and find the last equivalent node
in lists and thats the lowest common ancestor
the running time is O(height of tree) which is the max length of the two
lists

On Thu, Jun 17, 2010 at 2:30 PM, jalaj jaiswal jalaj.jaiswa...@gmail.comwrote:

 write an algo which gives the lowest common ancestor of two nodes in a
 general tree(not binary specifically)

 --
 With Regards,
 Jalaj Jaiswal
 +919026283397
 B.TECH IT
 IIIT ALLAHABAD

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algoge...@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@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 algoge...@googlegroups.com.
To unsubscribe from 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] towers of hanoi O(1) time

2010-06-17 Thread Jitendra Kushwaha
when we get a different bit from the previous one, four condition arises

defining position of the bit :
consider this bit form :  1001  (from left, 1 is at odd position, then 0
at even, then next 0 at odd, and so on)

now four conditions are(except for 1st bit because it has no previous bit) :


1. previous bit is 1and   current bit is 0   and  previous bit
is at odd position
   then move disk to right of current position of that disk

2.  previous bit is 1and   current bit is 0   and  previous bit
is at even position
   then move disk to left of current position of that disk

3.  previous bit is 0and   current bit is 1   and  previous bit
is at odd position
then move disk to left of current position of that disk

4.  previous bit is 0and   current bit is 1   and  previous bit
is at  even position
then move disk to left of current position of that disk

for first bit if it is zero means biggest disk is at initial position else
at final position.

you try it for 3 disk
write binary form 000 (initial position) to 111(final position)
make the moves and try to figure out.
You will definately come to this result

best of luck

-- 
Regards
Jitendra Kushwaha
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 algoge...@googlegroups.com.
To unsubscribe from 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] request

2010-06-17 Thread mohit ranjan
@Chinna

http://www.topcoder.com/tc?module=Staticd1=tutorialsd2=alg_index

Mohit


On Thu, Jun 17, 2010 at 9:03 PM, chinna thirupathi.thu...@gmail.com wrote:

 plz can u provide material -reg:design and analysis of algorithms.
 basics of algorithms and psudocode notation,time and space
 complexity's ..etc
 thank u

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

2010-06-17 Thread debajyotisarma
Find the longest palindrome in the given string.
Minimum time-space complexity required
(i have not solved it so don't know what is min)

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

2010-06-17 Thread Chakravarthi Muppalla
I think that we need to go by dynamic programming.
Ex: 1,3,7,4,9 T=23
Sort: 1,3,4,7,9
subtract max value from T(23-9=14 )
find Best Solution for (14) -- sub (14-9 = 5), Search for 5.(5-4 = 1) So
Answer would be: 9,9,4,1
Search can be binary search as the array is already sorted.
At every step best solution for the specified number could be saved in a
hash table for any further references.


Thanks  Regards,
Chakravarthi.




On Thu, Jun 17, 2010 at 6:10 PM, Rohit Saraf rohit.kumar.sa...@gmail.comwrote:

 Yes right, i forgot the 1

 --
 Rohit Saraf
 Second Year Undergraduate,
 Dept. of Computer Science and Engineering
 IIT Bombay
 http://www.cse.iitb.ac.in/~rohitfeb14http://www.cse.iitb.ac.in/%7Erohitfeb14


 On Thu, Jun 17, 2010 at 6:05 PM, Dave dave_and_da...@juno.com wrote:

 No. The greedy algorithm also works on the U.S. coinage system, where
 the coins are 1, 5, 10, 25. Again, the rule is that there must be a 1
 unit coin, and each coin has at least twice the value of the
 preceeding one.

 Dave

 On Jun 16, 11:34 pm, Rohit Saraf rohit.kumar.sa...@gmail.com wrote:
  @Dave: The greedy will only work if the coins are k,2k,3k,4k, nk
 without
  any of these missing
   Clear?
  (Perhaps i did not write it clearly as i was on mobile)
  --
  Rohit Saraf
  Second Year Undergraduate,
  Dept. of Computer Science and Engineering
  IIT 
  Bombayhttp://www.cse.iitb.ac.in/~rohitfeb14http://www.cse.iitb.ac.in/%7Erohitfeb14
 
 
 
  On Thu, Jun 17, 2010 at 10:00 AM, Dave dave_and_da...@juno.com wrote:
   The greedy algorithm doesn't work, e.g., when the coins are 1, 5, and
   8 units, and you want to make 15 units. In this case, the greedy
   algorithm would choose 8, 5, 1, 1, whereas the optimal is 5, 5, 5. I
   believe the criterion for the greedy algorithm are that the smallest
   coin be 1 unit and each successive coin be at least twice the value of
   its predecessor.
 
   Dave
 
   On Jun 16, 9:19 pm, Rohit Saraf rohit.kumar.sa...@gmail.com wrote:
If the coins are all multiple of some number k, you can greedily
 give
as much as possible to the higher domination. Otherwise still, there
is an optimal substructure and u can make a recurrence and use
memoization(i.e. DP)
 
--
--
Rohit Saraf
Second Year Undergraduate,
Dept. of Computer Science and Engineering
IIT 
Bombayhttp://www.cse.iitb.ac.in/~rohitfeb14http://www.cse.iitb.ac.in/%7Erohitfeb14
 
   --
   You received this message because you are subscribed to the Google
 Groups
   Algorithm Geeks group.
   To post to this group, send email to algoge...@googlegroups.com.
   To unsubscribe from this group, send email to
   algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@googlegroups.com
 algogeeks%2bunsubscr...@googlegroups­.com
   .
   For more options, visit this group at
  http://groups.google.com/group/algogeeks?hl=en.- Hide quoted text -
 
  - Show quoted text -

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algoge...@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@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 algoge...@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




-- 
Thanks,
Chakravarthi.

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

2010-06-17 Thread Senthilnathan Maadasamy
@sharad
  Can you explain the O(n*n) + O(n) space algorithm that you
mentioned?

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

2010-06-17 Thread ANUJ KUMAR
i am not getting what to do when we get a different bit from the
previous one someone please explain


On Mon, Jun 14, 2010 at 9:14 AM, Anurag Sharma anuragvic...@gmail.com wrote:
 Use iterative version :http://en.wikipedia.org/wiki/Tower_of_Hanoi

 Anurag Sharma

 On Mon, Jun 14, 2010 at 12:36 AM, ANUJ KUMAR kumar.anuj...@gmail.com
 wrote:

 http://www.spoj.pl/problems/HAN01/
 i implemented it using stack but am getting tle someone please help

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

2010-06-17 Thread Sudarshan Reddy M
http://www.amazon.com/Introduction-Algorithms-Second-Thomas-Cormen/dp/0262032937

On Thu, Jun 17, 2010 at 9:03 PM, chinna thirupathi.thu...@gmail.com wrote:

 plz can u provide material -reg:design and analysis of algorithms.
 basics of algorithms and psudocode notation,time and space
 complexity's ..etc
 thank u

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




-- 
Sudarshan Reddy M

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

2010-06-17 Thread Vivek Sundararajan
Hi Anand, your dedicated and neatly formated reply is much appreciated! :)


On 16 June 2010 23:59, divya jain sweetdivya@gmail.com wrote:

 yes u need to start frm beg..



 On 16 June 2010 17:15, Vivek Sundararajan s.vivek.ra...@gmail.com wrote:

 so, this means that i can traverse the list only from the beginning of the
 link list right?

 what if im given a pointer pointing to some node other than the head of
 the doubly linked list? will i be able to traverse in any direction now?

 please let me know if im missing something :)

 Thank you,
 Vivek


 On 16 June 2010 15:37, divya jain sweetdivya@gmail.com wrote:

 u can xor linked list. such that every node link contains the xor of its
 prev nd next node address.. since for 1st node prev is null ( 0) so its link
 contains only next. now to calculate next of 2nd node xor its link with 1st
 node's link nd u ll get 3 rd node.s adddress nd so on..

 u can also use sum. store in link the sum of prev node n next node
 address.. bt this cn result in overflow. so xor method is better


 On 16 June 2010 09:14, sharad kumar sharad20073...@gmail.com wrote:

 u have to use XOR linked list

 --
 You received this message because you are subscribed to the Google
 Groups Algorithm Geeks group.
 To post to this group, send email to algoge...@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@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 algoge...@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@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 algoge...@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@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 algoge...@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




-- 
Reduce, Reuse and Recycle
Regards,
Vivek.S

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

2010-06-17 Thread Dheeraj Jain
A collection of links:
http://geeksforgeeks.org/?page_id=6028cat=Data+Structures+%26+Algorithms

On Thu, Jun 17, 2010 at 8:33 AM, chinna thirupathi.thu...@gmail.com wrote:

 plz can u provide material -reg:design and analysis of algorithms.
 basics of algorithms and psudocode notation,time and space
 complexity's ..etc
 thank u

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algoge...@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@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 algoge...@googlegroups.com.
To unsubscribe from 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] towers of hanoi

2010-06-17 Thread ANUJ KUMAR
please post the solution to
http://www.spoj.pl/problems/HAN01/

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

2010-06-17 Thread sharad kumar
do u meand diameter of tree?? if it is so then start from the left most node
in tree and traverse upto root and traverse to the rightmost node in
tree..this u can do by having extra field in tree which is parent
pointer

On Fri, Jun 18, 2010 at 4:25 AM, Anand anandut2...@gmail.com wrote:

 Any guys suggest any algo on how to find the width of the tree.



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




-- 
yezhu malai vaasa venkataramana Govinda Govinda

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

2010-06-17 Thread Arunkumar Sreenivasan
Hi,
   You are given a set of numbers and another number 'x'. You have to find
if there exists any two numbers, whose sum is equal to 'x'. I have done this
is o(n)log n. Need a more optimized solution.

regards,
Arun kumar S

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

2010-06-17 Thread Anurag Sharma
Here is the link which fits your need.
http://www.coders2020.com/construct-a-tree-given-its-inorder-and-preorder-traversal-strings-similarly-construct-a-tree-given-its-inorder-and-post-order

Anurag Sharma


On Thu, Jun 17, 2010 at 4:34 PM, divya sweetdivya@gmail.com wrote:

 write a code to construct tree from inorder nd preorder traversal..

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

2010-06-17 Thread sharad kumar
@senthilnathan
prepare a hash table for the third array
now pick any element 4m array 1 add it to 1 element of array 2 now try to
find -(m+n) in hash table
since every element of arr1 will be sum to every arr of array2 and lookup in
hash table to be  O(1)
so overall complexity will be O(n2) time+O(n) space

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

2010-06-17 Thread Anurag Sharma
Its a repeated question. I would suggest you checking the archives of this
groups for its solution.

Anurag Sharma


On Fri, Jun 18, 2010 at 8:05 AM, Arunkumar Sreenivasan 
thegame.a...@gmail.com wrote:

 Hi,
You are given a set of numbers and another number 'x'. You have to find
 if there exists any two numbers, whose sum is equal to 'x'. I have done this
 is o(n)log n. Need a more optimized solution.

 regards,
 Arun kumar S

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algoge...@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@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 algoge...@googlegroups.com.
To unsubscribe from 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] regarding questions being repeated

2010-06-17 Thread sharad kumar
hi all,
It has been under my notice that questions has been repeated again and again
in the forum.I would request the members to kindly search for the answers in
forum rather than reposting the same question...Cos if we search the forum
we can knw till what the discussion had been carried out .and we can
continue from that .hence it will also give more valuable and complete
solutions.

Thanks and Regards,
Sharad Kumar J
Manager
AlgoGeeks.

-- 
yezhu malai vaasa venkataramana Govinda Govinda

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

2010-06-17 Thread Antony Vincent Pandian.S.
I remember this question under discussion recently. Please check the
existing threads...

On 6/17/10, debajyotisarma sarma.debajy...@gmail.com wrote:
 Find the longest palindrome in the given string.
 Minimum time-space complexity required
 (i have not solved it so don't know what is min)

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



-- 
Sent from my mobile device

Luv,
S.Antony Vincent Pandian

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