
(10 pts) DSN (Linked Lists)
Spring 2023, Section A: Basic Data StructuresConsider using a linked list to store a string, where each node
, in order, stores one letter in the string. The struct used for a single node is included below. Write a function that takes in two pointers to linked lists storing 2 strings, and prints out the letters in the string in alternating order, starting with the first letter of the first string. If one string runs out of letters, just skip over it. For example, if the two strings passed to the function were "hello"
and "computer"
, then the function should print "hceolmlpouter"
.
typedef struct node {
char letter;
struct node* next;
} node;
void printMixed(node* word1, node* word2) { ... }
Official Grading Rubric:
1 pt - attempting to iterate through both lists.
1 pt - advancing a pointer through word1
1 pt - advancing a pointer through word2
2 pts - some sort of artifact to get alternating behavior
2 pts - printing each letter in each list (1 pt for each list)
3 pts - avoiding NULL pointer issues
It is likely that partial credit might be awarded for that last criteria of avoiding NULL pointer issues (ie in some places the solution avoids them, but not all). Partial credit can be awarded.
See the "Student's Solution" and "Submission Feedback" tabs

