コード例 #1
0
Author: Nicolas Mills
ID:     180856100
Email:  [email protected]
__updated__ = 2019-03-18
------------------------------------------------------------------------
"""
from Hash_Set_array import Hash_Set
from Movie_utilities import read_movies

NUM_SLOTS = 7

print("\nTesting Hash_Set#debug()")

print("\n\nEmpty Hash_Set")
hs = Hash_Set(NUM_SLOTS)
hs.debug()

print('\n\nNon-empty Hash_Set')
for i in [1, 2, 3, 4]:
    hs.insert(i)
hs.debug()

print("\n\nHash_Set with movies")
fh = open('movies.txt', 'r')
movies = read_movies(fh)

hs = Hash_Set(NUM_SLOTS)
for movie in movies:
    hs.insert(movie)

hs.debug()
コード例 #2
0
ファイル: t02.py プロジェクト: maxkdann/CP164
"""
-------------------------------------------------------
[program description]
-------------------------------------------------------
Author:  Max Dann
ID:      190274440
Email:   [email protected]
__updated__ = "2020-03-22"
-------------------------------------------------------
"""
from Hash_Set_array import Hash_Set
from Food_utilities import read_foods
fv = "foods.txt"
f = open(fv, "r", encoding="utf-8")
foods = read_foods(f)
h = Hash_Set(3)
l = [1, 2, 3, 4, 5, 4, 6, 7, 8, 9, 10]
for f in l:
    h.insert(f)
コード例 #3
0
"""
------------------------------------------------------------------------
Lab 9, Task 4 - Hash_Set#rehash()
------------------------------------------------------------------------
Author: Nicolas Mills
ID:     180856100
Email:  [email protected]
__updated__ = 2019-03-18
------------------------------------------------------------------------
"""
from Hash_Set_array import Hash_Set
from Movie_utilities import read_movies
from random import randint

hs = Hash_Set(1)
fh = open('movies.txt', 'r')
movies = read_movies(fh)
"""
for i in range(100):
    for movie in movies:
        hs.insert(movie)
"""
for i in range(50):
    value = randint(0, 1000)
    hs.insert(value)
print("Slots: {}\tCount: {}\tAvg: {}\tLoad Factor: {}".format(
    hs._slots, hs._count, hs._count // hs._slots, hs._LOAD_FACTOR))
hs.debug()
コード例 #4
0
"""
-------------------------------------------------------
[program description]
-------------------------------------------------------
Author:  Anshul Khatri
ID:      193313680
Email:   [email protected]
Section: CP164 Winter 2020
__updated__ = "2020-03-22"
-------------------------------------------------------
"""

from Hash_Set_array import Hash_Set
hash_set = Hash_Set(7)
hash_set.insert(12)
hash_set.insert(13)
hash_set.insert(14)
hash_set.insert(44)
hash_set.insert(15)

print("Hash set post inserting")
for i in hash_set:
    print(i)

hash_set.remove(33)
print()
print("Post removing")

for k in hash_set:
    print(k)
コード例 #5
0
ファイル: t03.py プロジェクト: khat3680/Data_Sturct_Python
"""
-------------------------------------------------------
[program description]
-------------------------------------------------------
Author:  Anshul Khatri
ID:      193313680
Email:   [email protected]
Section: CP164 Winter 2020
__updated__ = "2020-03-22"
-------------------------------------------------------
"""

from Hash_Set_array import Hash_Set

hash_set = Hash_Set(7)

hash_set.insert(111)
hash_set.insert(222)
hash_set.insert(332)
hash_set.insert(442)
hash_set.insert(552)

hash_set.debug()