def main():

    myList = UnorderedList()

    for i in xrange(NUM):

        value = random.randint(1, 100)

        myList.add(value)

    print "\n\nPrinting in List...\n"
    myList.traversal()

    print "\n\nPrinting in Reverse...\n"
    printReverse(myList.head)

    return
예제 #2
0
'''
This is a short application of the use of the node class
Author: Marc Batete
'''
import random
from ListNode import Node
from unorderedList import UnorderedList

mylist = UnorderedList()

#value = raw_input(" enter a number: ")

while True:
    value = raw_input(" enter a number: ")

    if value == "":
        break
    else:
        mylist.add(value)

mylist.traversal()
예제 #3
0
myList = UnorderedList()

for i in xrange(NUM):

    value = random.randint(1, 100)
    #temp = Node(value)

    #print temp, temp.getData()

    myList.add(value)

#exit()

print myList.size()
myList.traversal()
myList.add(99)
myList.add(75)
myList.add(92)

print

myList.search(99)
myList.search(62)

myList.remove(70)
myList.traversal()

myList.remove(99)
myList.traversal()
예제 #4
0
'''
This is a program that Classifies Processor Jobs.
Description: This programs takes a list of CPU instructions and classifies them according to their lengths.
Author: Marc Batete
'''
import random
from ListNode import Node
from unorderedList import UnorderedList

fp = open("processor_jobs.dat", "r")
short_jobs = UnorderedList()
medium_jobs = UnorderedList()
long_jobs = UnorderedList()
while True:
    line = fp.readline()
    if line == "":
        break
    line = line.strip()
    word = line.split()

    value = word[0]
    if value < 200:
        short_jobs.add(value)
    elif value > 200 and value < 1000:
        medium_jobs.add(value)
    else:
        long_jobs.add(value)
short_jobs.traversal()
medium_jobs.traversal()
long_jobs.traversal()
예제 #5
0
import sys

from ListNode import Node
from unorderedList import UnorderedList

jobList= UnorderedList()

try:
	fp = open("processor_jobs.dat", "r")

except IOError:
	sys.exit("\n\n\nUnable to Open File!!!\n\n\n")

while True:
	line = fp.readline()
	if line == "":
		break
	
	line    = line.strip()
	field   = line.split()
	data	=float(field[0])

	jobList.add(data)

jobList.traversal()

print "Total execution Time is: ", jobList.Sum()