Ejemplo n.º 1
0
from dynamicArray import DynamicArray
from FileIo import FileIo
from hashTable import HashTable

print("Hashing Function 2")
arr = DynamicArray()
F = FileIo(filename="Customer.csv")
table = HashTable(table=arr)
F.file_io_chaining2(table)
j = 0
print("%4s" % "No.", end=" ")
print("%17s" % "Customer Id", end=" ")
print("%14s" % "First Name", end="  ")
print("%9s" % "Last Name")
for i in range(len(table.table.array)):
    if table.table.array[i] is None:
        j += 1
    if table.table.array[i] is not None:
        linkedlist = table.get_hashed(i)
        a = "[" + str(linkedlist.key) + "]"
        print("%4s" % a, end=" ")
        print("%17s" % linkedlist.head.data.customer_id, end=" ")
        print("%14s" % linkedlist.head.data.first_name, end="  ")
        print("%9s" % linkedlist.head.data.last_name, end=" ")
        if table.table.array[i].GetLength() > 1:
            start = linkedlist.head.next
            while start is not None:
                print("%17s" % start.data.customer_id, end=" ")
                print("%14s" % start.data.first_name, end="  ")
                print("%9s" % start.data.last_name, end="  ")
                start = start.next
Ejemplo n.º 2
0
from FileIo import FileIo
from RadixSort import radix_sort_string

file = FileIo(filename="Strings.txt")
a = radix_sort_string(file.file_io_string(), file.max_string_length())
print("\nUnsorted array")
print(file.file_io_string())
print("Sorted array")
print(a)
Ejemplo n.º 3
0
from BinaryTree import BinaryTree
from FileIo import FileIo

f = FileIo(filename="Strings.txt")
arr = f.file_io_string()

b = BinaryTree()
for i in arr:
    b.insert(i)


root = b.root
arr = [root]
b.print(arr, 1)
Ejemplo n.º 4
0
from FileIo import FileIo
from RadixSort import radix_sort_int

file = FileIo(filename="Numbers.txt")
a = radix_sort_int(file.file_io_int(), file.max_int_lenght())
print("\nUnsorted array")
print(file.file_io_int())
print("Sorted array")
print(a)
Ejemplo n.º 5
0
from BinaryTree import BinaryTree
from FileIo import FileIo

f = FileIo(filename="Numbers.txt")
arr = f.file_io_int()

b = BinaryTree()
for i in arr:
    b.insert(i)

root = b.root
arr = [root]
b.print(arr, 1)