This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package edu.cmu.cs771.hw1; | |
| /** | |
| * This class implements a doubly linked list of characters in Java. | |
| * The instance variables head and tail are initially null. | |
| * As elements are added head points to the first element on the list and tail points to the last element. Each node on the list is of type DoubleNode. | |
| * Each DoubleNode holds a pointer to the previous node and a pointer to the next node in the list. | |
| * @author songluo | |
| * | |
| */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package edu.cmu.cs771.hw1; | |
| /** | |
| * The class DoubleNode holds two pointers and a character. It is used to represent a single node on a double linked list. | |
| * @author songluo | |
| * | |
| */ | |
| public class DoubleNode { | |
| private DoubleNode prev; | |
| private DoubleNode next; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import random | |
| import math | |
| import copy | |
| def euclid(a,b): | |
| '''returns the Greatest Common Divisor of a and b''' | |
| a = abs(a) | |
| b = abs(b) |
NewerOlder