C241 PLTL SESSION – 2/22/2015 Graph Theory & Binary Search Trees Warm-Up Exercise • Grab a worksheet • Begin completing the worksheet in pairs or small groups Problem 1 Put the following sequence of numbers into a binary search tree data structure: 8, 7, 9, 5, 20, 12, 1, 4 What is the root of your tree? What is the depth of the resulting tree? Problem 2 Consider the binary search tree data structure. What other sorts of data could it be useful for storing? Come up with three different situations in which you would use a binary search tree (BST) to represent your data. Problem 3 Draw the following situation as a graph, (like the one from class today): In the domain of all people, everyone is mortal. Alex is nice and he trusts everyone, but no one trusts Alex. Ben and Chris trust each other, but only Ben is nice. Also, assume that everyone trusts themselves. (Note: In this context, “everyone” means Alex, Ben, and Chris. Also, think of the truth relation as a two-way street). T(x, y) = x trusts y M(x) = x is mortal N(x) = x is nice Problem 4 Given the situation drawn above, translate the following into statements of predicate logic, and then assess the truth of each statement: • A. Everyone is mortal. • B. Everyone is mortal or nice. • C. Everyone trusts someone. • D. Everyone who is trustworthy is also nice. • E. Someone trusts everyone. • F. Everyone trusts someone nice, excluding themselves.