Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
File renamed without changes.
15 changes: 7 additions & 8 deletions Prac 7/DSAHashTable.py → DSAHashTable.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@ def __init__(self,tableSize):
self.hashArray[i] = DSAHashEntry()

def put(self,inKey, inValue):
inValue = self.createLocationInfo(inValue[0],inValue[1],inValue[2])
if isinstance(inValue,np.ndarray):
temp =inValue[0]
humid = inValue[1]
wind = inValue[2]
inValue = self.createLocationInfo(temp,humid,wind)
if self.getLoadFactor() >= 0.75:
self.resize(len(self.hashArray)*2)
hashInd = self.hash(inKey)
Expand Down Expand Up @@ -80,7 +84,7 @@ def get(self,inkey):
return self.hashArray[hashInd].getValue()
else:
return None

def remove(self,inKey):
hashInd = self.find(inKey)
if hashInd is not None:
Expand Down Expand Up @@ -121,7 +125,6 @@ def importFile(self):
with open("UAVdata.txt","r") as file:
for line in file:
line = line.strip()
print(line)

key = line[0]
values = np.array([int(v) for v in line[2:].split()])
Expand Down Expand Up @@ -213,8 +216,4 @@ def nextPrime(self,startVal):

#Option methods
def findKey(inKey):
pass




pass
9 changes: 7 additions & 2 deletions Prac 8/DSAHeap.py → DSAHeap.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def add(self,priority,value):
if not priority.isdigit():
raise AttributeError("Non integer value")
priority = int(priority)
if priority <= 0:
if priority < 0:
raise ValueError("Negative Value detected for priority")
if not value:
raise ValueError("Empty Value string detected")
Expand Down Expand Up @@ -63,7 +63,12 @@ def remove(self):
print("List empty: "+str(e))
else:
return temp '''


def isEmpty(self):
if self.count == 0:
return True
else:
return False

def display(self):
for item in self.heap:
Expand Down
File renamed without changes.
12 changes: 1 addition & 11 deletions Prac 6/GraphFileReader.py → GraphFileReader.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,4 @@ def readData():
except IOError as e:
print("Error in file processing: "+str(e))
else:
return graph

myGraph = readData()
myGraph.displayAsList()
#myGraph.displayAsMatrix()
#myGraph.breadFirstSearch()
#myGraph.deepFirstSearch()
print(myGraph.getEdge('A','B'))
print(myGraph.getEdge('C','B'))
myGraph.removeVertex('J')
myGraph.displayAsList()
return graph
File renamed without changes
30 changes: 24 additions & 6 deletions Prac 6/Graphy.py → Graphy.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from LinkedList import *
import numpy as np
from LinkedList import DSALinkedList
import StackAndQ as sq
import inSort

Expand Down Expand Up @@ -140,6 +141,16 @@ def displayAsList(self):
label = value.getLabel()
adList = value.getAdjacent()
print(label,":",adList)

def displayVertexes(self):
myIter = iter(self.vertices)
value = next(myIter)
for value in self.vertices:
if value is not None:
label = value.getLabel()
print(label)


def displayVisitStatus(self):
myIter = iter(self.vertices)
value = next(myIter)
Expand Down Expand Up @@ -238,12 +249,15 @@ def deepFirstSearch(self):
if AllVisited:
s.pop()

print("deep:")
while t.isEmpty() is not True:
print(t.dequeue().getLabel())
#print("deep:")
#while t.isEmpty() is not True:
# print(t.dequeue().getLabel())
return t

def UnVisit(self):
for vertex in self.vertices:
vertex.setVisited(False)
vertex.setPrevious(None)
#myIter = iter(self.vertices)
#value = next(myIter)
#for value in self.vertices:
Expand Down Expand Up @@ -409,6 +423,12 @@ def getNext(self):
def setNext(self,next):
self.next = next

def setDistance(self,distance):
self.distance = distance

def getDistance(self):
return self.distance

def __str__(self):
return f"Vertex {self.label} Links: {self.links}"

Expand All @@ -429,6 +449,4 @@ def getTo(self):
return self.tVertex

def __str__(self):
return f"From: {self.fVertex} To: {self.tVertex} Distance: {self.weight}"


return f"From: {self.fVertex} To: {self.tVertex} Distance: {self.weight}"
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file removed Prac 6/20230427_141258.jpg
Binary file not shown.
Binary file removed Prac 6/20230427_142739.jpg
Binary file not shown.
153 changes: 0 additions & 153 deletions Prac 6/Untitled Diagram.drawio

This file was deleted.

Binary file removed Prac 6/__pycache__/Graphy.cpython-36.pyc
Binary file not shown.
15 changes: 0 additions & 15 deletions Prac 6/location.txt

This file was deleted.

10 changes: 0 additions & 10 deletions Prac 6/prac6_1.al

This file was deleted.

14 changes: 0 additions & 14 deletions Prac 6/prac6_2.al

This file was deleted.

7 changes: 0 additions & 7 deletions Prac 7/HashIO.py

This file was deleted.

111 changes: 0 additions & 111 deletions Prac 7/HashTesting.py

This file was deleted.

Loading