CIS 110 Spring 2013 - Introduction to Computer Programming

upenn.edu | directories | van pelt library
seas.upenn.edu | CETS | engineering library
computer graphics & game dev (SIGGRAPH @ Penn) | dining philosophers (DP) | science & tech wing (STWING) | women in cs (WICS)
CETS Answers

Recitation 9 Exercises

Goals

The goals of this week's recitation assignments are to learn about Circular Linked Lists and looping over them.

Exercise

  • Last week, you wrote a function to sum up the values in a linked list. This week, write a function that will sum up all the values in a circular linked list. Assume you have a Node class with two instance variables: int data and Node next. A parameter for this function will be a Node head which will represent the head of the Linked List. Remember: In a circular linked list, the last Node in the list points back to the first Node in the list.