Skip to content

Commit

Permalink
Your commit message
Browse files Browse the repository at this point in the history
  • Loading branch information
TheRogueDadBot committed Nov 23, 2023
0 parents commit 97ffbe2
Show file tree
Hide file tree
Showing 26 changed files with 609 additions and 0 deletions.
Binary file added .DS_Store
Binary file not shown.
6 changes: 6 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

77 changes: 77 additions & 0 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions C950.iml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$" />
<orderEntry type="jdk" jdkName="Python 3.12 (C950)" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
27 changes: 27 additions & 0 deletions CSV/Address.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
0,Western Governors University,4001 South 700 East
1,International Peace Gardens,1060 Dalton Ave S
2,Sugar House Park,1330 2100 S
3,Taylorsville-Bennion Heritage City Gov Off,1488 4800 S
4,Salt Lake City Division of Health Services,177 W Price Ave
5,South Salt Lake Public Works,195 W Oakland Ave
6,Salt Lake City Streets and Sanitation,2010 W 500 S
7,Deker Lake,2300 Parkway Blvd
8,Salt Lake City Ottinger Hall,233 Canyon Rd
9,Columbus Library,2530 S 500 E
10,Taylorsville City Hall,2600 Taylorsville Blvd
11,South Salt Lake Police,2835 Main St
12,Council Hall,300 State St
13,Redwood Park,3060 Lester St
14,Salt Lake County Mental Health,3148 S 1100 W
15,Salt Lake County United Police Dept,3365 S 900 W
16,West Valley Prosecutor,3575 W Valley Central Station bus Loop
17,Housing Auth. of Salt Lake County,3595 Main St
18,Utah DMV Administrative Office,380 W 2880 S
19,Third District Juvenile Court,410 S State St
20,Cottonwood Regional Softball Complex,4300 S 1300 E
21,Holiday City Office,4580 S 2300 E
22,Murray City Museum,5025 State St
23,Valley Regional Softball Complex,5100 South 2700 West
24,City Center of Rock Springs,5383 South 900 East #104
25,Rice Terrace Pavilion Park,600 E 900 South
26,Wheeler Historic Farm,6351 South 900 East
27 changes: 27 additions & 0 deletions CSV/Distance.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
0,,,,,,,,,,,,,,,,,,,,,,,,,,
7.2,0,,,,,,,,,,,,,,,,,,,,,,,,,
3.8,7.1,0,,,,,,,,,,,,,,,,,,,,,,,,
11,6.4,9.2,0,,,,,,,,,,,,,,,,,,,,,,,
2.2,6,4.4,5.6,0,,,,,,,,,,,,,,,,,,,,,,
3.5,4.8,2.8,6.9,1.9,0,,,,,,,,,,,,,,,,,,,,,
10.9,1.6,8.6,8.6,7.9,6.3,0,,,,,,,,,,,,,,,,,,,,
8.6,2.8,6.3,4,5.1,4.3,4,0,,,,,,,,,,,,,,,,,,,
7.6,4.8,5.3,11.1,7.5,4.5,4.2,7.7,0,,,,,,,,,,,,,,,,,,
2.8,6.3,1.6,7.3,2.6,1.5,8,9.3,4.8,0,,,,,,,,,,,,,,,,,
6.4,7.3,10.4,1,6.5,8.7,8.6,4.6,11.9,9.4,0,,,,,,,,,,,,,,,,
3.2,5.3,3,6.4,1.5,0.8,6.9,4.8,4.7,1.1,7.3,0,,,,,,,,,,,,,,,
7.6,4.8,5.3,11.1,7.5,4.5,4.2,7.7,0.6,5.1,12,4.7,0,,,,,,,,,,,,,,
5.2,3,6.5,3.9,3.2,3.9,4.2,1.6,7.6,4.6,4.9,3.5,7.3,0,,,,,,,,,,,,,
4.4,4.6,5.6,4.3,2.4,3,8,3.3,7.8,3.7,5.2,2.6,7.8,1.3,0,,,,,,,,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,0
40 changes: 40 additions & 0 deletions CSV/Package.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
1,195 W Oakland Ave,Salt Lake City,UT,84115,10:30 AM,21 Kilos,,,,,,
2,2530 S 500 E,Salt Lake City,UT,84106,EOD,44 Kilos,,,,,,
3,233 Canyon Rd,Salt Lake City,UT,84103,EOD,2 Kilos,'Can only be on truck 2',,,,,
4,380 W 2880 S,Salt Lake City,UT,84115,EOD,4 Kilos,,,,,,
5,410 S State St,Salt Lake City,UT,84111,EOD,5 Kilos,,,,,,
6,3060 Lester St,West Valley City,UT,84119,10:30 AM,88 Kilos,'Delayed on flight---will not arrive to depot until 9:05 am',,,,,
7,1330 2100 S,Salt Lake City,UT,84106,EOD,8 Kilos,,,,,,
8,300 State St,Salt Lake City,UT,84103,EOD,9 Kilos,,,,,,
9,300 State St,Salt Lake City,UT,84103,EOD,2 Kilos,'Wrong address listed',,,,,
10,600 E 900 South,Salt Lake City,UT,84105,EOD,1 Kilos,,,,,,
11,2600 Taylorsville Blvd,Salt Lake City,UT,84118,EOD,1 Kilos,,,,,,
12,3575 W Valley Central Station bus Loop,West Valley City,UT,84119,EOD,1 Kilos,,,,,,
13,2010 W 500 S,Salt Lake City,UT,84104,10:30 AM,2 Kilos,,,,,,
14,4300 S 1300 E,Millcreek,UT,84117,10:30 AM,88 Kilos,'Must be delivered with 15, 19',,,,,
15,4580 S 2300 E,Holladay,UT,84117,9:00 AM,4 Kilos,,,,,,
16,4580 S 2300 E,Holladay,UT,84117,10:30 AM,88 Kilos,'Must be delivered with 13, 19',,,,,
17,3148 S 1100 W,Salt Lake City,UT,84119,EOD,2 Kilos,,,,,,
18,1488 4800 S,Salt Lake City,UT,84123,EOD,6 Kilos,'Can only be on truck 2',,,,,
19,177 W Price Ave,Salt Lake City,UT,84115,EOD,37 Kilos,,,,,,3
20,3595 Main St,Salt Lake City,UT,84115,10:30 AM,37 Kilos,'Must be delivered with 13, 15',,,,,
21,3595 Main St,Salt Lake City,UT,84115,EOD,3 Kilos,,,,,,
22,6351 South 900 East,Murray,UT,84121,EOD,2 Kilos,,,,,,
23,5100 South 2700 West,Salt Lake City,UT,84118,EOD,5 Kilos,,,,,,
24,5025 State St,Murray,UT,84107,EOD,7 Kilos,,,,,,
25,5383 South 900 East #104,Salt Lake City,UT,84117,10:30 AM,7 Kilos,'Delayed on flight---will not arrive to depot until 9:05 am',,,,,
26,5383 South 900 East #104,Salt Lake City,UT,84117,EOD,25 Kilos,,,,,,
27,1060 Dalton Ave S,Salt Lake City,UT,84104,EOD,5 Kilos,,,,,,
28,2835 Main St,Salt Lake City,UT,84115,EOD,7 Kilos,'Delayed on flight---will not arrive to depot until 9:05 am',,,,,
29,1330 2100 S,Salt Lake City,UT,84106,10:30 AM,2 Kilos,,,,,,
30,300 State St,Salt Lake City,UT,84103,10:30 AM,1 Kilos,,,,,,
31,3365 S 900 W,Salt Lake City,UT,84119,10:30 AM,1 Kilos,,,,,,
32,3365 S 900 W,Salt Lake City,UT,84119,EOD,1 Kilos,'Delayed on flight---will not arrive to depot until 9:05 am',,,,,
33,2530 S 500 E,Salt Lake City,UT,84106,EOD,1 Kilos,,,,,,
34,4580 S 2300 E,Holladay,UT,84117,10:30 AM,2 Kilos,,,,,,
35,1060 Dalton Ave S,Salt Lake City,UT,84104,EOD,88 Kilos,,,,,,
36,2300 Parkway Blvd,West Valley City,UT,84119,EOD,88 Kilos,'Can only be on truck 2',,,,,
37,410 S State St,Salt Lake City,UT,84111,10:30 AM,2 Kilos,,,,,,
38,410 S State St,Salt Lake City,UT,84111,EOD,9 Kilos,'Can only be on truck 2',,,,,
39,2010 W 500 S,Salt Lake City,UT,84104,EOD,9 Kilos,,,,,,
40,380 W 2880 S,Salt Lake City,UT,84115,10:30 AM,45 Kilos,,,,,,
Empty file added CSV/__init__.py
Empty file.
Binary file added Documents/C950 Task 1 PDF 2.pdf
Binary file not shown.
Binary file added Documents/C950 Task 1 PDF.pdf
Binary file not shown.
Binary file added Documents/C950 Task 1.pages
Binary file not shown.
Binary file added Documents/Task 2 PDF 2.pdf
Binary file not shown.
Binary file added Documents/Task 2 PDF 3.pdf
Binary file not shown.
Binary file added Documents/Task 2 PDF 4.pdf
Binary file not shown.
Binary file added Documents/Task 2 PDF 5.pdf
Binary file not shown.
Binary file added Documents/Task 2 PDF.pdf
Binary file not shown.
Binary file added Documents/Task 2.pages
Binary file not shown.
56 changes: 56 additions & 0 deletions HashTable.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
class HashTableEntry:
"""Represents a single entry within a hash table, to be used when handling collisions."""
def __init__(self, key, value): # Constructor
self.key = key
self.value = value
self.next = None # Points to the next entry in case of a collision

class HashTable:
"""Creates a hash table to house hash table entries."""
def __init__(self): # Constructor
self.size = 40 # Fixed size for the table
self.table = [None] * self.size # Initialize table with empty buckets

def hash_function(self, key):
"""Computes the index for a key using the modulo operation."""
return hash(key) % self.size # Compute hash value.

def insert(self, key, value):
"""Inserts a key-value pair into the hash table."""
index = self.hash_function(key) # Use 'hash_function' with 'key' to compute index
entry = self.table[index] # Retrieve entry from hash table
if entry is None: # If bucket is empty
self.table[index] = HashTableEntry(key, value) # Create new 'HashTableEntry'
return
# Traverse the chain to find the right place to insert
while entry.next is not None: # When bucket is not empty, iterate through chain
if entry.key == key: # If enry with same key is found
entry.value = value # Update existing entry
return
entry = entry.next # Move to next entry in chain
entry.next = HashTableEntry(key, value) # Add new 'HashTableEntry' at end of chain

def lookup(self, key):
"""Looks up the value associated with a key in the hash table."""
index = self.hash_function(key) # Use 'hash_function' with 'key' to compute index
entry = self.table[index] # Retrieve entry from hash table
while entry is not None: # Iterate through chain as long as 'entry' is not 'None' in case of collision
if entry.key == key: # Check if entry's key matches lookup key
return entry.value # If match is found, return value
entry = entry.next # Move to next entry in chain
return None # Key not found

def delete(self, key):
"""Removes a key-value pair from the hash table."""
index = self.hash_function(key) # Use 'hash_function' with 'key' to compute index
entry = self.table[index] # Retrieve enry from hash table
prev = None # Initialize previous node to 'None'
while entry is not None: # Iterate through chain as long as 'entry' is not 'None'
if entry.key == key: # Check if entry's key matches lookup key
if prev is None: # If first in chain
self.table[index] = entry.next # Point to next node
else: # If not the first in chain
prev.next = entry.next # Skips over current 'entry'
return # Exits method
prev = entry # Set up for next iteration
entry = entry.next
Loading

0 comments on commit 97ffbe2

Please sign in to comment.