1.
Colorado Technical University MAT200-0802B-02, Discrete Mathematics, Phase 3 Task #2 Group #3: Loren Schwappach, Gregory Shelton, Sammie Snowden, Richard Wallace, Jonathan Woodard TerraCorp MemorandumTo: V-MachineFrom: TerraCorp GroupDate: 06/12/08Re: Explanation of Database ElementsMessage:Our team of test engineers, database experts, and computer programmers at TerraCorp hasdeveloped the following document to explain several elements of database design. Thedocument is broken down into two sections. The first section covers database relations andfunctions and the second covers trees and tree structures.Section 1: Relations and functions: Part A: What are Relations and Functions? A relation is a relationship between two sets of information (Stapel, 2008). Whenever two objects are seen to form some kind of connection the connection is known as a relation. A relation uses ordered pairs to show some kind of relationship shared between the pairs. For example the ordered pair, (Bald, Man), says that some Men are bald. Bald is known as the domain or (x) value, and Man is the range or (y) value. In a relation the range can have multiple domains and a domain can have multiple ranges. In database terms this relationship is known as a 1:M, M:M, or M:1 relationship, where M refers to multiple. The graph of a relation is very simple. Here is an example showing a 1:M relationship between the (x) and (y) values: 1
2.
MAT200-0802B-02 Group 3 Figure 1: 1:M Relationship A function has the same basic definition as a relation. However, a function mustmeet certain rules to be called a function. A function can be called a “well behavedrelation” (Stapel, 2008). This is due to the relationships between the domain and range.To be a function a relation domain must have only one range. For instance in the relationordered pair, (Bald, Man), unique identifiers will have to be added to only allow for a 1:1relationship. This ordered pair, (Man, Bald), guarantees that only one range is pairedwith the domain. A graph representing a function is shown below where the (x) valueonly has one unique value of (y). A function can also be portrayed using a parabola. Aslong as the domain only has one range the graph qualifies as a function. Figure 2: Function 2
3.
MAT200-0802B-02 Group 3 All functions can be a relation, however not all relations can be functions. Therelation (Birthdays, Students) can be an M:1 relationship. This is not a function becausemore than one student (range) can have the same birthday (domain). To make this afunction we can change Students to be the domain and add School, student id or evenleave birthdays as the range. If we use school then all students will return the same valuefor the range. However, it is still only one value. A graph showing this function wouldbe a straight horizontal line. If we used student id then the students will have uniqueranges. This is a better example of a function.Given the following Client and Engine type data (Referenced in Parts B, C, D, E): Clients = {VRoomHouse, MyRides, NifftyRods, AllFastAuto, Bumper2Bumper} Engines = {ZR2, XTurbo, Omy442, Rokit350}Part B: Binary Relation between Clients and Engines: a. ( ZR2, VRoomHouse), (ZR2, MyRides) b. (XTurbo, MyRides), (XTurbo, NifftyRods) c. (Omy442, NifftyRods), (Omy442, AllFastAuto) d. (Rokit350, AllFastAuto), (Rokit350, Bumper2Bumper)Part C: Function of Clients and Engines: a. (VRoomHouse, ZR2) b. (MyRides, XTurbo) c. (NiftyRods, Omy442) 3
4.
MAT200-0802B-02 Group 3 d. (AllFastAuto, Rokit350) e. (Bumper2Bumper, ZR2) Part D: Diagraph of the function from Part C: VRoomHouse ZR2 MyRides Xturbo NiftyRods Omy442 AllFastAuto Rokit350 Bumper2Bumper Figure 3: Function directed graph Part E: Diagraph of the relation from Part B: ZR2 VRoomHouse Xturbo MyRides Omy442 NiftyRods Rokit350 AllFastAuto Bumper2Bumper (Hauskrecht, 2006) Figure 4: Binary directed graphSection 2: Trees and Tree Structures: Part A: What is a Tree and what is the difference between binary and n-ary trees? Trees also known as tree-graphs are powerful creations used for the visualization, structure, and development of database systems. Trees offer an organized approach to object and element relationships. 4
5.
MAT200-0802B-02 Group 3 According to CTU trees are a subset of graphs and normally have exactly onevertex referred to as the root (not all trees have roots) and with directed edges referred toas branches that head downwards towards other vertices (children). (CTU Online, 2008)Dependent upon the depth of the tree, as the tree branches flow downwards each branchwill connect to lower level vertex. If this vertex spans additional branches it is known asa fork, if the vertex does not span additional branches it is known as a leaf. One lastrequirement of a tree is that it must not contain any cycles (explained later). Trees offeramazing features for navigating, searching, and sorting within a database. Figure 5: Tree-graph CTU classifies n-ary tree-graphs as tree-graphs where each vertex can have nchildren vertices connected to it. (CTU Online, 2008) CTU classifies binary tree-graphsas tree-graphs where no vertex connects to more than two children vertices. (CTUOnline, 2008) Our team has illustrated this on the next page. 5
6.
MAT200-0802B-02 Group 3 Figure 6: Binary vs. N-ary treesPart B: Hierarchical database using a tree structure: As illustrated by the example tree graph, trees can contain data hierarchies toassist in searching, sorting, and navigating through the tree. CEO Secretary Vice President Secretarial Administrative Treasurer Assistant Assistant Client 1 Client 2 Client n Figure 7: Hierarchical database tree structure 6
7.
MAT200-0802B-02 Group 3Part C: Traversing a tree (depth-first search and breadth-first search methods): There are many different ways to traverse and search a tree. Some of the easiestways to search through a tree are the breadth-first and depth-first searches. The Breadth-First search moves through all of the vertices or children on a given level before going tothe next level. With this type of search you would start at the root of the tree and startsearching, moving to all of the children of the root at level 2 before moving on to theirchildren at level 3. With the breadth-first search, the tree is searched without testingagainst the goal until the solution is found. This makes it a very slow way to search a tree(Johnsonbaugh, 2009). Depth-first searches also start at the root of a tree but instead of traveling througheach level one at a time this search travels through a path that takes it to the greatestheight for that path, and then backtracks until it can find another path that it has notexplored to travel. This is continued until all paths have been traced. The depth-firstsearch is also searches without testing against the goal until the solution is found(Johnsonbaugh, 2009). There are faster ways to search a tree but the breadth-first and depth-first searchesare exhaustive searches. If we were to use one of these analyze a chess game I wouldchoose the breadth-first search as it will allow me to look at the next few move optionsinstead of following one move-path all the way to the end. This will allow me to adapt ifa player decides to make an unexpected move. 7
8.
MAT200-0802B-02 Group 3References:CTU Online, (2008). Multimedia Material, Retrieved Jun, 10, 2008, from Colorado Technical University Web site: https://campus.ctuonline.eduHauskrecht, M. (2006). CS 441 Discrete Mathematics for CS Lecture 34: Relations. Retrieved June 11, 2008, from http://www.cs.pitt.edu/~milos/courses/cs441/lectures/Class34.pdf Web site: http://www.cs.pitt.edu/~milos/courses/cs441/lectures/Class34.pdfJohnsonbaugh, R. (2009). Discrete Mathematics (7th ed.). Upper Saddle River, New Jersey: Pearson Prentice Hall.Stapel, E. (2008). Functions versus relations. Retrieved June 2, 2008, from Purplemath Web site: http://www.purplemath.com/modules/fcns.htmWeisstein, E. (2005). Binary tree. Retrieved June 10, 2008, from Wolfram MathWorld Web site: http://mathworld.wolfram.com/BinaryTree.htmlWeisstein, E. (2005). Planted tree. Retrieved June 10, 2008, from Wolfram MathWorld Web site: http://mathworld.wolfram.com/PlantedTree.htmlWeisstein, E. (2005). Rooted tree. Retrieved June 10, 2008, from Wolfram MathWorld Web site: http://mathworld.wolfram.com/RootedTree.htmlWeisstein, E. (2005). Tree. Retrieved June 10, 2008, from Wolfram MathWorld Web site: http://mathworld.wolfram.com/Tree.htmlAttachments: None 8
Clipping is a handy way to collect and organize the most important slides from a presentation. You can keep your great finds in clipboards organized around topics.
Be the first to comment