## ← 11-22 Smart Search Tree

• 1 Follower
• 42 Lines

### Get Embed Code x Embed video Use the following code to embed this video. See our usage guide for more details on embedding. Paste this in your document somewhere (closest to the closing body tag is preferable): ```<script type="text/javascript" src='https://amara.org/embedder-iframe'></script> ``` Paste this inside your HTML body, where you want to include the widget: ```<div class="amara-embed" data-url="http://www.youtube.com/watch?v=4q0nXUwVqgk" data-team="udacity"></div> ``` 1 Language

Showing Revision 1 created 10/03/2012 by Amara Bot.

1. We started out with a brute force algorithm,
2. and the brute force algorithm basically considered 2 to the power of N assignments.
3. Now let's look at our smart search tree or intelligent search tree
4. and see how that is structured.
5. We're going to do a worst case analysis here.
6. We start out with a graph where we don't have any assignments,
7. and then we branch into 3 different possibilities.
8. Up here we don't know anything, so we have 0 vertices assigned.
9. Now, since we know that we can construct it
10. so that in the next level we will have at least 2 more vertices assigned,
11. here we know that we have at least 2 vertices assigned.
12. We can go 1 level deeper and again we will branch into 3 possibilities all of the time.
13. Because we're doing a worst case analysis, of course we could already be done.
14. Or let's say we just continue.
15. In the next level we have again at least 2 more,
16. so we have at least 4 vertices assigned and so on.
17. So let's say we continue the search tree in this manner,
18. so we will always get wider and wider and wider.
19. Then we know 2 things.
20. One is that the number of levels that we have can be, at most, N/2
21. because every time we assign at least 2 vertices.
22. So N and a half levels is the maximum number of levels that we can have
23. because after that, all vertices have been assigned.
24. And another thing that we know is that while we start out with 1 possibility
25. and each time we go 1 level deeper, again doing a worse case analysis here,
26. the number of possibilities that we consider triples.
27. The tree basically gets wider by a factor of 3.
28. The width is times 3 at each level.
29. My question for you is if you look at the lowest level of the search tree,
30. each of these ones down here is an assignment of 0 and 1 to the vertices.
31. What I would like you to think about is how many different assignments
32. do we have at this level down here, level N/2?
33. You can assume for simplicity that N is an even number, so N/2 will be some integer.
34. I'll give you a number of choices.
35. Is it 2 to the power of N assignments that we have down here?
36. Is it 3 to the power of N/2 assignments that we have down here?
37. Is it 3 to the power of N? Is it 2 to the power of 3 times N?
38. Or is it 2 to the power of N/2 times 3?