COSC 2436 - Programming Fundamentals III Data Structures
Bob Comer, Professor of Computer Studies


Example Programs
Chapter 6 - Lists

Following are some simple programs that build and process linked-lists. They are intended to be introductory examples.

 

Description

Program

This program uses a simple Node class to build a linked-list and then print the contents of the list.

llist1.cpp

Simple program to build a linked-list and then insert elements into the list. Changes from previous version:

  • add a function to print a list
  • add code to keep track of the list size (number of elements in the list)
  • add code to insert at various positions in the list

llist2.cpp

Usually new lists start off empty (contain no elements). This is indicated by a first pointer that is NULL.

llist3.cpp

 


Return to Programming Fundamentals II Home Page

Copyright: © 2015 by the Austin Community College
Department of Computer Studies. All rights reserved.
Comments to:
Bob Comer
Last updated: February 17, 2015