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;
  1. Given a singly-linked linear list, write a function to convert it to a circular list.
  2. Write a function to print out the information stored in a circular list.
  3. Write a function to count the nodes in a circular list.
  4. 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