User Tools

Site Tools


haas:spring2015:data:projects:dlt0

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
haas:spring2015:data:projects:dlt0 [2015/04/26 17:12] – [Reference Implementation] wedgehaas:spring2015:data:projects:dlt0 [2015/05/03 13:58] (current) – [Errata] wedge
Line 11: Line 11:
 This section will document any updates applied to the project since original release: This section will document any updates applied to the project since original release:
  
-  * __revision #__<description> (DATESTAMP)+  * __revision 1__unit test for **traverse_r()** now available (20150502) 
 +  * __revision 2__: unit tests for **cptree_r()** and **rmtree()** now available (20150502) 
 +  * __revision 3__: unit tests for **grabnode_r()** now available (20150503) 
 + 
  
 =====Objective===== =====Objective=====
Line 21: Line 25:
 Truth be told, the simplest tree is merely a list- the underlying data structure we've worked with all semester. But now, under this new light, we can start to look at a list as merely a procession of singled childed nodes. The more things are different, the more they are the same... Truth be told, the simplest tree is merely a list- the underlying data structure we've worked with all semester. But now, under this new light, we can start to look at a list as merely a procession of singled childed nodes. The more things are different, the more they are the same...
  
-The simplest conceptual tree is one which has a minimum of two connections- often these are called 'binary' trees. We will use that description interchangeably here with 'doubly linked trees'. +The simplest conceptual tree is one which has a maximum of two connections- often these are called 'binary' trees. We will use that description interchangeably here with 'doubly linked trees'.
- +
-The premise behind a tree is that of a parent-child relationship. Each node can be a parent (of up to two child nodes), and each child can in turn be its own parent (of up to two child nodes). This creates a connection between relationships of nodes (ie a parent and its descendants), and ends up offering some interesting and useful algorithmic opportunities, along with implementation experience. +
  
 +The premise behind a binary tree is that of a parent-child relationship. Each node can be a parent (of up to two child nodes), and each child can in turn be its own parent (of up to two child nodes). This creates a connection between relationships of nodes (ie a parent and its descendants), and ends up offering some interesting and useful algorithmic opportunities, along with implementation experience.
 ====conceptualizing a tree==== ====conceptualizing a tree====
 It is common to think of a tree as a vertical structure, upside-down from the item we commonly think of in nature. Here we will have the tree's "root" at the very top, and all the branches (nodes, and connections to nodes) growing down and out from the root. It is common to think of a tree as a vertical structure, upside-down from the item we commonly think of in nature. Here we will have the tree's "root" at the very top, and all the branches (nodes, and connections to nodes) growing down and out from the root.
Line 37: Line 39:
   * an important action that will be taking place is the traversal of the tree- ie walking it in certain orders to achieve desired results (sorting/ordering of values, among other things).   * an important action that will be taking place is the traversal of the tree- ie walking it in certain orders to achieve desired results (sorting/ordering of values, among other things).
  
-As we will be placing nodes in the tree according to their stored values (lesser values go to the left, or prior; greater values go to the right, or after), our tree will naturally sort our data for us. As such, the tree we will be implementing will also be a //sorted binary tree//. +As we will be placing nodes in the tree according to their stored values (lesser values go to the left, or prior; greater values go to the right, or after), our tree will naturally sort our data for us, allowing us to search through its contents quite advantageously. As such, the tree we will be implementing is also known as a //binary search tree//.
 ====tree height can matter==== ====tree height can matter====
  
Line 103: Line 104:
 Figure out what is going on, the connections, and make sure you understand it. Figure out what is going on, the connections, and make sure you understand it.
  
 +===Suggested Implementation Order===
 +To make your life easier, I recommend implementing tree library functions in the following order:
  
-====Node Library unit tests==== +  - **mktree()** 
-As a result of the addition of **other**, an updated set of unit tests will be released (this will mean a different number of total tests for list than previously).+  **addnode()** 
 +  - **searchtree()** 
 +  - **traverse_r()** 
 +  - **grabnode_r()** 
 +  - **cptree_r()** 
 +  - **rmtree()**
  
-Be sure to run the various node unit tests and verification scripts to see which functions have fallen out of compliance with the node struct specification changes issued in this project. The **verify-node.sh** script can be especially useful in getting a big picture view of what work is needed.+You will really want the later functions to make use of the earlier functions to facilitate implementation (ie **cptree_r()** will likely want to make use of **traverse_r()** and **addnode()**, and **rmtree()** could take advantage of **traverse_r()** and **searchtree()** and **grabnode_r()**). 
 + 
 +Note that **grabnode_r()** can be implemented earlier, as it only really needs **mktree()**, but you may find its implementation more involved.
 ====Tree library unit tests==== ====Tree library unit tests====
 In **testing/tree/unit/**, you will //eventually// find these files: In **testing/tree/unit/**, you will //eventually// find these files:
Line 113: Line 123:
   * **unit-addnode.c** - unit test for the various **addnode()** library function   * **unit-addnode.c** - unit test for the various **addnode()** library function
   * **unit-searchtree.c** - unit test for the various **searchtree()** library function   * **unit-searchtree.c** - unit test for the various **searchtree()** library function
-  * **unit-grab.c** - unit test for **grabnode_*()** library functions +  * **unit-grabnode.c** - unit test for **grabnode_r()** library function 
-  * **unit-set_mode.c** - unit test for **set_mode()** library function +  * **unit-mktree.c**   - unit test for the **mktree()** library function 
-  * **unit-balance.c** - unit test for **balance()** library function +  * **unit-cptree.c**   - unit test for **cptree_r()** library function 
-  * **unit-treeops.c**   - unit test for {mk,rm}tree library functions +  * **unit-rmtree.c**   - unit test for **rmtree()** library function 
-  * **unit-traverse.c** - unit test for **traverse_*()** library functions +  * **unit-traverse.c** - unit test for **traverse_r()** library function
-  * **unit-print.c** - unit test for displaying tree structure+
  
-**NOTE**: At the time of project release, unit tests are not yet available; so they will be released as they are developed+**NOTE**: At the time of project release, not all unit tests are available/fully functional; so expect some updates.
  
 There are also corresponding **verify-FUNCTION.sh** scripts that will output a "MATCH"/"MISMATCH" to confirm overall conformance with the pertinent tree functionality. There are also corresponding **verify-FUNCTION.sh** scripts that will output a "MATCH"/"MISMATCH" to confirm overall conformance with the pertinent tree functionality.
Line 142: Line 151:
 To assist you in verifying a correct implementation, a fully working implementation of the node and tree libraries should resemble the following (when running the respective verify script): To assist you in verifying a correct implementation, a fully working implementation of the node and tree libraries should resemble the following (when running the respective verify script):
  
- 
-====node library==== 
-Here is what you should get for node: 
- 
-<cli> 
-lab46:~/src/data/dlt0$ bin/verify-node.sh  
-==================================================== 
-=    Verifying Doubly-Linked Node Functionality    = 
-==================================================== 
-  [mknode] Total:   6, Matches:   6, Mismatches:   0 
-  [cpnode] Total:   8, Matches:   8, Mismatches:   0 
-  [rmnode] Total:   2, Matches:   2, Mismatches:   0 
-==================================================== 
- [RESULTS] Total:  16, Matches:  16, Mismatches:   0 
-==================================================== 
-lab46:~/src/data/dlt0$  
-</cli> 
- 
-With the addition of the **other** pointer, we have a few additional combinations to test. 
  
  
haas/spring2015/data/projects/dlt0.1430068357.txt.gz · Last modified: 2015/04/26 17:12 by wedge