User Tools

Site Tools


haas:fall2018:data:projects:sln0

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
haas:fall2018:data:projects:sln0 [2018/08/20 15:42] wedgehaas:fall2018:data:projects:sln0 [2018/09/02 12:03] (current) wedge
Line 9: Line 9:
 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__Updated proposed node attributes from names of "contents" and "to" to the "info" and "right" names as announced in class (20180902)
  
 =====Objective===== =====Objective=====
Line 30: Line 30:
 For starters, our "node" will contain two items: For starters, our "node" will contain two items:
  
-  * a data field called **contents** +  * a data field called **info** 
-  * an arrow pointing to the next neighboring node to our immediate right, called **to**+  * an arrow pointing to the next neighboring node to our immediate right, called **right**
  
 If we do not have another node to point an arrow at, we'll want to point it at a specific value indicating nothing. In our case, that value is **NULL** (must be all caps). If we do not have another node to point an arrow at, we'll want to point it at a specific value indicating nothing. In our case, that value is **NULL** (must be all caps).
Line 72: Line 72:
  
 <code c> <code c>
-tmp -> contents = 57+tmp -> info = 57
 </code> </code>
  
Line 87: Line 87:
  
 <code c> <code c>
-start -> to = tmp2+start -> right = tmp2
 </code> </code>
  
-(as tmp was also pointing to the same node, we could just as easily have said "tmp -> to = tmp2", and we may have wanted to use that approach instead, as the idea behind **start** is to use it as an anchoring reference point only).+(as tmp was also pointing to the same node, we could just as easily have said "tmp -> right = tmp2", and we may have wanted to use that approach instead, as the idea behind **start** is to use it as an anchoring reference point only).
  
 The result of that assignment results in the following: The result of that assignment results in the following:
Line 108: Line 108:
  
 <code c> <code c>
-tmp3 -> to = start+tmp3 -> right = start
 </code> </code>
  
Line 137: Line 137:
 The longer you hold out and resist from drawing pictures, the longer a lot of this may be difficult or frustrating. The longer you hold out and resist from drawing pictures, the longer a lot of this may be difficult or frustrating.
 ====Creating a node==== ====Creating a node====
-To create a node, in pseudo-code, we call a special "**mknode()**" function. As a parameter, it takes the value we wish to initially be present in the node (the **contents** field).+To create a node, in pseudo-code, we call a special "**mknode()**" function. As a parameter, it takes the value we wish to initially be present in the node (the **info** field).
  
 **mknode()** returns the location of this new node, so in order to prevent it from getting lost, we need to assign a variable to it (much as our start, tmp, tmp2, tmp3 variables do). **mknode()** returns the location of this new node, so in order to prevent it from getting lost, we need to assign a variable to it (much as our start, tmp, tmp2, tmp3 variables do).
Line 220: Line 220:
 <code c> <code c>
 start = tmp = mknode(2) start = tmp = mknode(2)
-tmp -> to = mknode(4) +tmp -> right = mknode(4) 
-tmp = tmp -> to +tmp = tmp -> right 
-start -> to -> to = mknode(8) +start -> right -> right = mknode(8) 
-tmp = tmp -> to +tmp = tmp -> right 
-tmp -> to = mknode(16)+tmp -> right = mknode(16)
 </code> </code>
  
Line 236: Line 236:
  
 ====Displaying the list==== ====Displaying the list====
-Assuming you do not know the composition of the list, write the code to display the list contents from start to end (end is defined as when a node's 'to' pointer points to NULL)+Assuming you do not know the composition of the list, write the code to display the list contents from start to end (end is defined as when a node's 'right' pointer points to NULL)
  
 ====Appending to the list==== ====Appending to the list====
haas/fall2018/data/projects/sln0.1534779739.txt.gz · Last modified: 2018/08/20 15:42 by wedge