Exercises
Circular Linked Lists
Directions: Use the type declarations at the right as you write
each of the following functions. Each function should contain
pre- and post-conditions and should work for empty lists, lists
containing only one node, and lists containing many nodes
struct node
{
int info;
node* next;
node(int D, node *N)
: info(D),next(N)
{ }
};
node* list;
- Given a singly-linked linear list, write a function to convert it to a circular list.
- Write a function to print out the information stored in a circular list.
- Write a function to count the nodes in a circular list.
- Given two circular lists A and B, write an O(1) function to join them into one circular list A, leaving the other list B empty.
Continue to: Unit 7 / Prev / Next