Lab 12

Linked lists

In this lab, we will learn to create and manipulate linked lists using structs.

Consider the graph shown below

        

Fill in this form before check out with your TA.

Each node in the graph has 

1. a "data" field, holding a character

2. 4 pointers pointing to the nodes North, South, East and West of the node. For examples, the following are the values for 

the top most node.

data : w

North : NULL

South : Node with data 'r'

East : Node with data 'o'

West : Node with data 'k'

For the left most node, the following are the values

data : Node with data 'k'

North : Node with data 'w'

South : Node with data 's'

East : Node with data 'r'

West : NULL

The task for today's lab 

-----------------------------

1. (1 point ) : Complete the struct definition for a Node and create the 5 nodes

2. (1 point ) : Create the graph by populating the struct values ( data, North, South, East, West ) 

for each node.

3. (1 point ) : Complete the function printTraversalFromBottom to print the graph from the Bottom node (with data s)

Completing the program would give the following output.

Printing the list from Top

works

Printing the list from Bottom

skrow