User Tools

Site Tools


haas:fall2017: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
Next revision
Previous revision
haas:fall2017:data:projects:sln0 [2017/08/27 15:35] – [Displaying the list] wedgehaas:fall2017:data:projects:sln0 [2017/08/29 12:44] (current) – [Objective] wedge
Line 16: Line 16:
 In this project, we start conceptualizing aspects of the program we wrote in last week's project (with the arrays), and start looking at each unit of information as an arbitrary **node** unit, connected to its immediate proceeding neighbor via a **link**. In this project, we start conceptualizing aspects of the program we wrote in last week's project (with the arrays), and start looking at each unit of information as an arbitrary **node** unit, connected to its immediate proceeding neighbor via a **link**.
  
-This gets us into a central theme of the course which we'll be running with from now until the end- the idea of linked nodes, or in our current case: singly-linked nodes.+This gets us into a central theme of the course which we'll be running with from now until the end- the idea of linked nodes, or in our current case: singly-linked nodes.
  
 =====Overview===== =====Overview=====
Line 51: Line 51:
 So here is a picture of what that same node would look like, while also associating a variable known as **start** with it. So here is a picture of what that same node would look like, while also associating a variable known as **start** with it.
  
-{{ :haas:fall2017:data:projects:sln0-1.png |}}+{{ :haas:fall2016:data:projects:sln0-1.png |}}
  
 ===temporary node variables=== ===temporary node variables===
Line 65: Line 65:
 And that would produce the following result: And that would produce the following result:
  
-{{ :haas:fall2017:data:projects:sln0-2.png |}}+{{ :haas:fall2016:data:projects:sln0-2.png |}}
  
 Note that **tmp** does **NOT** point to **start**, which points to the node-- instead, **tmp** points to what **start** points to. This is very important. Note that **tmp** does **NOT** point to **start**, which points to the node-- instead, **tmp** points to what **start** points to. This is very important.
Line 79: Line 79:
 That would leave us with the following image: That would leave us with the following image:
  
-{{ :haas:fall2017:data:projects:sln0-3.png |}}+{{ :haas:fall2016:data:projects:sln0-3.png |}}
  
 ===connecting two nodes together=== ===connecting two nodes together===
 If we had a second node, **tmp2**, containing a 37 and pointing at nothing, we'd have a scenario like this: If we had a second node, **tmp2**, containing a 37 and pointing at nothing, we'd have a scenario like this:
  
-{{ :haas:fall2017:data:projects:sln0-4.png |}}+{{ :haas:fall2016:data:projects:sln0-4.png |}}
  
 If we wanted start's node to point to tmp2's node, we'd want to do something like this: If we wanted start's node to point to tmp2's node, we'd want to do something like this:
Line 96: Line 96:
 The result of that assignment results in the following: The result of that assignment results in the following:
  
-{{ :haas:fall2017:data:projects:sln0-5.png |}}+{{ :haas:fall2016:data:projects:sln0-5.png |}}
  
 ===connecting a new node, which becomes the start=== ===connecting a new node, which becomes the start===
 What if we were to add a third node to our scenario (containing a 48): What if we were to add a third node to our scenario (containing a 48):
  
-{{ :haas:fall2017:data:projects:sln0-6.png |}}+{{ :haas:fall2016:data:projects:sln0-6.png |}}
  
 We have our existing two connected nodes, and our new node, currently identified by **tmp3**. We have our existing two connected nodes, and our new node, currently identified by **tmp3**.
Line 113: Line 113:
 </code> </code>
  
-{{ :haas:fall2017:data:projects:sln0-7.png |}}+{{ :haas:fall2016:data:projects:sln0-7.png |}}
  
 BUT: the intention of having **start** is to always have it pointing at the FIRST node in our list. So, as a result of that assignment, we need to re-assign start. BUT: the intention of having **start** is to always have it pointing at the FIRST node in our list. So, as a result of that assignment, we need to re-assign start.
Line 125: Line 125:
 That results in the following: That results in the following:
  
-{{ :haas:fall2017:data:projects:sln0-8.png |}}+{{ :haas:fall2016:data:projects:sln0-8.png |}}
  
 Note that, at any point, the tmp/tmp2/tmp3 variables can go away, yet we'd still have control over our nodes (via start): Note that, at any point, the tmp/tmp2/tmp3 variables can go away, yet we'd still have control over our nodes (via start):
Line 133: Line 133:
 </code> </code>
  
-{{ :haas:fall2017:data:projects:sln0-9.png |}}+{{ :haas:fall2016:data:projects:sln0-9.png |}}
  
 If it hasn't become obvious yet, drawing pictures like this (especially in a step-by-step manner) will be invaluable in aiding you through both debugging and solving these various tasks you'll face this semester. If it hasn't become obvious yet, drawing pictures like this (especially in a step-by-step manner) will be invaluable in aiding you through both debugging and solving these various tasks you'll face this semester.
Line 139: Line 139:
 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 **info** 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 **contents** 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).
haas/fall2017/data/projects/sln0.1503848109.txt.gz · Last modified: 2017/08/27 15:35 by wedge