 Now I was going to start by saying that I had been looking forward to this all day and then after that last talk I didn't want to go at all because it was so good. And then all this stuff happened and this morning I adjusted the slides so the folks in the back would be able to read them and now I don't have that adjustment anymore. I'm really sorry. It's always, this is going to suck and F11 doesn't work. This computer stuff is really complicated. Actually Leo told me I can go right up until 5 o'clock so if I take a couple extra minutes that's cool. Let's see. There we go. All right. So there's this class of problems called NP for which what it means is that if somebody hands you a solution to the problem it's, everything cool? Well I could have just stepped back. If somebody hands you a solution to the problem or something that they claim is a solution you can fairly easily and efficiently decide whether they're telling you the truth or not. And lots and lots of problems are in this class. Kind of a dopey example is sorting. So like if you're not doing the sorting yourself somebody comes along and says well here's the sorted version of the list you're trying to sort and you just got to kind of make sure that the elements are all the same in both lists and then you check the one that the other person gave you and make sure the elements are in ascending order and say okay yeah that is sorted you can do that efficiently. And there's actually an easier way which is since sorting is not hard to do efficiently anyway you'll learn maybe how to do it in sophomore data structures class. You take the list that you're handed and you take the input list and you sort the input list and then you compare it to see if they're the same. So that was kind of silly. Problems that are easy to solve necessarily are easy to check the solutions to. You solve it and then you see if what you got is the same as right. So but there's more interesting NP problems that we'll see in a moment. Some people are probably wondering what is NP stand for or why is it NP and the NP stands for it's not important. Okay but not all problems are easy to solve like sorting and it's it's quite possible that that you have a problem where it's it's hard to find a solution but if somebody hands you something they claim as a solution it's easy to check whether they're telling you the truth and my my favorite example of that is this is terrible is moving van loading okay so you've got all your stuff out on the sidewalk and the question is does it all fit into the van and you start loading it in and when you're all done there's seven things left on the sidewalk and is that because you have too much stuff and the van is not big enough or is it because you messed up somewhere back on item 15 and if you'd only put it in sideways everything else would have gone in well okay so it can be really hard to pack a moving van who's moved yeah okay right but but if somebody comes to you puts the stuff into the van and says look it's all packed it fit it's really easy to verify whether they're telling the truth you just shut the door and if it shuts all the way oh my gosh thank you so so there's a familiar example of another NP problem and let's see what else now all the text is too small crossword puzzles right could be could be really hard to solve the crossword puzzle but if somebody hands you one that's already filled in you just got to check to make sure each word matches the clue and that the words all line up and that that'll be quick conference scheduling I'm not going to go into that at length because we've only got one room here it's kind of a trivial case if you've ever done homework you know you can toil over the homework problems for hours and hours but the greater can check the answers in seconds sometimes so it's a lot easier to check to see if you get the right answer than it is to come up with the right answer so there's a lot of these problems where it's hard to find a solution but it's easy to check if you're given one right so of these NP problems there's one that is super special called sat which is short for satisfiability and the problem is that somebody gives you a formula involving ands and ors and knots and variables and the question is is there a way to assign true and false variable values to the variables so that the formula comes out to be true and it's clearly an NP because if somebody came and magically said oh yeah make this one true this one true that one false this one true you could check just by evaluating the formula to see if it came out to be true or whether they were telling you correctly that it was a solution but it could in least in principle be very difficult to define what values you assigned to the to the variables to to make the formula true and there might not be any you could of course try every possible assignment but that takes too long if there's a lot of variables it takes exponential time and in fact nobody knows a good algorithm for this problem that works in every case efficiently now here's the thing that's magical about this problem if you did have a good algorithm for solving it you could take any problem in NP any NP problem whatsoever and you could take your algorithm for SAT and you could convert it into an efficient algorithm for solving whatever your favorite NP problem is so solving solving this one SAT problem finding an efficient algorithm for it would solve every other problem in NP and so for this reason we say that this this SAT problem is NP complete a solution for SAT would completely solve NP another thing we sometimes say is that SAT is the hardest problem in NP because it's possible that you might have a good algorithm to solve your favorite problem but not be able to solve NP but it is not possible to have the reverse so and SAT is at least as hard as whatever your favorite problem is and this this discovery was was independently by by Cook and Levine Levine was in Russia so he didn't hear about Cook he solved it around the same time but then didn't publish I don't know I don't know why I'm telling you this is not important all right who's that let's see the other thing that's interesting about this NP complete is it turns out not just SAT is NP complete there turned out to be a large family of NP complete problems and this mathematician named Karp discovered the following year there are a whole bunch of them and he gave a list of 21 NP complete problems one of them is SAT one is this thing called Hamiltonian cycle which is can you find a path from that hits all the cities and returns to a starting point but doesn't touch any of the edges more than one I'm sorry doesn't touch any of the cities more than once and and then 19 others of you know various interests and so these things actually turn out to be common and a solution to any one of them an efficient algorithm to solve any one of these 21 problems would completely solve NP and therefore would solve the other 20 they're all very well studied problems and still nobody knows a good algorithm for any of them because if they did they would know a good algorithm for all of them it's kind of surprising since then people have discovered hundreds of NP complete problems is a huge huge family of these things and we can't solve any of these we can solve them in special cases we can find almost optimal solutions we have algorithms that are really good except for a few weird examples where they blow up and then everything goes wrong somehow which is kind of weird all right so my favorite one of these we have to have a little digression now hey Leo how much time have I got awesome this this little guy here is is Elmo who knows Elmo okay because Elmo has dominated Sesame Street for like the last 30 years if you're if you're old and bald like me then you can remember a time before Elmo and so this is Elmo who is beloved of toddlers and wait a minute where might there we go this is my toddler from she's now 11 she was a very demanding kid she's like some kids you can just like leave them and you know then you come back later they've they've amused themselves they were like you know put their foot in their mouth or whatever kids do she would if you left the room for like 30 seconds you would make this noise that is is optimized over millions of years of evolution to be the most unpleasant possible sound and since I had a day job my wife was left doing this and she would like like take care of the kid all day and then she'd have to eat lunch and she couldn't eat lunch so she would take this is iris she would take iris and prop her up in this this device you see which supports the kid and it's got a bunch of entertaining things the kid can revolve but can't actually go anywhere and would then park her in front of Sesame Street to watch Elmo's world which lasts 20 minutes and during this 20 minutes she would be able to sneak off and make lunch and eat it and that was her like 20 minutes away from the kid this thing I have we found out is is called by parents is called a neglect those saucer iris was obsessed with Elmo and it turns out almost like everywhere and we were going up the stairs once for example and iris is like it's Elmo and this is what she saw on the stairs all right so what what is almost world about it's 20 minutes long as I said and every 20 minutes segment is about some topic that's of interest to toddlers such as can you folks in the back actually see this list or should I read it aloud I got I read it read some of it babies bananas baths bicycles birds birthdays books brushing teeth bugs cats dancing dogs drawing ears exercise families good yeah so this is a typical this is not by any means the complete list but it's a good it's a good sample all right then you don't have to catch these live they also distribute them on it used to be video cassette now of course it's DVD and since they want the video cassettes and the DVDs to be uniform length I guess an hour they would parcel these out in groups of three three episodes per video release so for example and we of course owned many of these so that they could be delivered to iris on demand they always have three so here we see this one's dancing music and books and that's the title of the video really dancing music and books and then here's one called hands ears and feet and you can see there's there's a common thread each one has like a theme right hands ears and feet they go together and sorry sometimes they they have you know a different title like this one's wake up with Elmo but it packages together the three related segments on sleeping getting dressed and brushing your teeth and this one is called people in your neighborhood and it packages together the three segments on firefighters lifeguards and nurses two minutes we're gonna be cool you don't you can stop telling me I'm gonna finish on time in fact I could digress at this point okay so so here's the constellation of of Elmo's world segments a small fraction of them and I've circled the the related groups right and so some of these are related some aren't if you you put together a video release called on shoes bugs and drawing people would be puzzled and that apparently is considered a no-no so you got the question if you're if you're designing these video releases how do you pick the groups of three and it should be clear there's some some constraints on this you can't put the same segment onto two different video releases because then the person who pays for it is gonna say hey I got cheated I paid for three but I've already got this one and similarly you've got a certain number of segments you'd like to include every one of them on some video release so the question is you have a bunch of groupings which I'm gonna show you let's say here's a hypothetical collection of acceptable groupings and each acceptable group of three is now surrounded by a colored wiggly line and you want to say okay well I want to pick the the groups of three that make the acceptable video releases but no two groups of three can overlap because that would put the same segment on two different videos and and we have to include all of them and so there's a kind of a weird interplay of constraints here right because if I decide to put the getting dressed in with shoes and jackets that forecloses the possibility of doing getting dressed brushing teeth sleeping right and so I can pick some of these but they have to not overlap and they have to somehow hit everything and where are we going with this I know Leo's getting nervous but so my favorite NP complete problem is this one from carp from 1972 the original paper that identify these 21 problems called exact cover by three sets which the computer science people call x3c because xc3 would have been too obvious x3c and at this point I would stop and I would I would explain in detail what x3c is except I did it's that exactly and there isn't anything else to say about it so one of the canonical original NP complete problems from Richard Carp's original paper in 1972 is the problem of how to plan almost world video releases and since it's NP complete there's no known good algorithm for it not in 1972 and not 30 years ago and not today and so how did they how did they solve this problem and the answer is they couldn't they couldn't because this one is about flowers bananas and hair thank you very much