public SeLinkList() { prev = null; next = null; a = 0; b = 0; c = 0; index = indexCounter; indexCounter++; }
public SeLinkList(int _a, int _b, int _c) { next = null; prev = null; a = _a; b = _b; c = _c; index = indexCounter; indexCounter++; }
public void PrintList() { Console.WriteLine("Printing list::"); SeLinkList data = head; while (data != null) { data.print(); data = data.next; } }
public int findMinWeight() { int smallestWeight = Int32.MaxValue; SeLinkList lightest = null; SeLinkList current = head; while (current != null) { if (current.GetWeight() < smallestWeight) { smallestWeight = current.GetWeight(); lightest = current; } } Console.WriteLine("MIN: " + lightest.GetWeight()); return(lightest.GetWeight()); }
public int findMaxWeight() { int largerWeight = Int32.MinValue; SeLinkList heaviest = null; SeLinkList current = head; while (current != null) { if (current.GetWeight() > largerWeight) { largerWeight = current.GetWeight(); heaviest = current; } } Console.WriteLine("MAX:: " + heaviest.GetWeight()); return(heaviest.GetWeight()); }
//similar to the push method of a double linked list public void AddPlayer(int a, int b, int c) { SeLinkList newPlayer = new SeLinkList(a, b, c); if (head == null) { head = newPlayer; } else { SeLinkList current = head; while (current.next != null) { current = current.next; } current.next = newPlayer; newPlayer.prev = current; } numPlayers++; }
public Players() { numPlayers = 0; head = null; }