This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
haas:fall2018:data:projects:sll0 [2017/09/04 19:56] – external edit 127.0.0.1 | haas:fall2018:data:projects:sll0 [2018/09/11 12:53] (current) – [Background] wedge | ||
---|---|---|---|
Line 3: | Line 3: | ||
< | < | ||
</ | </ | ||
- | |||
- | ~~TOC~~ | ||
======Project: | ======Project: | ||
Line 28: | Line 26: | ||
There are, however, many distinctions of linked lists... so we tend to add on a lot of qualifiers to better identify the particular type of linked list we are implementing/ | There are, however, many distinctions of linked lists... so we tend to add on a lot of qualifiers to better identify the particular type of linked list we are implementing/ | ||
- | As our nodes up to this point have only contained a single Node pointer for connection (the "to" pointer), we have what are called " | + | As our nodes up to this point have only contained a single Node pointer for connection (the "right" pointer), we have what are called " |
Therefore, generically, | Therefore, generically, | ||
Line 47: | Line 45: | ||
<code c> | <code c> | ||
struct list { | struct list { | ||
- | struct node *engine; | + | struct node *lead; |
- | struct node *caboose; | + | struct node *last; |
}; | }; | ||
</ | </ | ||
Line 68: | Line 66: | ||
Node *tmp = mknode(7); | Node *tmp = mknode(7); | ||
| | ||
- | myList = insert(myList, | + | myList = insert(myList, |
</ | </ | ||
- | And we can access the value contained in the list's initial node as follows: myList -> engine | + | And we can access the value contained in the list's initial node as follows: myList -> lead -> info |
We do need to be mindful of the organization we are creating- as part of implementing this, we'll have various list management functions at our disposal (insert, append, sort, getpos, obtain, etc.)... so we should restrict our list manipulation to those functions (reduce the number of cooks in the kitchen). This is another aspect of relinquishing our default tight fist of control... it may take some getting used to, but as you start seeing the bigger picture, you'll see what a big favor we're doing for ourselves here. | We do need to be mindful of the organization we are creating- as part of implementing this, we'll have various list management functions at our disposal (insert, append, sort, getpos, obtain, etc.)... so we should restrict our list manipulation to those functions (reduce the number of cooks in the kitchen). This is another aspect of relinquishing our default tight fist of control... it may take some getting used to, but as you start seeing the bigger picture, you'll see what a big favor we're doing for ourselves here. | ||
Line 290: | Line 288: | ||
struct list { | struct list { | ||
- | Node *engine; | + | Node *lead; |
- | Node *caboose; // pointer to end of list | + | Node *last; |
}; | }; | ||
typedef struct list List; // because we deserve nice things | typedef struct list List; // because we deserve nice things |