Table of Contents

Portfolio

SLL

  1 #include <stdio.h>
  2 #include <stdlib.h>
  3
  4 typedef struct node Node;
  5
  6 struct node{
  7     int value;
  8     int place;
  9     struct node *next;
 10     struct node * *tmp3;
 11 };
 12
 13 Node *build(Node *start);
 14 Node *insert(Node*start, Node *given, Node *newNode);
 15 Node *append(Node *start, Node *given, Node *newNode);
 16 //Node *getNode(Node *start, Node **tmp3);
 17 Node *display(Node *start);
 18
 19 int main()
 20 {
 21     Node *start=NULL;
 22     int option;
 23
 24         while(option!=-1)
 25         {
 26             fprintf(stdout,"|===========Menu==========|\n");
 27             fprintf(stdout,"| 1.)Build List           |\n");
 28             fprintf(stdout,"| 2.)Insert to List       |\n");
 29             fprintf(stdout,"| 3.)Append to List       |\n");
 30             fprintf(stdout,"| 4.)Remove from List     |\n");
 31             fprintf(stdout,"| 5.)Display the List     |\n");
 32             fprintf(stdout,"| -1.)Quit                |\n");
 33             fprintf(stdout,"|=========================|\n");
 34             fprintf(stdout, "Please select an option: ");
 35             fscanf(stdin, "%d", &option);
 36
 37             if(option==1)
 38             {
 39                 start=build(start);
 40                 start=display(start);
 41             }
 42             else if(option==2)
 43             {
 44                 start=display(start);
 45                 Node *tmp, *tmp2=NULL;
 46                 int input=5;
 47                 fprintf(stdout,"Which node would you like to insert before?: ");
 48                 fscanf(stdin, "%d", &input);
 49                 int seeker;
 50                 tmp=start;
 51                 for(seeker=0; seeker<(input-1); seeker++)
 52                 {
 53                     tmp=tmp->next;
 54                 }
 55                 if(input==0)
 56                 {
 57                     fprintf(stdout,"Enter the value of the new node: ");
 58                     fscanf(stdin, "%d", &input);
 59                     tmp2=(Node*)malloc(sizeof(Node));
 60                     tmp2->value=input;
 61                     tmp->place=0;
 62                 }
 63                 else
 64                 {
 65                     fprintf(stdout, "Enter a value to insert: ");
 66                     fscanf(stdin, "%d", &input);
 67                     tmp2=(Node*)malloc(sizeof(Node));
 68                     tmp2->value=input;
 69                     tmp->place=1;
 70                 }
 71                 start=insert(start, tmp, tmp2);
 72                 start=display(start);
 73             }
 74             else if(option==3)
 75             {
 76                 start=display(start);
 77                 //assinging of values must occur before function execution
 78                 Node *tmp, *tmp4=NULL;
 79                 int input, choice;
 80                 int behind;
 81                 tmp=start;
 82                 fprintf(stdout,"Enter what node would you like to append after: ");
 83                 fscanf(stdin, "%d", &choice);
 84                 for(behind=0; behind<choice; behind++)
 85                 {
 86                     tmp=tmp->next;
 87                 }
 88                 //fprintf(stdout,"%d", behind); output tests
 89                 //start=display(tmp);           output tests
 90                 tmp4=(Node*)malloc(sizeof(Node));
 91                 tmp4->place=choice;
 92                 fprintf(stdout,"Enter value for node to be appended: ");
 93                 fscanf(stdin, "%d", &input);
 94                 tmp4->value=input;
 95
 96                 start=display(start);
 97                 start=append(start, tmp, tmp4);
 98                 start=display(start); //display acts as test to prove it worked
 99             }
100             else if(option==4)
101             {
102                 //assinging before functions required
103         /*
104                 start=display(start);
105                 Node *tmp;
106                 tmp=start;
107                 Node **tmp3;
108                 tmp3=&tmp;
109                 int begone, input;
110                 fprintf(stdout, "Which node would you like to remove?: ");
111                 fscanf(stdin, "%d" , &input);
112                 for(begone=0; begone<(input-1);begone++)
113                 {
114                     tmp=tmp->next;
115                 }
116                 if(input==0)
117                 {
118                     start->place=0;
119                 }
120                 else
121                 {
122                     start->place=1;
123                 }
124
125                 start=getNode(start, &tmp);
126                 start=display(start); //display aids in proving succes of function
127 */          }
128             else if(option==5)
129             {
130                 start=display(start);
131             }
132             else if (option=-1)
133             {
134                 fprintf(stdout, "Goodbye\n");
135             }
136             else
137             {
138                 fprintf(stdout, "ERROR, INVALID SELECTION\n");
139             }
140         }
141         return(0);
142 }
143
144
145
146 Node *build(Node *start)
147 {
148     int input=0;
149     Node *tmp;
150     start=tmp=NULL;
151
152     while(input!=-1)
153     {
154         fprintf(stdout, "Enter a value(-1 to end): ");
155         fscanf(stdin, "%d", &input);
156
157         if(input!=-1)
158         {
159             if(start==NULL)
160             {
161                 start=tmp=(Node*)malloc(sizeof(Node));
162                 tmp->next=NULL;
163                 start->value=input;
164             }
165             else
166             {
167                 tmp->next=(Node*)malloc(sizeof(Node));
168                 tmp->next->next=NULL;
169                 tmp->next->value=input;
170                 tmp=tmp->next;
171             }
172         }
173     }
174     tmp=start;
175
176     return(start);
177 }
178
179 Node *insert(Node *start, Node *tmp, Node *tmp2)
180 {
181     int placing;
182     placing=tmp->place;
183
184     if(placing==0)
185     {
186         tmp2->next=NULL;
187         tmp2->next=tmp;
188         start=tmp2;
189     }
190     else
191     {
192         tmp2->next=NULL;
193         tmp2->next=tmp->next;
194         tmp->next=tmp2;
195     }
196
197     tmp=start;
198     return(start);
199 }
200
201 Node *append(Node *start, Node *tmp, Node *tmp4)
202 {
203     tmp4->next=tmp->next;
204     tmp->next=tmp4;
205     tmp=start;
206
207     return(start);
208 }
209
210 /*
211 Node *getNode(Node *start, Node **tmp3)
212 {
213     Node *tmp2=NULL;
214     Node *tmp;
215     int placing;
216     placing=start->place;
217     tmp=start;
218
219     if(start->place==0)
220     {
221         tmp2=**tmp3;
222         tmp->next=NULL;
223         start=tmp2;
224     }
225
226     else
227     {
228         tmp2=**tmp3;
229         tmp->next=tmp2->next;
230         tmp2->next=NULL;
231     }
232
233     tmp=start;
234     return(start);
235 }
236 */
237
238 Node *display(Node *start)
239 {
240     int input=0;
241     Node *tmp;
242     tmp=start;
243
244     while(tmp!=NULL)
245     {
246         fprintf(stdout, "[%d] %d -> ", input, tmp->value);
247         tmp=tmp->next;
248         input=input++;
249     }
250     fprintf(stdout, "NULL\n");
251
252     return(start);
253 }
254

Above is my SLL project code, now perfect as the getNode function still has so double pointer recognition issues, will look online for material to reference.

March 12, 2014

After some outside help, I have fixed my SLL program to become SLL2, the getNode isn't perfect yet but I have gotten it to compile so after some pointer analyzing, everything should be working nicely.

SLL2.0

  1 #include <stdio.h>
  2 #include <stdlib.h>
  3
  4 typedef struct node Node;
  5
  6 struct node{
  7     int value;
  8     int place;
  9     struct node *next;
 10      11 };
 12
 13 Node *build(Node *start);
 14 Node *insert(Node*start, Node *given, Node *newNode);
 15 Node *append(Node *start, Node *given, Node *newNode);
 16 //Node *getNode(Node *start, Node **tmp3);
 17 Node *display(Node *start);
 18
 19 int main()
 20 {
 21     Node *start=NULL;
 22     int option;
 23
 24         while(option!=-1)
 25         {
 26             fprintf(stdout,"|===========Menu==========|\n");
 27             fprintf(stdout,"| 1.)Build List           |\n");
 28             fprintf(stdout,"| 2.)Insert to List       |\n");
 29             fprintf(stdout,"| 3.)Append to List       |\n");
 30             fprintf(stdout,"| 4.)Remove from List     |\n");
 31             fprintf(stdout,"| 5.)Display the List     |\n");
 32             fprintf(stdout,"| -1.)Quit                |\n");
 33             fprintf(stdout,"|=========================|\n");
 34             fprintf(stdout, "Please select an option: ");
 35             fscanf(stdin, "%d", &option);
 36
 37             if(option==1)
 38             {
 39                 start=build(start);
 40                 start=display(start);
 41             }
 42             else if(option==2)
 43             {
 44                 start=display(start);
 45                 Node *tmp, *tmp2=NULL;
 46                 int input=5;
 47                 fprintf(stdout,"Which node would you like to insert before?: ");
 48                 fscanf(stdin, "%d", &input);
 49                 int seeker;
 50                 tmp=start;
 51                 for(seeker=0; seeker<(input-1); seeker++)
 52                 {
 53                     tmp=tmp->next;
 54                 }
 55                 if(input==0)
 56                 {
 57                     fprintf(stdout,"Enter the value of the new node: ");
 58                     fscanf(stdin, "%d", &input);
 59                     tmp2=(Node*)malloc(sizeof(Node));
 60                     tmp2->value=input;
 61                     tmp->place=0;
 62                 }
 63                 else
 64                 {
 65                     fprintf(stdout, "Enter a value to insert: ");
 66                     fscanf(stdin, "%d", &input);
 67                     tmp2=(Node*)malloc(sizeof(Node));
 68                     tmp2->value=input;
 69                     tmp->place=1;
 70                 }
 71                 start=insert(start, tmp, tmp2);
 72                 start=display(start);
 73             }
 74             else if(option==3)
 75             {
 76                 start=display(start);
 77                 //Assinging of values must occur before function execution
 78                 Node *tmp, *tmp4=NULL;
 79                 int input, choice;
 80                 int behind;
 81                 tmp=start;
 82                 fprintf(stdout,"Enter what node would you like to append after: ");
 83                 fscanf(stdin, "%d", &choice);
 84                 for(behind=0; behind<choice; behind++)
 85                 {
 86                     tmp=tmp->next;
 87                 }
 88                 //fprintf(stdout,"%d", behind); output tests
 89                 //start=display(tmp);           output tests
 90                 tmp4=(Node*)malloc(sizeof(Node));
 91                 tmp4->place=choice;
 92                 fprintf(stdout,"Enter value for node to be appended: ");
 93                 fscanf(stdin, "%d", &input);
 94                 tmp4->value=input;
 95
 96                 start=display(start);
 97                 start=append(start, tmp, tmp4);
 98                 start=display(start); //display acts as test to prove it worked
 99             }
100             else if(option==4)
101             {
102                 //assinging before functions required
103         
104                 start=display(start);
105                 Node *tmp;
106                 tmp=start;
107                 Node **tmp3;
108                 tmp3=&tmp;
109                 int begone, input;
110                 fprintf(stdout, "Which node would you like to remove?: ");
111                 fscanf(stdin, "%d" , &input);
112                 for(begone=0; begone<(input-1);begone++)
113                 {
114                     tmp=tmp->next;
115                 }
116                 if(input==0)
117                 {
118                     start->place=0;
119                 }
120                 else
121                 {
122                     start->place=1;
123                 }
124
125                 start=getNode(start, (*tmp3));
126                 start=display(start); //display aids in proving succes of function
127         }
128             else if(option==5)
129             {
130                 start=display(start);
131             }
132             else if (option=-1)
133             {
134                 fprintf(stdout, "Goodbye\n");
135             }
136             else
137             {
138                 fprintf(stdout, "ERROR, INVALID SELECTION\n");
139             }
140         }
141         return(0);
142 }
143
144
145
146 Node *build(Node *start)
147 {
148     int input=0;
149     Node *tmp;
150     start=tmp=NULL;
151
152     while(input!=-1)
153     {
154         fprintf(stdout, "Enter a value(-1 to end): ");
155         fscanf(stdin, "%d", &input);
156
157         if(input!=-1)
158         {
159             if(start==NULL)
160             {
161                 start=tmp=(Node*)malloc(sizeof(Node));
162                 tmp->next=NULL;
163                 start->value=input;
164             }
165             else
166             {
167                 tmp->next=(Node*)malloc(sizeof(Node));
168                 tmp->next->next=NULL;
169                 tmp->next->value=input;
170                 tmp=tmp->next;
171             }
172         }
173     }
174     tmp=start;
175
176     return(start);
177 }
178
179 Node *insert(Node *start, Node *tmp, Node *tmp2)
180 {
181     int placing;
182     placing=tmp->place;
183
184     if(placing==0)
185     {
186         tmp2->next=NULL;
187         tmp2->next=tmp;
188         start=tmp2;
189     }
190     else
191     {
192         tmp2->next=NULL;
193         tmp2->next=tmp->next;
194         tmp->next=tmp2;
195     }
196
197     tmp=start;
198     return(start);
199 }
200
201 Node *append(Node *start, Node *tmp, Node *tmp4)
202 {
203     tmp4->next=tmp->next;
204     tmp->next=tmp4;
205     tmp=start;
206
207     return(start);
208 }
209
210 /*
211 Node *getNode(Node *start, Node (*tmp3))
212 {
213     Node *tmp2=NULL;
214     Node *tmp;
215     int placing;
216     placing=start->place;
217     tmp=start;
218
219     if(start==tmp3)
220     {
221         tmp2=tmp3;
222         tmp->next=NULL;
223         start=tmp2;
224     }
225
226     else
227     {
228         tmp2=tmp3;
229         tmp->next=tmp2->next;
230         tmp2->next=NULL;
231     }
232
233     tmp=start;
234     return(start);
235 }
236 */
237
238 Node *display(Node *start)
239 {
240     int input=0;
241     Node *tmp;
242     tmp=start;
243
244     while(tmp!=NULL)
245     {
246         fprintf(stdout, "[%d] %d -> ", input, tmp->value);
247         tmp=tmp->next;
248         input=input++;
249     }
250     fprintf(stdout, "NULL\n");
251
252     return(start);
253 }
254

The output of which, focused on the malfunctioning getNode function called 'remove' in menu listing:

lab46:~/src/DATA/spring2014$ ./SLL2
|===========Menu==========|
| 1.)Build List           |
| 2.)Insert to List       |
| 3.)Append to List       |
| 4.)Remove from List     |
| 5.)Display the List     |
| -1.)Quit                |
|=========================|
Please select an option: 1
Enter a value(-1 to end): 1
Enter a value(-1 to end): 2
Enter a value(-1 to end): 3
Enter a value(-1 to end): 4
Enter a value(-1 to end): 5
Enter a value(-1 to end): 6
Enter a value(-1 to end): 7
Enter a value(-1 to end): 8
Enter a value(-1 to end): 9
Enter a value(-1 to end): -1
[0] 1 -> [1] 2 -> [2] 3 -> [3] 4 -> [4] 5 -> [5] 6 -> [6] 7 -> [7] 8 -> [8] 9 -> NULL
|===========Menu==========|
| 1.)Build List           |
| 2.)Insert to List       |
| 3.)Append to List       |
| 4.)Remove from List     |
| 5.)Display the List     |
| -1.)Quit                |
|=========================|
Please select an option: 4
[0] 1 -> [1] 2 -> [2] 3 -> [3] 4 -> [4] 5 -> [5] 6 -> [6] 7 -> [7] 8 -> [8] 9 -> NULL
Which node would you like to remove?: 4
[0] 1 -> [1] 5 -> [2] 6 -> [3] 7 -> [4] 8 -> [5] 9 -> NULL
|===========Menu==========|
| 1.)Build List           |
| 2.)Insert to List       |
| 3.)Append to List       |
| 4.)Remove from List     |
| 5.)Display the List     |
| -1.)Quit                |
|=========================|
Please select an option: 4
[0] 1 -> [1] 5 -> [2] 6 -> [3] 7 -> [4] 8 -> [5] 9 -> NULL
Which node would you like to remove?: 5
[0] 1 -> [1] 9 -> NULL
|===========Menu==========|
| 1.)Build List           |
| 2.)Insert to List       |
| 3.)Append to List       |
| 4.)Remove from List     |
| 5.)Display the List     |
| -1.)Quit                |
|=========================|
Please select an option: -1
Goodbye

It seems that the input node to be removed becomes the start→next due to an error in my code, I will be looking on how to fix it.

March 14, 2013

I Finally got the damn thing working, so far behind schedule it's extremely upsetting but working all the same, the double pointers had me confused until the always benevolent teacher aided me with some advice.

SLL3
  1 /*
  2 Author:Kellen Hoose
  3 Created:February 2014
  4 Purpose:For the SLL_moar project for class, menu driven program with seperate functions call    ings and definitions, build, insert, append, remove, display, and quit as options.
  5 */
  6 #include <stdio.h>
  7 #include <stdlib.h>
  8
  9 typedef struct node Node;
 10
 11 struct node{
 12     int value;
 13     int place;
 14     struct node *next;
 15 };
 16
 17 Node *build(Node *start);
 18 Node *insert(Node*start, Node *given, Node *newNode);
 19 Node *append(Node *start, Node *given, Node *newNode);
 20 Node *getNode(Node *start, Node **tmp3);
 21 Node *display(Node *start);
 22
 23 int main()
 24 {
 25     Node *start=NULL;
 26     int option;
 27
 28         while(option!=-1)
 29         {
 30             fprintf(stdout,"|===========Menu==========|\n");
 31             fprintf(stdout,"| 1.)Build List           |\n");
 32             fprintf(stdout,"| 2.)Insert to List       |\n");
 33             fprintf(stdout,"| 3.)Append to List       |\n");
 34             fprintf(stdout,"| 4.)Remove from List     |\n");
 35             fprintf(stdout,"| 5.)Display the List     |\n");
 36             fprintf(stdout,"| -1.)Quit                |\n");
 37             fprintf(stdout,"|=========================|\n");
 38             fprintf(stdout, "Please select an option: ");
 39             fscanf(stdin, "%d", &option);
 40
 41             if(option==1)
 42             {
 43                 start=build(start);
 44                 start=display(start);
 45             }
 46             else if(option==2)
 47             {
 48                 start=display(start);
 49                 Node *tmp, *tmp2=NULL;
 50                 int input=5;
 51                 fprintf(stdout,"Which node would you like to insert before?: ");
 52                 fscanf(stdin, "%d", &input);
 53                 int seeker;
 54                 tmp=start;
 55                 for(seeker=0; seeker<(input-1); seeker++)
 56                 {
 57                     tmp=tmp->next;
 58                 }
 59                 if(input==0)
 60                 {
 61                     fprintf(stdout,"Enter the value of the new node: ");
 62                     fscanf(stdin, "%d", &input);
 63                     tmp2=(Node*)malloc(sizeof(Node));
 64                     tmp2->value=input;
 65                     tmp->place=0;
 66                 }
 67                 else
 68                 {
 69                     fprintf(stdout, "Enter a value to insert: ");
 70                     fscanf(stdin, "%d", &input);
 71                     tmp2=(Node*)malloc(sizeof(Node));
 72                     tmp2->value=input;
 73                     tmp->place=1;
 74                 }
 75                 start=insert(start, tmp, tmp2);
 76                 start=display(start);
 77             }
 78             else if(option==3)
 79             {
 80                 start=display(start);
 81                 //assinging of values must occur before function execution
 82                 Node *tmp, *tmp4=NULL;
 83                 int input, choice;
 84                 int behind;
 85                 tmp=start;
 86                 fprintf(stdout,"Enter what node would you like to append after: ");
 87                 fscanf(stdin, "%d", &choice);
 88                 for(behind=0; behind<choice; behind++)
 89                 {
 90                     tmp=tmp->next;
 91                 }
 92                 //fprintf(stdout,"%d", behind); output tests
 93                 //start=display(tmp);           output tests
 94                 tmp4=(Node*)malloc(sizeof(Node));
 95                 tmp4->place=choice;
 96                 fprintf(stdout,"Enter value for node to be appended: ");
 97                 fscanf(stdin, "%d", &input);
 98                 tmp4->value=input;
 99
100                 start=display(start);
101                 start=append(start, tmp, tmp4);
102                 start=display(start); //display acts as test to prove it worked
103             }
104             else if(option==4)
105             {
106                 //assinging before functions required
107
108                 start=display(start);
109                 Node *tmp;
110                 tmp=start;
111                 Node **tmp3;
112                 tmp3=&tmp;
113                 int begone, input;
114                 fprintf(stdout, "Which node would you like to remove?: ");
115                 fscanf(stdin, "%d" , &input);
116                 for(begone=0; begone<(input-1);begone++)
117                 {
118                     tmp=tmp->next;
119                 }
120
121             //  start=display(tmp); //maybe tmp isn't being assigned right?, sets tmp to one     before node to be removed.
122                 start=getNode(start, &tmp);
123                 start=display(start); //display aids in proving succes of function
124             }
125             else if(option==5)
126             {
127                 start=display(start);
128             }
129             else if (option=-1)
130             {
131                 fprintf(stdout, "Goodbye\n");
132             }
133             else
134             {
135                 fprintf(stdout, "ERROR, INVALID SELECTION\n");
136             }
137         }
138         return(0);
139 }
140
141
142
143 Node *build(Node *start)
144 {
145     int input=0;
146     Node *tmp;
147     start=tmp=NULL;
148
149     while(input!=-1)
150     {
151         fprintf(stdout, "Enter a value(-1 to end): ");
152         fscanf(stdin, "%d", &input);
153
154         if(input!=-1)
155         {
156             if(start==NULL)
157             {
158                 start=tmp=(Node*)malloc(sizeof(Node)); //creates node, allocate memory to si    ze of Node struct, thus saving space.
159                 tmp->next=NULL;
160                 start->value=input;
161             }
162             else
163             {
164                 tmp->next=(Node*)malloc(sizeof(Node));
165                 tmp->next->next=NULL;
166                 tmp->next->value=input;
167                 tmp=tmp->next;
168             }
169         }
170     }
171     tmp=start;
172
173     return(start);
174 }
175
176 Node *insert(Node *start, Node *tmp, Node *tmp2)
177 {
178     int placing;
179     placing=tmp->place;
180
181     if(placing==0)
182     {
183         tmp2->next=NULL;
184         tmp2->next=tmp;
185         start=tmp2;
186     }
187     else
188     {
189         tmp2->next=NULL;
190         tmp2->next=tmp->next;
191         tmp->next=tmp2;
192     }
193
194     tmp=start;
195     return(start);
196 }
197
198 Node *append(Node *start, Node *tmp, Node *tmp4)
199 {
200     tmp4->next=tmp->next;
201     tmp->next=tmp4;
202     tmp=start;
203
204     return(start);
205 }
206
207
208 Node *getNode(Node *start, Node **tmp3)
209 {
210     Node *tmp2=NULL;
211     Node *tmp4;
212     tmp4=*tmp3;//*tmp3=&tmp (address of tmp, which is 1 before node to be removed
213     tmp2=*tmp3;
214
215     if(start==*tmp3)
216     {
217         tmp4=tmp2->next; //if removing start, set start as 2nd from start, cut that thang of    f
218         tmp2->next=NULL;
219         start=tmp4;
220     }
221
222     else
223     {
224         tmp4=tmp2->next;
225         tmp2->next=tmp4->next;  // removing other than start, skip around node, cut it off
226         tmp4->next=NULL;
227     }
228
229     tmp4=start;
230     return(start);
231 }
232
233
234 Node *display(Node *start)
235 {
236     int input=0;
237     Node *tmp;
238     tmp=start;
239
240     while(tmp!=NULL)
241     {
242         fprintf(stdout, "[%d] %d -> ", input, tmp->value);
243         tmp=tmp->next;
244         input=input++;
245     }
246     fprintf(stdout, "NULL\n");
247
248     return(start);
249 }

This program results in the following operation/output:

Output
lab46:~/src/DATA/spring2014$ ./SLL3
|===========Menu==========|
| 1.)Build List           |
| 2.)Insert to List       |
| 3.)Append to List       |
| 4.)Remove from List     |
| 5.)Display the List     |
| -1.)Quit                |
|=========================|
Please select an option: 1
Enter a value(-1 to end): 1
Enter a value(-1 to end): 2
Enter a value(-1 to end): 3
Enter a value(-1 to end): 4
Enter a value(-1 to end): 5
Enter a value(-1 to end): 6
Enter a value(-1 to end): 7
Enter a value(-1 to end): 8
Enter a value(-1 to end): 9
Enter a value(-1 to end): -1
[0] 1 -> [1] 2 -> [2] 3 -> [3] 4 -> [4] 5 -> [5] 6 -> [6] 7 -> [7] 8 -> [8] 9 -> NULL
|===========Menu==========|
| 1.)Build List           |
| 2.)Insert to List       |
| 3.)Append to List       |
| 4.)Remove from List     |
| 5.)Display the List     |
| -1.)Quit                |
|=========================|
Please select an option: 2
[0] 1 -> [1] 2 -> [2] 3 -> [3] 4 -> [4] 5 -> [5] 6 -> [6] 7 -> [7] 8 -> [8] 9 -> NULL
Which node would you like to insert before?: 4
Enter a value to insert: 12
[0] 1 -> [1] 2 -> [2] 3 -> [3] 4 -> [4] 12 -> [5] 5 -> [6] 6 -> [7] 7 -> [8] 8 -> [9] 9 -> NULL
|===========Menu==========|
| 1.)Build List           |
| 2.)Insert to List       |
| 3.)Append to List       |
| 4.)Remove from List     |
| 5.)Display the List     |
| -1.)Quit                |
|=========================|
Please select an option: 3
[0] 1 -> [1] 2 -> [2] 3 -> [3] 4 -> [4] 12 -> [5] 5 -> [6] 6 -> [7] 7 -> [8] 8 -> [9] 9 -> NULL
Enter what node would you like to append after: 9
Enter value for node to be appended: 10
[0] 1 -> [1] 2 -> [2] 3 -> [3] 4 -> [4] 12 -> [5] 5 -> [6] 6 -> [7] 7 -> [8] 8 -> [9] 9 -> NULL
[0] 1 -> [1] 2 -> [2] 3 -> [3] 4 -> [4] 12 -> [5] 5 -> [6] 6 -> [7] 7 -> [8] 8 -> [9] 9 -> [10] 10 -> NULL
|===========Menu==========|
| 1.)Build List           |
| 2.)Insert to List       |
| 3.)Append to List       |
| 4.)Remove from List     |
| 5.)Display the List     |
| -1.)Quit                |
|=========================|
Please select an option: 4
[0] 1 -> [1] 2 -> [2] 3 -> [3] 4 -> [4] 12 -> [5] 5 -> [6] 6 -> [7] 7 -> [8] 8 -> [9] 9 -> [10] 10 -> NULL
Which node would you like to remove?: 4
[0] 1 -> [1] 2 -> [2] 3 -> [3] 4 -> [4] 5 -> [5] 6 -> [6] 7 -> [7] 8 -> [8] 9 -> [9] 10 -> NULL
|===========Menu==========|
| 1.)Build List           |
| 2.)Insert to List       |
| 3.)Append to List       |
| 4.)Remove from List     |
| 5.)Display the List     |
| -1.)Quit                |
|=========================|
Please select an option: 5
[0] 1 -> [1] 2 -> [2] 3 -> [3] 4 -> [4] 5 -> [5] 6 -> [6] 7 -> [7] 8 -> [8] 9 -> [9] 10 -> NULL
|===========Menu==========|
| 1.)Build List           |
| 2.)Insert to List       |
| 3.)Append to List       |
| 4.)Remove from List     |
| 5.)Display the List     |
| -1.)Quit                |
|=========================|
Please select an option: -1
Goodbye
lab46:~/src/DATA/spring2014$

cprog