SelectionSort -...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: //******************************************************************** // SelectionSort.java Author: Lewis and Loftus // // Solution to Programming Project 12.3 // // Demonstrates the selection sort using a linked list //******************************************************************** public class SelectionSort { private SortNode list; //----------------------------------------------------------------- // Creates an initially empty linked list. //----------------------------------------------------------------- public SelectionSort() { list = null; } //----------------------------------------------------------------- // Adds an integer to the linked list //----------------------------------------------------------------- public void add(int value) { SortNode node = new SortNode(value); SortNode current = null; if (list == null) list = node; else { current = list; while (current.next != null) current = current.next; current.next = node; } } //-----------------------------------------------------------------...
View Full Document

Page1 / 2

SelectionSort -...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online