Corning Community College
Data Structures
Linked List Knowledge Assessment: From Pictures to Code
Open resource, closed person- do not communicate with anyone other than the instructor regarding material contained therein.
This is not take home- this is to be done during sanctioned times in the LAIR. If you do not finish, you may be able to resume work on following days (but note there may be additional content on following days).
There is the possibility of being asked to write code, debug, or draw diagrams– all related to content and concepts we have covered.
You may utilize the reference code (if needed) from the first part of the knowledge assessment, replicated here:
struct node { int value; struct node *next; struct node *prev; };
struct list { struct node *start; struct node *end; };
struct node *func1(int val) { int i = 0, old = 0; struct node *tmp, *tmp2; tmp = tmp2 = create(); tmp -> value = 1; for(i = 0; i < val; i++) { tmp2 -> next = create(); tmp2 -> next -> value = tmp2 -> value + old; old = tmp2 -> value; tmp2 = tmp2 -> next; } tmp2 -> next = tmp; return(tmp2 -> next); }
struct node *func2(int val) { int i = 0; struct node *tmp, *tmp2; tmp2 = create(); tmp = tmp2; tmp -> value = val; while (i < val) { tmp -> next = create(); tmp -> next -> value = i; tmp = tmp -> next; i++; } return(tmp2); }
struct node *func3() { struct node *tmp, *tmp2; tmp = tmp2 = create(); tmp2 -> next = create(); tmp -> next -> prev = tmp2; return(tmp); }
struct node *func4(struct node *tmp) { while (tmp -> next != NULL) { tmp = tmp -> next; } return(tmp); }
Your produced output from this activity will be logically accurate code (C, pseudo code, etc.) of various linked data structures.
As such, before leaving, please hand in any such papers– even if not done, for there may be additional opportunities to work on it in future days.