User Tools

Site Tools


opus:spring2014:cgaines:journal

Data Structures Journal

Linked_list2

  1 #include<stdio.h>                                                          
  2 #include<stdlib.h>
  3
  4 struct node{
  5     int value;
  6     struct node *next;
  7     };
  8
  9 typedef struct node Node;
 10
 11 int main()
 12 {
 13     int input = 0;
 14     int seeker;
 15
 16     Node *list, *tmp, *tmp2;
 17
 18     list = tmp = tmp2 = NULL;
 19
 20     while( input != -1 )
 21     {
 22         printf("Enter a value (-1 to end): ");
 23         scanf("%d", &input);
 24        
 25         if( input != -1)
 26         {
 27             if( list == NULL )
 28             {
 29                 list = tmp = (Node*)malloc(sizeof(Node));
 30                 tmp->next = NULL;
 31                 list->value = input;
 32             }
 33             else
 34             {
 35                 tmp->next = (Node*)malloc(sizeof(Node));
 36                 tmp->next->next = NULL;
 37                 tmp->next->value = input;
 38                 tmp = tmp->next;
 39             }
 40         }
 41     }
 42
 43     tmp = list;
 44     input = 0;
 45
 46     while( tmp != NULL )
 47     {
 48         printf("[%d] %d\n", input, tmp->value);
 49         tmp = tmp->next;
 50         input++;                                                           
 51     }
 52
 53     printf("NULL\n");
 54
 55     //Insert into list
 56     printf("Which node would you like to insert before: ");
 57     scanf("%d", &input);
 58
 59     tmp = list;
 60     for( seeker = 0; seeker < (input-1); seeker++ )
 61         tmp = tmp->next;
 62     if( input==0)
 63     {
 64       printf("Enter value for new node:");
 65       scanf("%d", &input);
 66       tmp2 = (Node*)malloc(sizeof(Node));
 67       tmp2->value = input;
 68       tmp2->next = NULL;
 69       tmp2->next = tmp;
 70       list = tmp2;
 71     }
 72    
 73     else
 74     {
 75
 76       printf("Enter a value to insert: ");
 77       scanf("%d", &input);
 78
 79       tmp2 = (Node*)malloc(sizeof(Node));
 80       tmp2->value = input;
 81       tmp2->next = tmp->next;
 82       tmp->next = tmp2;
 83     }
 84
 85     tmp = list;
 86     input = 0;
 87
 88
 89     while( tmp != NULL )
 90     {                                                                      
 91         printf("[%d] %d\n", input, tmp->value);
 92         tmp = tmp->next;
 93         input++;
 94     }
 95
 96
 97
 98
 99     return(0);
100 }

SLL

Apr 30, 2014

Working on EoCE

HPC Experience ][ Journal

March 5, 2014

Learning to “dump” Backing up the router, to another system or something else. Level 0 sked at what time and what levels and when.

By the end of class we completed a full “dump” of the router to the home directory.

MONTH Day, YEAR

This is a sample format for a dated entry. Please substitute the actual date for “Month Day, Year”, and duplicate the level 4 heading to make additional entries.

As an aid, feel free to use the following questions to help you generate content for your entries:

  • What action or concept of significance, as related to the course, did you experience on this date?
  • Why was this significant?
  • What concepts are you dealing with that may not make perfect sense?
  • What challenges are you facing with respect to the course?

Apr 30, 2014

Working on EoCE.

HPC Systems and Networking Journal

March 5, 2014

Creating a script to run the “dump”

MONTH Day, YEAR

This is a sample format for a dated entry. Please substitute the actual date for “Month Day, Year”, and duplicate the level 4 heading to make additional entries.

As an aid, feel free to use the following questions to help you generate content for your entries:

  • What action or concept of significance, as related to the course, did you experience on this date?
  • Why was this significant?
  • What concepts are you dealing with that may not make perfect sense?
  • What challenges are you facing with respect to the course?

MONTH Day, YEAR

This is a sample format for a dated entry. Please substitute the actual date for “Month Day, Year”, and duplicate the level 4 heading to make additional entries.

As an aid, feel free to use the following questions to help you generate content for your entries:

  • What action or concept of significance, as related to the course, did you experience on this date?
  • Why was this significant?
  • What concepts are you dealing with that may not make perfect sense?
  • What challenges are you facing with respect to the course?

Apr 30, 2014

Working on EoCE.

opus/spring2014/cgaines/journal.txt · Last modified: 2014/05/02 19:57 by cgaines