Beispiel #1
0
#integer value generator
def value_gen(size=5, chars=string.digits):
	return (int)(''.join(random.choice(chars) for _ in range(5)))

#Initiatin two lists to store the keys and values
keyList = list()
valueList = list()

for i in range(800):
	keyList.append(key_gen())

for i in range(800):
	valueList.append(value_gen())

#Initiating the HashMap
IntegerHash = hashMap(870)

print "Printing size of IntegerHash"
print IntegerHash.getSize()
print ""
for i in range(800):
	IntegerHash.set(keyList[i],valueList[i])

print "Printing a value using the get function"
print IntegerHash.get(keyList[235])
print ""

print "Deleting a value using the delete function"
print IntegerHash.delete(keyList[235])
print ""
Beispiel #2
0
def value_gen(size=5, chars=string.ascii_lowercase):
    return ''.join(random.choice(chars) for _ in range(5))


#Initiatin two lists to store the keys and values
keyList = list()
valueList = list()

for i in range(800):
    keyList.append(key_gen())

for i in range(800):
    valueList.append(value_gen())

#Initiating the HashMap
StringHash = hashMap(870)

print "Printing size of StringHash"
print StringHash.getSize()
print ""
for i in range(800):
    StringHash.set(keyList[i], valueList[i])

print "Printing a value using the get function"
print StringHash.get(keyList[235])
print ""

print "Deleting a value using the delete function"
print StringHash.delete(keyList[235])
print ""
Beispiel #3
0
def value_gen(size=5, chars=string.digits):
    return (int)(''.join(random.choice(chars) for _ in range(5)))


#Initiatin two lists to store the keys and values
keyList = list()
valueList = list()

for i in range(800):
    keyList.append(key_gen())

for i in range(800):
    valueList.append(value_gen())

#Initiating the HashMap
IntegerHash = hashMap(870)

print "Printing size of IntegerHash"
print IntegerHash.getSize()
print ""
for i in range(800):
    IntegerHash.set(keyList[i], valueList[i])

print "Printing a value using the get function"
print IntegerHash.get(keyList[235])
print ""

print "Deleting a value using the delete function"
print IntegerHash.delete(keyList[235])
print ""
Beispiel #4
0
doubleList = list()

#key generation
for i in range(800):
    keyList.append(key_gen())

#value generation
for i in range(800):
    stringList.append(stringV_gen())
for i in range(800):
    intList.append(intV_gen())
for i in range(800):
    doubleList.append(doubleV_gen())

#Initiating the HashMap
MixHash = hashMap(870)

print "Printing size of MixHash"
print MixHash.getSize()
print ""

for i in range(225):
    MixHash.set(keyList[i], stringList[i])
for i in range(225, 450):
    MixHash.set(keyList[i], intList[i])
for i in range(450, 675):
    MixHash.set(keyList[i], doubleList[i])

print "Printing a value using the get function"
print MixHash.get(keyList[50])
print ""
Beispiel #5
0
def value_gen(size=5, chars=string.digits):
    return random.uniform(1.1, 2000.3454353453)


#Initiatin two lists to store the keys and values
keyList = list()
valueList = list()

for i in range(800):
    keyList.append(key_gen())

for i in range(800):
    valueList.append(value_gen())

#Initiating the HashMap
DoubleHash = hashMap(870)

print "Printing size of DoubleHash"
print DoubleHash.getSize()
print ""
for i in range(800):
    DoubleHash.set(keyList[i], valueList[i])

print "Printing a value using the get function"
print DoubleHash.get(keyList[80])
print ""

print "Deleting a value using the delete function"
print DoubleHash.delete(keyList[80])
print ""
Beispiel #6
0
#double value generator
def value_gen(size=5, chars=string.digits):
	return random.uniform(1.1,2000.3454353453)

#Initiatin two lists to store the keys and values
keyList = list()
valueList = list()

for i in range(800):
	keyList.append(key_gen())

for i in range(800):
	valueList.append(value_gen())

#Initiating the HashMap
DoubleHash = hashMap(870)

print "Printing size of DoubleHash"
print DoubleHash.getSize()
print ""
for i in range(800):
	DoubleHash.set(keyList[i],valueList[i])

print "Printing a value using the get function"
print DoubleHash.get(keyList[80])
print ""

print "Deleting a value using the delete function"
print DoubleHash.delete(keyList[80])
print ""
Beispiel #7
0
doubleList = list()

#key generation
for i in range(800):
	keyList.append(key_gen())

#value generation
for i in range(800):
	stringList.append(stringV_gen())
for i in range(800):
	intList.append(intV_gen())
for i in range(800):
	doubleList.append(doubleV_gen())

#Initiating the HashMap
MixHash = hashMap(870)

print "Printing size of MixHash"
print MixHash.getSize()
print ""

for i in range(225):
	MixHash.set(keyList[i],stringList[i])
for i in range(225,450):
	MixHash.set(keyList[i],intList[i])
for i in range(450,675):
	MixHash.set(keyList[i],doubleList[i])


print "Printing a value using the get function"
print MixHash.get(keyList[50])
Beispiel #8
0
#string value generator
def value_gen(size=5, chars=string.ascii_lowercase):
	return ''.join(random.choice(chars) for _ in range(5))

#Initiatin two lists to store the keys and values
keyList = list()
valueList = list()

for i in range(800):
	keyList.append(key_gen())

for i in range(800):
	valueList.append(value_gen())

#Initiating the HashMap
StringHash = hashMap(870)

print "Printing size of StringHash"
print StringHash.getSize()
print ""
for i in range(800):
	StringHash.set(keyList[i],valueList[i])

print "Printing a value using the get function"
print StringHash.get(keyList[235])
print ""

print "Deleting a value using the delete function"
print StringHash.delete(keyList[235])
print ""