Editing Talk:287: NP-Complete

Jump to: navigation, search
Ambox notice.png Please sign your posts with ~~~~

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision Your text
Line 17: Line 17:
 
:I added this very interesting info to the explanation - at first as a trivia, but then I realized that it would not be seen by everyone - as you often do not read below the transcript. Why would you, you do not need to see what was in the comic again... So I moved it up to the solution part, because to me it is a very important fact about this comic. An error by Randall... But Dgbrt keeps moving this info away from the solution. I have understood now that the trivia should be below the transcript - although I cannot see why this should be so - as I have just described. But who says that this info should be a trivia item? It was I who put it there (by mistake?) at first. I will try not to start an editing fight here, but still think there should at least be a mention in the explanation that it was a mistake - in case you do not realize there is a trivia section below. I have used this page a lot lately, and had not found out before, that it was always below. There is not that many pages with trivia sections [[User:Kynde|Kynde]] ([[User talk:Kynde|talk]]) 11:02, 10 March 2014 (UTC)
 
:I added this very interesting info to the explanation - at first as a trivia, but then I realized that it would not be seen by everyone - as you often do not read below the transcript. Why would you, you do not need to see what was in the comic again... So I moved it up to the solution part, because to me it is a very important fact about this comic. An error by Randall... But Dgbrt keeps moving this info away from the solution. I have understood now that the trivia should be below the transcript - although I cannot see why this should be so - as I have just described. But who says that this info should be a trivia item? It was I who put it there (by mistake?) at first. I will try not to start an editing fight here, but still think there should at least be a mention in the explanation that it was a mistake - in case you do not realize there is a trivia section below. I have used this page a lot lately, and had not found out before, that it was always below. There is not that many pages with trivia sections [[User:Kynde|Kynde]] ([[User talk:Kynde|talk]]) 11:02, 10 March 2014 (UTC)
 
::Cool reference, thanks! [[User:Roman Czyborra|Roman Czyborra]] ([[User talk:Roman Czyborra|talk]]) 15:44, 15 May 2014 (UTC)
 
::Cool reference, thanks! [[User:Roman Czyborra|Roman Czyborra]] ([[User talk:Roman Czyborra|talk]]) 15:44, 15 May 2014 (UTC)
:::How could Randall have missed that the '''first price''' was a solution, when drawing the strip? I know not everyone can do this kind of math in their head, but when I read the $15.05 and glanced over at the menu, that $2.15 was an even denominator of $15.05 was immediately apparent. I'm pretty sure that it'd be hard for him to miss, even if he actually has to use arabic notation to figure it out, which would take like three seconds. —[[User:Kazvorpal|Kazvorpal]] ([[User talk:Kazvorpal|talk]]) 16:23, 1 November 2019 (UTC)
 
::::Okay, reading the interview, all I can say is that this is a pitfall of taking longcut coding shortcuts. Speaking as a perl programmer, it'd take longer to write that algorithm than to quickly do at least the basic multiples of the prices in one's head, even if one has to do it through mental arabic notation (I have mental shortcuts I worked out before learning math notation in grade school, or in some cases simply "see" the answer).—[[User:Kazvorpal|Kazvorpal]] ([[User talk:Kazvorpal|talk]]) 16:28, 1 November 2019 (UTC)
 
  
 
;Complex solution found in a second
 
;Complex solution found in a second
Line 100: Line 98:
 
Or is it the committee language Haskell that is causing problems?
 
Or is it the committee language Haskell that is causing problems?
 
What other well-defined language would you formulate a general solution in?
 
What other well-defined language would you formulate a general solution in?
 
:If anyone wants to implement this in Python: calculate in cents, use fixed-point arithmetic, or check if the absolute difference is under some tolerance, otherwise the 7 mixed fruit solution is missed. <tt>print(7 * 2.15 == 15.05)</tt> gives <tt>False</tt>.
 
  
 
Discussing all of this is helpful.
 
Discussing all of this is helpful.
Line 121: Line 117:
 
Nobody would do that in real life, right?  But look at http://www.numberphile.com/videos/43_nuggets.html . A guy orders 43 chicken nuggets, which come in boxes of 6, 9 and 20.  It is also a Knapsack problem in a menu order.  But in that case there is no solution.
 
Nobody would do that in real life, right?  But look at http://www.numberphile.com/videos/43_nuggets.html . A guy orders 43 chicken nuggets, which come in boxes of 6, 9 and 20.  It is also a Knapsack problem in a menu order.  But in that case there is no solution.
 
:I tried solving what you described without of clicking the link (still didn't) and before reading the last sentence, and this one is very obvious and quick to find not solvable. As 43 is abviously not dividable by 3 (as one can see at first glance and which would be required to use only 9-boxes and 6-boxes) we need at least one 20-box. Leaving 23 nuggets. That's still not dividable by 3 so there is another 20-box, leaving us at 3 nuggets. Other approach sees that at first we need a package of 9, to get to an even number, and then 9-boxes can only be choosen in pairs at 18-boxes which is no benefit to 6-boxes, so it is only 6 and 20 left. 34 is not dividable by 3 and/or 6. So again subtracting 20 makes it 14, which is obvious to be unsolvable by using only 6-boxes. So "your" problem is quite more trivial. BTW: please sign your comments. --[[User:Lupo|Lupo]] ([[User talk:Lupo|talk]]) 10:42, 24 June 2019 (UTC)
 
:I tried solving what you described without of clicking the link (still didn't) and before reading the last sentence, and this one is very obvious and quick to find not solvable. As 43 is abviously not dividable by 3 (as one can see at first glance and which would be required to use only 9-boxes and 6-boxes) we need at least one 20-box. Leaving 23 nuggets. That's still not dividable by 3 so there is another 20-box, leaving us at 3 nuggets. Other approach sees that at first we need a package of 9, to get to an even number, and then 9-boxes can only be choosen in pairs at 18-boxes which is no benefit to 6-boxes, so it is only 6 and 20 left. 34 is not dividable by 3 and/or 6. So again subtracting 20 makes it 14, which is obvious to be unsolvable by using only 6-boxes. So "your" problem is quite more trivial. BTW: please sign your comments. --[[User:Lupo|Lupo]] ([[User talk:Lupo|talk]]) 10:42, 24 June 2019 (UTC)
 
TSP is NP-hard, not NP-complete [[User:Tembrel|Tembrel]] ([[User talk:Tembrel|talk]]) 00:19, 14 November 2019 (UTC)
 
 
If you guys like the knapsack problem and simplified stuff, then I've got the game mod for you! https://steamcommunity.com/sharedfiles/filedetails/?id=1844662069 along with https://ktane.timwi.de/HTML/Simon%20Selects.html
 
 
(I also tried solving this like I would that mod, but then I realized that this problem is not that.) [[Special:Contributions/172.69.34.24|172.69.34.24]] 03:05, 18 July 2020 (UTC)
 
 
;On general solutions
 
The explanation seems to assume that general solutions must be in polynomial time, but the comic does not mention that. It seemed to me that finding a non-polynomial general solution (which exist, obviously, with one even described in the explanation) *still* gets a 50% tip, which also means the 50% tip is a lot more reasonable now. While mentioning that no polynomial GS exists is probably still a good idea, it seems to me that the explanation should not assume one is neccessary for the tip. [[Special:Contributions/172.68.238.109|172.68.238.109]] 00:59, 24 October 2022 (UTC)
 

Please note that all contributions to explain xkcd may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see explain xkcd:Copyrights for details). Do not submit copyrighted work without permission!

To protect the wiki against automated edit spam, we kindly ask you to solve the following CAPTCHA:

Cancel | Editing help (opens in new window)

Template used on this page: