User Tools

Site Tools


haas:spring2015: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:spring2015:data:projects:sln0 [2015/01/28 14:24] – [Removing a node] wedgehaas:spring2015:data:projects:sln0 [2015/01/29 00:19] (current) wedge
Line 40: Line 40:
 As such, if we were to have a solitary node containing a 17, and pointing at nothing (NULL), it could be drawn as follows: As such, if we were to have a solitary node containing a 17, and pointing at nothing (NULL), it could be drawn as follows:
  
-**PICTURE OF NODE**+{{ :haas:spring2015:data:projects:sln0-0.png |}}
  
 ===names and nodes=== ===names and nodes===
Line 52: Line 52:
 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.
  
-**PICTURE OF NAMED NODE**+{{ :haas:spring2015:data:projects:sln0-1.png |}}
  
 ===temporary node variables=== ===temporary node variables===
Line 62: Line 62:
 <code c> <code c>
 tmp = start; tmp = start;
-</code+</code>
  
 And that would produce the following result: And that would produce the following result:
  
-**IMAGE of node with tmp and start**+{{ :haas:spring2015: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 80: Line 80:
 That would leave us with the following image: That would leave us with the following image:
  
-**IMAGE of updated node**+{{ :haas:spring2015: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:
  
-**IMAGE of two nodes**+{{ :haas:spring2015: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 97: Line 97:
 The result of that assignment results in the following: The result of that assignment results in the following:
  
-**IMAGE of two connected nodes**+{{ :haas:spring2015: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):
  
-**IMAGE of our nodes**+{{ :haas:spring2015: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 114: Line 114:
 </code> </code>
  
-**IMAGE of result**+{{ :haas:spring2015: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 126: Line 126:
 That results in the following: That results in the following:
  
-**IMAGE of list of 3 nodes**+{{ :haas:spring2015: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 134: Line 134:
 </code> </code>
  
-**IMAGE of 3 nodes**+{{ :haas:spring2015: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 151: Line 151:
 The picture drawn should resemble: The picture drawn should resemble:
  
-**IMAGE**+{{ :haas:spring2015:data:projects:sln0-a.png |}}
  
 ====Copying a node==== ====Copying a node====
Line 164: Line 164:
 Which would give us: Which would give us:
  
-**IMAGE**+{{ :haas:spring2015:data:projects:sln0-b.png |}}
  
 Note that assigning a variable to an existing node is NOT the same as copying. If we were to say: Note that assigning a variable to an existing node is NOT the same as copying. If we were to say:
Line 174: Line 174:
 Does this create another copy? NO. It merely creates a scenario where two variables reference one node: Does this create another copy? NO. It merely creates a scenario where two variables reference one node:
  
-**IMAGE**+{{ :haas:spring2015:data:projects:sln0-c.png |}}
  
 ====Removing a node==== ====Removing a node====
Line 187: Line 187:
 The result will be this: The result will be this:
  
-**IMAGE**+{{ :haas:spring2015:data:projects:sln0-d.png |}}
  
 We can run into interesting situations when we remove a node that has multiple variables pointing at it. For instance-- tmp and tmp3. If we were to say: We can run into interesting situations when we remove a node that has multiple variables pointing at it. For instance-- tmp and tmp3. If we were to say:
Line 197: Line 197:
 We'd potentially end up with the following scenario: We'd potentially end up with the following scenario:
  
-**IMAGE**+{{ :haas:spring2015:data:projects:sln0-e.png |}}
  
 That's because when we de-allocate, it doesn't immediately go away, but is merely marked for removal. We should not rely on that data being there, even though it may still be accessible. That's because when we de-allocate, it doesn't immediately go away, but is merely marked for removal. We should not rely on that data being there, even though it may still be accessible.
Line 277: Line 277:
  
 ====Submit Tool Usage==== ====Submit Tool Usage====
-Let's say you have completed work on the project, and are ready to submit, you would do the following (assuming you have a program called arraylist.c):+Let's say you have completed work on the project, and are ready to submit, you would do the following (assuming you have a program called list.txt):
  
 <cli> <cli>
-lab46:~/src/data/sln0$ submit data sln0 arraylist.c+lab46:~/src/data/sln0$ submit data sln0 list.txt
 Submitting data project "sln0": Submitting data project "sln0":
-    -> arraylist.c(OK) +    -> list.txt(OK) 
  
 SUCCESSFULLY SUBMITTED SUCCESSFULLY SUBMITTED
haas/spring2015/data/projects/sln0.1422455090.txt.gz · Last modified: 2015/01/28 14:24 by wedge