SlideShare a Scribd company logo
1 of 31
3.4 Summary
This chapter included the system of the device and criteria,
where it includes the block diagram and its explanations, and its
main blocks that is used in this device, hardware requirements
and a small brief about it and how it’s used in the device, and
the flow chart of the device in its final phase with a miner
explanation on it.
5.1 Overview
The implementation phases of the given device started with
understanding the flow chart and block diagram that explains
the flow of the device working criteria as shown before in the
third chapter, then comes the software and hardware
implementation phases. Software implementation includes
drawing the circuit in the Proteus software and showing the
expected output from the hardware circuit. Moving on to the
hardware phase which will include the physical implementation
of the components of the device and how they are connected.
5.7 Summary
This chapter has explained the software system of the device
and its expected output, the hardware implementation of the
system with its explanations, and the testing process with its
result. The software implementation was done using Proteus
software, and Hardware implementation included connected the
components in the mentioned stages. Finally the testing was
done into three stages; testing of components, testing of
subsystem circuits, and testing of the device in its final stage
after finishing its implementation
6.1 Overview
This chapter includes the result obtained from testing the
system in different conditions and in many stages, and a
comparison between both hardware and software
implementation
6.5 Summary
Chapter 6 Results And Discussions
This chapter included the result obtained from testing the device
in different conditions and in many stages, and a comparison
between both hardware and software implementation.
Additionally, brief comparison between the experimental result
from this device and the output from other previous literature
device was mentioned.
54
ACKNOWLEDGEMENT
This project has helped me to expand my knowledge about clean
energy sources and how to use them since it has been an area of
interest for me since high school. It also helped me to relate
between this field and my specialization in telecommunications
engineering.
First of all, I would like to send my thanking prayers to Allah
the whole mighty, first and foremost for helping me to complete
this project successfully and within the needed time and
blessing my time and effort. Furthermore, I would like to
express my deepest appreciation to the project supervisor MR.
Athar aziz for his constant and ultimate help in support that
guided me to complete the project successfully. Last but not
least, special thanks to my family and friends whom I wouldn’t
complete my work professionally without their endless support
and prayers.
CS 222 01Programming Assignment 05 – Chapter 0520 Points
Due: Friday, December 7, 2018
In the hash table program example used in class, the hash table
size was chosen to be 47. If the table gets full, this needs to be
increased. Re-implement the put method so that the table will
automatically resize itself when the loading factor reaches a
predetermined value (you can decided the value based on your
assessment of load versus performance).
What will need to be done:
· Determine what you want to use as the loading factor
· Create a new hash table where the hash table size is the next a
prime number at least 25% larger than the current table size.
You will need to add code that will find the next prime number
· Re-hash all the current values in the hash table and put them
in the new hash table
· Clear the old hash table and copy all the new values from the
new hash table into the old hash table
Add the following comments to the beginning of the program.
Name: Your Name
Class and Section: CS 222 01
Assignment: Program Assignment 05
Due Date: See above
Date Turned in:
Program Description: You write a short description of
what the program will do
When you complete the program, do the following.
1. Create a folder with the following name:
ProgramAssignment05
2. Copy your program to this folder
3. Copy the folder to your folder in the I:koppinboxCS 222 01
folder
Chapter 05/binarySearch.py
def binarySearch(alist, item):
first = 0
last = len(alist) - 1
found = False
compare = 0
while first <= last and not found:
midpoint = (first + last) // 2
compare += 1
if alist[midpoint] == item:
found = True
else:
if item < alist[midpoint]:
last = midpoint - 1
else:
first = midpoint + 1
return found, compare
def main():
lyst = []
for x in range(1000000):
lyst.append(x)
found, compare = binarySearch(lyst, 1000001)
print("is number in list", found)
print("Comparisons", compare)
main()
Chapter 05/bubbleSort.py
import random
def bubbleSort(alist):
for passnum in range(len(alist) - 1, 0, -1):
for i in range(passnum):
if alist[i] > alist[i + 1]:
temp = alist[i]
alist[i] = alist[i + 1]
alist[i + 1] = temp
def printList(alist):
count = 0
for x in range(len(alist)):
if count % 10 == 0:
print()
print("%4d" % alist[x], end = " ")
count += 1
def main():
lyst = []
n = int(input("Enter number of values: "))
for i in range(n):
lyst.append(i)
random.shuffle(lyst)
#print("List before sort")
#printList(lyst)
#print("nnList after sort")
bubbleSort(lyst)
#printList(lyst)
main()
Chapter 05/hash.py
class HashTable:
def __init__(self):
self.size = 47
self.slots = [None] * self.size
self.data = [None] * self.size
def put(self, key, data):
hashValue = self.hashFunction(key, len(self.slots))
if self.slots[hashValue] == None:
self.slots[hashValue] = key
self.data[hashValue] = data
else:
if self.slots[hashValue] == key:
self.data[hashValue] = data # replace
else:
nextslot = self.rehash(hashValue, len(self.slots))
while self.slots[nextslot] != None and 
self.slots[nextslot] != key:
print("newslot", self.slots[nextslot])
nextslot = self.rehash(nextslot, len(self.slots))
if self.slots[nextslot] == None:
self.slots[nextslot] = key
self.data[nextslot] = data
else:
self.data[nextslot] = data # replace
def hashFunction(self, key, size):
return key % size
def rehash(self, oldhash, size):
return (oldhash + 1) % size
def get(self, key):
startslot = self.hashFunction(key, len(self.slots))
data = None
stop = False
found = False
position = startslot
while self.slots[position] != None and 
not found and not stop:
if self.slots[position] == key:
found = True
data = self.data[position]
else:
position = self.rehash(position, len(self.slots))
if position == startslot:
stop = True
return data
def __getitem__(self, key):
return self.get(key)
def __setitem__(self, key, data):
self.put(key, data)
def main():
H = HashTable()
H[54] = "cat"
H[26] = "dog"
H[93] = "lion"
H[17] = "tiger"
H[31] = "bird"
H[44] = "cow"
H[55] = "pig"
H[20] = "chicken"
print("After adding 8 items")
print(H.slots)
print("Hash 20:", H[20])
print("Hash 17:", H[17])
H[101] = "penguin"
H[20] = "duck"
print("Change Hash 20 from chicken to duck:", H[20])
print("Hash data")
print(H.data)
main()
Chapter 05/insertion.py
import random
def insertionSort(alist):
for index in range(1, len(alist)):
currentvalue = alist[index]
position = index
while position > 0 and alist[position - 1] > currentvalue:
alist[position] = alist[position - 1]
position -= 1
alist[position] = currentvalue
def main():
lyst = []
n = int(input("Enter number of values: "))
for i in range(n):
num = random.randint(1, n * 10)
while num in lyst:
num = random.randint(1, n * 10)
lyst.append(num)
print("Ready to Sort")
insertionSort(lyst)
count = 0
for i in range(len(lyst)):
if count % 10 == 0:
print()
count = 0
print(lyst[i], end = " ")
count += 1
main()
Chapter 05/mergeSort.py
import random
def mergeSort(alist):
if len(alist) > 1:
mid = len(alist) // 2
lefthalf = alist[:mid]
righthalf = alist[mid:]
mergeSort(lefthalf)
mergeSort(righthalf)
i = 0
j = 0
k = 0
while i < len(lefthalf) and j < len(righthalf):
if lefthalf[i] < righthalf[j]:
alist[k] = lefthalf[i]
i = i + 1
else:
alist[k] = righthalf[j]
j = j + 1
k = k + 1
while i < len(lefthalf):
alist[k] = lefthalf[i]
i = i + 1
k = k + 1
while j < len(righthalf):
alist[k] = righthalf[j]
j = j + 1
k = k + 1
def printList(alist):
count = 0
for x in range(len(alist)):
if count % 10 == 0:
print()
print("%4d" % alist[x], end = " ")
count += 1
def main():
lyst = []
n = int(input("Enter number of values: "))
for i in range(n):
lyst.append(i)
random.shuffle(lyst)
#print("List before sort")
#printList(lyst)
#print("Ready to Sort")
mergeSort(lyst)
printList(lyst)
main()
Chapter 05/quickSort.py
import random
def quickSort(alist):
quickSortHelper(alist, 0, len(alist) - 1)
def quickSortHelper(alist, first, last):
if first < last:
splitpoint = partition(alist, first, last)
quickSortHelper(alist, first, splitpoint - 1)
quickSortHelper(alist, splitpoint + 1, last)
def partition(alist, first, last):
pivotvalue = alist[first]
leftmark = first + 1
rightmark = last
done = False
while not done:
while leftmark <= rightmark and 
alist[leftmark] <= pivotvalue:
leftmark = leftmark + 1
while alist[rightmark] >= pivotvalue and 
rightmark >= leftmark:
rightmark = rightmark - 1
if rightmark < leftmark:
done = True
else:
temp = alist[leftmark]
alist[leftmark] = alist[rightmark]
alist[rightmark] = temp
temp = alist[first]
alist[first] = alist[rightmark]
alist[rightmark] = temp
return rightmark
def printList(alist):
count = 0
for x in range(len(alist)):
if count % 10 == 0:
print()
print("%4d" % alist[x], end = " ")
count += 1
def main():
lyst = []
n = int(input("Enter number of values: "))
for i in range(n):
lyst.append(i)
random.shuffle(lyst)
#printList(lyst)
#print("Ready to Sort")
quickSort(lyst)
printList(lyst)
main()
Chapter 05/RecursiveBinarySearch.py
def binarySearch(alist, item, compare):
if len(alist) == 0:
return compare, False
else:
midpoint = len(alist) // 2
compare += 1
if alist[midpoint] == item:
return compare, True
else:
if item < alist[midpoint]:
return compare, binarySearch(alist[:midpoint], item,
compare)
else:
return compare, binarySearch(alist[midpoint+1:],
item, compare)
def main():
lyst = []
compare = 0
for x in range(100):
lyst.append(x)
compare, found = binarySearch(lyst, 54, compare)
print("is number in list", found)
print("Comparisons", compare)
main()
Chapter 05/selectionSort.py
import random
def insertionSort(alist):
for index in range(1, len(alist)):
currentValue = alist[index]
position = index
while position > 0 and alist[position - 1] > currentValue:
alist[position] = alist[position - 1]
position -= 1
alist[position] = currentValue
def printList(alist):
count = 0
for x in range(len(alist)):
if count % 10 == 0:
print()
print("%4d" % alist[x], end = " ")
count += 1
def main():
lyst = []
n = int(input("Enter number of values: "))
for i in range(n):
lyst.append(i)
random.shuffle(lyst)
#print("List before sort")
#printList(lyst)
#print("nnList after sort")
insertionSort(lyst)
#printList(lyst)
main()
Chapter 05/sequentialSearch.py
import random
import time
def sequentialSearch(alist, item):
pos = 0
found = False
compare = 0
while pos < len(alist) and not found:
compare += 1
if alist[pos] == item:
found = True
else:
pos += 1
print(pos, alist[pos])
return found, compare
def main():
lyst = []
num = int(input("How many? "))
look = int(input("What number are you looking for? "))
for x in range(num):
lyst.append(x)
random.shuffle(lyst)
#random.shuffle(lyst)
start = time.time()
found, compare = sequentialSearch(lyst, look)
#print("is number in list", found)
end = time.time()
print("Comparisons:", compare)
print("Time:", end - start)
main()
Chapter 05/shellSort.py
import random
def shellSort(alist):
sublistCount = len(alist) // 2
while sublistCount > 0:
for startPosition in range(sublistCount):
gapInsertionSort(alist, startPosition, sublistCount)
sublistCount = sublistCount // 2
def gapInsertionSort(alist, start, gap):
for i in range(start + gap, len(alist), gap):
currentValue = alist[i]
position = i
while position >= gap and 
alist[position - gap] > currentValue:
alist[position] = alist[position - gap]
position = position - gap
alist[position] = currentValue
def printList(alist):
count = 0
for x in range(len(alist)):
if count % 10 == 0:
print()
print("%4d" % alist[x], end = " ")
count += 1
def main():
lyst = []
n = int(input("Enter number of values: "))
for i in range(n):
lyst.append(i)
random.shuffle(lyst)
#print("List before sort")
#printList(lyst)
#print("nnList after sort")
shellSort(lyst)
#printList(lyst)
main()
Chapter 05/shortBubbleSort.py
import random
def bubbleSort(alist):
exchanges = True
passnum = len(alist) - 1
while passnum > 0 and exchanges:
exchanges = False
for i in range(passnum):
if alist[i] > alist[i + 1]:
exchanges = True
temp = alist[i]
alist[i] = alist[i + 1]
alist[i + 1] = temp
passnum -= 1
def printList(alist):
count = 0
for x in range(len(alist)):
if count % 10 == 0:
print()
print("%4d" % alist[x], end = " ")
count += 1
def main():
lyst = []
n = int(input("Enter number of values: "))
for i in range(n):
lyst.append(i)
#random.shuffle(lyst)
#print("List before sort")
#printList(lyst)
#print("nnList after sort")
bubbleSort(lyst)
#printList(lyst)
main()
Chapter 05/sortingTest.py
import random
import time
def shellSort(alist):
sublistCount = len(alist) // 2
while sublistCount > 0:
for startPosition in range(sublistCount):
gapInsertionSort(alist, startPosition, sublistCount)
#print("After increment of size", sublistCount, "the list
is")
#printList(alist)
sublistCount = sublistCount // 2
def gapInsertionSort(alist, start, gap):
for i in range(start + gap, len(alist), gap):
currentValue = alist[i]
position = i
while position >= gap and
alist[position - gap] > currentValue:
alist[position] = alist[position - gap]
position = position - gap
alist[position] = currentValue
def main():
lyst = []
for x in range(1000000):
lyst.append(x)
random.shuffle(lyst)
start = time.time()
lyst.sort()
end = time.time()
print("Time:", end - start)
start = time.time()
shellSort(lyst)
end = time.time()
print("Shell Time:", end - start)
main()

More Related Content

Similar to 3.4 Summary This chapter included the system of the device and c.docx

Lec 1 Ds
Lec 1 DsLec 1 Ds
Lec 1 DsQundeel
 
The LaTeX Workshop: Document design in LaTeX: Invocation
The LaTeX Workshop: Document design in LaTeX: InvocationThe LaTeX Workshop: Document design in LaTeX: Invocation
The LaTeX Workshop: Document design in LaTeX: InvocationSuddhasheel GHOSH, PhD
 
Anything but simple Mathematica
Anything but simple MathematicaAnything but simple Mathematica
Anything but simple MathematicaSergeiPronkevich
 
project 1Assignment 1.pdf .docx
project 1Assignment 1.pdf                                .docxproject 1Assignment 1.pdf                                .docx
project 1Assignment 1.pdf .docxwkyra78
 
INFORMATIVE ESSAYThe purpose of the Informative Essay assignme.docx
INFORMATIVE ESSAYThe purpose of the Informative Essay assignme.docxINFORMATIVE ESSAYThe purpose of the Informative Essay assignme.docx
INFORMATIVE ESSAYThe purpose of the Informative Essay assignme.docxcarliotwaycave
 
Due November 22 2021 This assignment is worth 20 of your .pdf
Due November 22 2021 This assignment is worth 20 of your .pdfDue November 22 2021 This assignment is worth 20 of your .pdf
Due November 22 2021 This assignment is worth 20 of your .pdfabibagschennai
 
Data structures cs301 power point slides lecture 01
Data structures   cs301 power point slides lecture 01Data structures   cs301 power point slides lecture 01
Data structures cs301 power point slides lecture 01shaziabibi5
 
As Level Computer Science Book -2
As Level Computer Science  Book -2As Level Computer Science  Book -2
As Level Computer Science Book -2DIGDARSHAN KUNWAR
 
EN1320 Module 2 Lab 2.1Capturing the Reader’s InterestSelec.docx
EN1320 Module 2 Lab 2.1Capturing the Reader’s InterestSelec.docxEN1320 Module 2 Lab 2.1Capturing the Reader’s InterestSelec.docx
EN1320 Module 2 Lab 2.1Capturing the Reader’s InterestSelec.docxYASHU40
 
Headache from using mathematical software
Headache from using mathematical softwareHeadache from using mathematical software
Headache from using mathematical softwarePVS-Studio
 
Python lab manual all the experiments are available
Python lab manual all the experiments are availablePython lab manual all the experiments are available
Python lab manual all the experiments are availableNitesh Dubey
 

Similar to 3.4 Summary This chapter included the system of the device and c.docx (20)

Lec 1 Ds
Lec 1 DsLec 1 Ds
Lec 1 Ds
 
The LaTeX Workshop: Document design in LaTeX: Invocation
The LaTeX Workshop: Document design in LaTeX: InvocationThe LaTeX Workshop: Document design in LaTeX: Invocation
The LaTeX Workshop: Document design in LaTeX: Invocation
 
Anything but simple Mathematica
Anything but simple MathematicaAnything but simple Mathematica
Anything but simple Mathematica
 
project 1Assignment 1.pdf .docx
project 1Assignment 1.pdf                                .docxproject 1Assignment 1.pdf                                .docx
project 1Assignment 1.pdf .docx
 
Dfd2
Dfd2Dfd2
Dfd2
 
INFORMATIVE ESSAYThe purpose of the Informative Essay assignme.docx
INFORMATIVE ESSAYThe purpose of the Informative Essay assignme.docxINFORMATIVE ESSAYThe purpose of the Informative Essay assignme.docx
INFORMATIVE ESSAYThe purpose of the Informative Essay assignme.docx
 
Due November 22 2021 This assignment is worth 20 of your .pdf
Due November 22 2021 This assignment is worth 20 of your .pdfDue November 22 2021 This assignment is worth 20 of your .pdf
Due November 22 2021 This assignment is worth 20 of your .pdf
 
Data structures cs301 power point slides lecture 01
Data structures   cs301 power point slides lecture 01Data structures   cs301 power point slides lecture 01
Data structures cs301 power point slides lecture 01
 
As Level Computer Science Book -2
As Level Computer Science  Book -2As Level Computer Science  Book -2
As Level Computer Science Book -2
 
chapt02 (1).ppt
chapt02 (1).pptchapt02 (1).ppt
chapt02 (1).ppt
 
chapt02.ppt
chapt02.pptchapt02.ppt
chapt02.ppt
 
C++chapt002a.ppt
C++chapt002a.pptC++chapt002a.ppt
C++chapt002a.ppt
 
cht02.ppt
cht02.pptcht02.ppt
cht02.ppt
 
chapt02.ppt
chapt02.pptchapt02.ppt
chapt02.ppt
 
EN1320 Module 2 Lab 2.1Capturing the Reader’s InterestSelec.docx
EN1320 Module 2 Lab 2.1Capturing the Reader’s InterestSelec.docxEN1320 Module 2 Lab 2.1Capturing the Reader’s InterestSelec.docx
EN1320 Module 2 Lab 2.1Capturing the Reader’s InterestSelec.docx
 
Programming Assignment Help
Programming Assignment HelpProgramming Assignment Help
Programming Assignment Help
 
Feature Engineering in NLP.pdf
Feature Engineering in NLP.pdfFeature Engineering in NLP.pdf
Feature Engineering in NLP.pdf
 
Headache from using mathematical software
Headache from using mathematical softwareHeadache from using mathematical software
Headache from using mathematical software
 
Computer project
Computer projectComputer project
Computer project
 
Python lab manual all the experiments are available
Python lab manual all the experiments are availablePython lab manual all the experiments are available
Python lab manual all the experiments are available
 

More from rhetttrevannion

Discuss three (3) ways that large organizations are increasingly eng.docx
Discuss three (3) ways that large organizations are increasingly eng.docxDiscuss three (3) ways that large organizations are increasingly eng.docx
Discuss three (3) ways that large organizations are increasingly eng.docxrhetttrevannion
 
Discuss this week’s objectives with your team sharing related rese.docx
Discuss this week’s objectives with your team sharing related rese.docxDiscuss this week’s objectives with your team sharing related rese.docx
Discuss this week’s objectives with your team sharing related rese.docxrhetttrevannion
 
Discuss theoretical considerations or assumptions relevant to yo.docx
Discuss theoretical considerations or assumptions relevant to yo.docxDiscuss theoretical considerations or assumptions relevant to yo.docx
Discuss theoretical considerations or assumptions relevant to yo.docxrhetttrevannion
 
Discuss theprinciple events of PROCESS AND THREAD used in both t.docx
Discuss theprinciple events of PROCESS AND THREAD used in both t.docxDiscuss theprinciple events of PROCESS AND THREAD used in both t.docx
Discuss theprinciple events of PROCESS AND THREAD used in both t.docxrhetttrevannion
 
Discuss the Windows Registry System Hive1) What information.docx
Discuss the Windows Registry System Hive1) What information.docxDiscuss the Windows Registry System Hive1) What information.docx
Discuss the Windows Registry System Hive1) What information.docxrhetttrevannion
 
Discuss the way the idea of heroism develops from Gilgamesh th.docx
Discuss the way the idea of heroism develops from Gilgamesh th.docxDiscuss the way the idea of heroism develops from Gilgamesh th.docx
Discuss the way the idea of heroism develops from Gilgamesh th.docxrhetttrevannion
 
Discuss the ways in which the history of the U.S. was presented in t.docx
Discuss the ways in which the history of the U.S. was presented in t.docxDiscuss the ways in which the history of the U.S. was presented in t.docx
Discuss the ways in which the history of the U.S. was presented in t.docxrhetttrevannion
 
Discuss the value of Lean Systems Engineering to systems develop.docx
Discuss the value of Lean Systems Engineering to systems develop.docxDiscuss the value of Lean Systems Engineering to systems develop.docx
Discuss the value of Lean Systems Engineering to systems develop.docxrhetttrevannion
 
discuss the various pathways interest groups use to influence politi.docx
discuss the various pathways interest groups use to influence politi.docxdiscuss the various pathways interest groups use to influence politi.docx
discuss the various pathways interest groups use to influence politi.docxrhetttrevannion
 
Discuss the various tools and techniques used by an HCO to incre.docx
Discuss the various tools and techniques used by an HCO to incre.docxDiscuss the various tools and techniques used by an HCO to incre.docx
Discuss the various tools and techniques used by an HCO to incre.docxrhetttrevannion
 
Discuss the various means by which slaves resisted the slave system..docx
Discuss the various means by which slaves resisted the slave system..docxDiscuss the various means by which slaves resisted the slave system..docx
Discuss the various means by which slaves resisted the slave system..docxrhetttrevannion
 
Discuss the typica l clinical presentation of the diagnosis , Hip Os.docx
Discuss the typica l clinical presentation of the diagnosis , Hip Os.docxDiscuss the typica l clinical presentation of the diagnosis , Hip Os.docx
Discuss the typica l clinical presentation of the diagnosis , Hip Os.docxrhetttrevannion
 
Discuss the types of resources, tools, and methods that are availabl.docx
Discuss the types of resources, tools, and methods that are availabl.docxDiscuss the types of resources, tools, and methods that are availabl.docx
Discuss the types of resources, tools, and methods that are availabl.docxrhetttrevannion
 
Discuss the types of items that should be examined in a firewall log.docx
Discuss the types of items that should be examined in a firewall log.docxDiscuss the types of items that should be examined in a firewall log.docx
Discuss the types of items that should be examined in a firewall log.docxrhetttrevannion
 
Discuss the types of property, providing an example of each an.docx
Discuss the types of property, providing an example of each an.docxDiscuss the types of property, providing an example of each an.docx
Discuss the types of property, providing an example of each an.docxrhetttrevannion
 
Discuss the type of personality it takes to become a police officer..docx
Discuss the type of personality it takes to become a police officer..docxDiscuss the type of personality it takes to become a police officer..docx
Discuss the type of personality it takes to become a police officer..docxrhetttrevannion
 
Discuss the two major sources of crime statistics for the United Sta.docx
Discuss the two major sources of crime statistics for the United Sta.docxDiscuss the two major sources of crime statistics for the United Sta.docx
Discuss the two major sources of crime statistics for the United Sta.docxrhetttrevannion
 
Discuss the two most prominent theories related to the stage of adul.docx
Discuss the two most prominent theories related to the stage of adul.docxDiscuss the two most prominent theories related to the stage of adul.docx
Discuss the two most prominent theories related to the stage of adul.docxrhetttrevannion
 
Discuss the two elements required for the consent defense. In ad.docx
Discuss the two elements required for the consent defense. In ad.docxDiscuss the two elements required for the consent defense. In ad.docx
Discuss the two elements required for the consent defense. In ad.docxrhetttrevannion
 
Discuss the Truth in Lending Act and what role it places in financia.docx
Discuss the Truth in Lending Act and what role it places in financia.docxDiscuss the Truth in Lending Act and what role it places in financia.docx
Discuss the Truth in Lending Act and what role it places in financia.docxrhetttrevannion
 

More from rhetttrevannion (20)

Discuss three (3) ways that large organizations are increasingly eng.docx
Discuss three (3) ways that large organizations are increasingly eng.docxDiscuss three (3) ways that large organizations are increasingly eng.docx
Discuss three (3) ways that large organizations are increasingly eng.docx
 
Discuss this week’s objectives with your team sharing related rese.docx
Discuss this week’s objectives with your team sharing related rese.docxDiscuss this week’s objectives with your team sharing related rese.docx
Discuss this week’s objectives with your team sharing related rese.docx
 
Discuss theoretical considerations or assumptions relevant to yo.docx
Discuss theoretical considerations or assumptions relevant to yo.docxDiscuss theoretical considerations or assumptions relevant to yo.docx
Discuss theoretical considerations or assumptions relevant to yo.docx
 
Discuss theprinciple events of PROCESS AND THREAD used in both t.docx
Discuss theprinciple events of PROCESS AND THREAD used in both t.docxDiscuss theprinciple events of PROCESS AND THREAD used in both t.docx
Discuss theprinciple events of PROCESS AND THREAD used in both t.docx
 
Discuss the Windows Registry System Hive1) What information.docx
Discuss the Windows Registry System Hive1) What information.docxDiscuss the Windows Registry System Hive1) What information.docx
Discuss the Windows Registry System Hive1) What information.docx
 
Discuss the way the idea of heroism develops from Gilgamesh th.docx
Discuss the way the idea of heroism develops from Gilgamesh th.docxDiscuss the way the idea of heroism develops from Gilgamesh th.docx
Discuss the way the idea of heroism develops from Gilgamesh th.docx
 
Discuss the ways in which the history of the U.S. was presented in t.docx
Discuss the ways in which the history of the U.S. was presented in t.docxDiscuss the ways in which the history of the U.S. was presented in t.docx
Discuss the ways in which the history of the U.S. was presented in t.docx
 
Discuss the value of Lean Systems Engineering to systems develop.docx
Discuss the value of Lean Systems Engineering to systems develop.docxDiscuss the value of Lean Systems Engineering to systems develop.docx
Discuss the value of Lean Systems Engineering to systems develop.docx
 
discuss the various pathways interest groups use to influence politi.docx
discuss the various pathways interest groups use to influence politi.docxdiscuss the various pathways interest groups use to influence politi.docx
discuss the various pathways interest groups use to influence politi.docx
 
Discuss the various tools and techniques used by an HCO to incre.docx
Discuss the various tools and techniques used by an HCO to incre.docxDiscuss the various tools and techniques used by an HCO to incre.docx
Discuss the various tools and techniques used by an HCO to incre.docx
 
Discuss the various means by which slaves resisted the slave system..docx
Discuss the various means by which slaves resisted the slave system..docxDiscuss the various means by which slaves resisted the slave system..docx
Discuss the various means by which slaves resisted the slave system..docx
 
Discuss the typica l clinical presentation of the diagnosis , Hip Os.docx
Discuss the typica l clinical presentation of the diagnosis , Hip Os.docxDiscuss the typica l clinical presentation of the diagnosis , Hip Os.docx
Discuss the typica l clinical presentation of the diagnosis , Hip Os.docx
 
Discuss the types of resources, tools, and methods that are availabl.docx
Discuss the types of resources, tools, and methods that are availabl.docxDiscuss the types of resources, tools, and methods that are availabl.docx
Discuss the types of resources, tools, and methods that are availabl.docx
 
Discuss the types of items that should be examined in a firewall log.docx
Discuss the types of items that should be examined in a firewall log.docxDiscuss the types of items that should be examined in a firewall log.docx
Discuss the types of items that should be examined in a firewall log.docx
 
Discuss the types of property, providing an example of each an.docx
Discuss the types of property, providing an example of each an.docxDiscuss the types of property, providing an example of each an.docx
Discuss the types of property, providing an example of each an.docx
 
Discuss the type of personality it takes to become a police officer..docx
Discuss the type of personality it takes to become a police officer..docxDiscuss the type of personality it takes to become a police officer..docx
Discuss the type of personality it takes to become a police officer..docx
 
Discuss the two major sources of crime statistics for the United Sta.docx
Discuss the two major sources of crime statistics for the United Sta.docxDiscuss the two major sources of crime statistics for the United Sta.docx
Discuss the two major sources of crime statistics for the United Sta.docx
 
Discuss the two most prominent theories related to the stage of adul.docx
Discuss the two most prominent theories related to the stage of adul.docxDiscuss the two most prominent theories related to the stage of adul.docx
Discuss the two most prominent theories related to the stage of adul.docx
 
Discuss the two elements required for the consent defense. In ad.docx
Discuss the two elements required for the consent defense. In ad.docxDiscuss the two elements required for the consent defense. In ad.docx
Discuss the two elements required for the consent defense. In ad.docx
 
Discuss the Truth in Lending Act and what role it places in financia.docx
Discuss the Truth in Lending Act and what role it places in financia.docxDiscuss the Truth in Lending Act and what role it places in financia.docx
Discuss the Truth in Lending Act and what role it places in financia.docx
 

Recently uploaded

Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfAyushMahapatra5
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Disha Kariya
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhikauryashika82
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingTeacherCyreneCayanan
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpinRaunakKeshri1
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 

Recently uploaded (20)

Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writing
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 

3.4 Summary This chapter included the system of the device and c.docx

  • 1. 3.4 Summary This chapter included the system of the device and criteria, where it includes the block diagram and its explanations, and its main blocks that is used in this device, hardware requirements and a small brief about it and how it’s used in the device, and the flow chart of the device in its final phase with a miner explanation on it. 5.1 Overview The implementation phases of the given device started with understanding the flow chart and block diagram that explains the flow of the device working criteria as shown before in the third chapter, then comes the software and hardware implementation phases. Software implementation includes drawing the circuit in the Proteus software and showing the expected output from the hardware circuit. Moving on to the hardware phase which will include the physical implementation of the components of the device and how they are connected. 5.7 Summary This chapter has explained the software system of the device and its expected output, the hardware implementation of the system with its explanations, and the testing process with its result. The software implementation was done using Proteus software, and Hardware implementation included connected the components in the mentioned stages. Finally the testing was done into three stages; testing of components, testing of subsystem circuits, and testing of the device in its final stage after finishing its implementation 6.1 Overview This chapter includes the result obtained from testing the system in different conditions and in many stages, and a comparison between both hardware and software implementation 6.5 Summary
  • 2. Chapter 6 Results And Discussions This chapter included the result obtained from testing the device in different conditions and in many stages, and a comparison between both hardware and software implementation. Additionally, brief comparison between the experimental result from this device and the output from other previous literature device was mentioned. 54 ACKNOWLEDGEMENT This project has helped me to expand my knowledge about clean energy sources and how to use them since it has been an area of interest for me since high school. It also helped me to relate between this field and my specialization in telecommunications engineering. First of all, I would like to send my thanking prayers to Allah the whole mighty, first and foremost for helping me to complete this project successfully and within the needed time and blessing my time and effort. Furthermore, I would like to express my deepest appreciation to the project supervisor MR. Athar aziz for his constant and ultimate help in support that guided me to complete the project successfully. Last but not least, special thanks to my family and friends whom I wouldn’t complete my work professionally without their endless support and prayers. CS 222 01Programming Assignment 05 – Chapter 0520 Points Due: Friday, December 7, 2018 In the hash table program example used in class, the hash table size was chosen to be 47. If the table gets full, this needs to be increased. Re-implement the put method so that the table will automatically resize itself when the loading factor reaches a
  • 3. predetermined value (you can decided the value based on your assessment of load versus performance). What will need to be done: · Determine what you want to use as the loading factor · Create a new hash table where the hash table size is the next a prime number at least 25% larger than the current table size. You will need to add code that will find the next prime number · Re-hash all the current values in the hash table and put them in the new hash table · Clear the old hash table and copy all the new values from the new hash table into the old hash table Add the following comments to the beginning of the program. Name: Your Name Class and Section: CS 222 01 Assignment: Program Assignment 05 Due Date: See above Date Turned in: Program Description: You write a short description of what the program will do When you complete the program, do the following. 1. Create a folder with the following name: ProgramAssignment05 2. Copy your program to this folder 3. Copy the folder to your folder in the I:koppinboxCS 222 01 folder Chapter 05/binarySearch.py def binarySearch(alist, item): first = 0
  • 4. last = len(alist) - 1 found = False compare = 0 while first <= last and not found: midpoint = (first + last) // 2 compare += 1 if alist[midpoint] == item: found = True else: if item < alist[midpoint]: last = midpoint - 1 else: first = midpoint + 1 return found, compare def main(): lyst = [] for x in range(1000000):
  • 5. lyst.append(x) found, compare = binarySearch(lyst, 1000001) print("is number in list", found) print("Comparisons", compare) main() Chapter 05/bubbleSort.py import random def bubbleSort(alist): for passnum in range(len(alist) - 1, 0, -1): for i in range(passnum): if alist[i] > alist[i + 1]: temp = alist[i] alist[i] = alist[i + 1] alist[i + 1] = temp def printList(alist):
  • 6. count = 0 for x in range(len(alist)): if count % 10 == 0: print() print("%4d" % alist[x], end = " ") count += 1 def main(): lyst = [] n = int(input("Enter number of values: ")) for i in range(n): lyst.append(i) random.shuffle(lyst) #print("List before sort") #printList(lyst) #print("nnList after sort") bubbleSort(lyst) #printList(lyst)
  • 7. main() Chapter 05/hash.py class HashTable: def __init__(self): self.size = 47 self.slots = [None] * self.size self.data = [None] * self.size def put(self, key, data): hashValue = self.hashFunction(key, len(self.slots)) if self.slots[hashValue] == None: self.slots[hashValue] = key self.data[hashValue] = data else: if self.slots[hashValue] == key:
  • 8. self.data[hashValue] = data # replace else: nextslot = self.rehash(hashValue, len(self.slots)) while self.slots[nextslot] != None and self.slots[nextslot] != key: print("newslot", self.slots[nextslot]) nextslot = self.rehash(nextslot, len(self.slots)) if self.slots[nextslot] == None: self.slots[nextslot] = key self.data[nextslot] = data else: self.data[nextslot] = data # replace def hashFunction(self, key, size): return key % size def rehash(self, oldhash, size): return (oldhash + 1) % size
  • 9. def get(self, key): startslot = self.hashFunction(key, len(self.slots)) data = None stop = False found = False position = startslot while self.slots[position] != None and not found and not stop: if self.slots[position] == key: found = True data = self.data[position] else: position = self.rehash(position, len(self.slots)) if position == startslot: stop = True return data
  • 10. def __getitem__(self, key): return self.get(key) def __setitem__(self, key, data): self.put(key, data) def main(): H = HashTable() H[54] = "cat" H[26] = "dog" H[93] = "lion" H[17] = "tiger" H[31] = "bird" H[44] = "cow" H[55] = "pig" H[20] = "chicken" print("After adding 8 items") print(H.slots)
  • 11. print("Hash 20:", H[20]) print("Hash 17:", H[17]) H[101] = "penguin" H[20] = "duck" print("Change Hash 20 from chicken to duck:", H[20]) print("Hash data") print(H.data) main() Chapter 05/insertion.py import random def insertionSort(alist): for index in range(1, len(alist)): currentvalue = alist[index] position = index while position > 0 and alist[position - 1] > currentvalue: alist[position] = alist[position - 1] position -= 1
  • 12. alist[position] = currentvalue def main(): lyst = [] n = int(input("Enter number of values: ")) for i in range(n): num = random.randint(1, n * 10) while num in lyst: num = random.randint(1, n * 10) lyst.append(num) print("Ready to Sort") insertionSort(lyst) count = 0 for i in range(len(lyst)): if count % 10 == 0: print() count = 0
  • 13. print(lyst[i], end = " ") count += 1 main() Chapter 05/mergeSort.py import random def mergeSort(alist): if len(alist) > 1: mid = len(alist) // 2 lefthalf = alist[:mid] righthalf = alist[mid:] mergeSort(lefthalf) mergeSort(righthalf) i = 0 j = 0 k = 0 while i < len(lefthalf) and j < len(righthalf):
  • 14. if lefthalf[i] < righthalf[j]: alist[k] = lefthalf[i] i = i + 1 else: alist[k] = righthalf[j] j = j + 1 k = k + 1 while i < len(lefthalf): alist[k] = lefthalf[i] i = i + 1 k = k + 1 while j < len(righthalf): alist[k] = righthalf[j] j = j + 1 k = k + 1 def printList(alist): count = 0
  • 15. for x in range(len(alist)): if count % 10 == 0: print() print("%4d" % alist[x], end = " ") count += 1 def main(): lyst = [] n = int(input("Enter number of values: ")) for i in range(n): lyst.append(i) random.shuffle(lyst) #print("List before sort") #printList(lyst) #print("Ready to Sort") mergeSort(lyst) printList(lyst)
  • 16. main() Chapter 05/quickSort.py import random def quickSort(alist): quickSortHelper(alist, 0, len(alist) - 1) def quickSortHelper(alist, first, last): if first < last: splitpoint = partition(alist, first, last) quickSortHelper(alist, first, splitpoint - 1) quickSortHelper(alist, splitpoint + 1, last) def partition(alist, first, last): pivotvalue = alist[first] leftmark = first + 1 rightmark = last done = False
  • 17. while not done: while leftmark <= rightmark and alist[leftmark] <= pivotvalue: leftmark = leftmark + 1 while alist[rightmark] >= pivotvalue and rightmark >= leftmark: rightmark = rightmark - 1 if rightmark < leftmark: done = True else: temp = alist[leftmark] alist[leftmark] = alist[rightmark] alist[rightmark] = temp temp = alist[first] alist[first] = alist[rightmark] alist[rightmark] = temp return rightmark
  • 18. def printList(alist): count = 0 for x in range(len(alist)): if count % 10 == 0: print() print("%4d" % alist[x], end = " ") count += 1 def main(): lyst = [] n = int(input("Enter number of values: ")) for i in range(n): lyst.append(i) random.shuffle(lyst) #printList(lyst) #print("Ready to Sort")
  • 19. quickSort(lyst) printList(lyst) main() Chapter 05/RecursiveBinarySearch.py def binarySearch(alist, item, compare): if len(alist) == 0: return compare, False else: midpoint = len(alist) // 2 compare += 1 if alist[midpoint] == item: return compare, True else: if item < alist[midpoint]: return compare, binarySearch(alist[:midpoint], item, compare) else:
  • 20. return compare, binarySearch(alist[midpoint+1:], item, compare) def main(): lyst = [] compare = 0 for x in range(100): lyst.append(x) compare, found = binarySearch(lyst, 54, compare) print("is number in list", found) print("Comparisons", compare) main() Chapter 05/selectionSort.py import random def insertionSort(alist): for index in range(1, len(alist)):
  • 21. currentValue = alist[index] position = index while position > 0 and alist[position - 1] > currentValue: alist[position] = alist[position - 1] position -= 1 alist[position] = currentValue def printList(alist): count = 0 for x in range(len(alist)): if count % 10 == 0: print() print("%4d" % alist[x], end = " ") count += 1 def main(): lyst = [] n = int(input("Enter number of values: "))
  • 22. for i in range(n): lyst.append(i) random.shuffle(lyst) #print("List before sort") #printList(lyst) #print("nnList after sort") insertionSort(lyst) #printList(lyst) main() Chapter 05/sequentialSearch.py import random import time def sequentialSearch(alist, item): pos = 0 found = False
  • 23. compare = 0 while pos < len(alist) and not found: compare += 1 if alist[pos] == item: found = True else: pos += 1 print(pos, alist[pos]) return found, compare def main(): lyst = [] num = int(input("How many? ")) look = int(input("What number are you looking for? ")) for x in range(num): lyst.append(x) random.shuffle(lyst) #random.shuffle(lyst)
  • 24. start = time.time() found, compare = sequentialSearch(lyst, look) #print("is number in list", found) end = time.time() print("Comparisons:", compare) print("Time:", end - start) main() Chapter 05/shellSort.py import random def shellSort(alist): sublistCount = len(alist) // 2 while sublistCount > 0: for startPosition in range(sublistCount): gapInsertionSort(alist, startPosition, sublistCount) sublistCount = sublistCount // 2
  • 25. def gapInsertionSort(alist, start, gap): for i in range(start + gap, len(alist), gap): currentValue = alist[i] position = i while position >= gap and alist[position - gap] > currentValue: alist[position] = alist[position - gap] position = position - gap alist[position] = currentValue def printList(alist): count = 0 for x in range(len(alist)): if count % 10 == 0: print() print("%4d" % alist[x], end = " ") count += 1
  • 26. def main(): lyst = [] n = int(input("Enter number of values: ")) for i in range(n): lyst.append(i) random.shuffle(lyst) #print("List before sort") #printList(lyst) #print("nnList after sort") shellSort(lyst) #printList(lyst) main() Chapter 05/shortBubbleSort.py import random
  • 27. def bubbleSort(alist): exchanges = True passnum = len(alist) - 1 while passnum > 0 and exchanges: exchanges = False for i in range(passnum): if alist[i] > alist[i + 1]: exchanges = True temp = alist[i] alist[i] = alist[i + 1] alist[i + 1] = temp passnum -= 1 def printList(alist): count = 0 for x in range(len(alist)): if count % 10 == 0: print()
  • 28. print("%4d" % alist[x], end = " ") count += 1 def main(): lyst = [] n = int(input("Enter number of values: ")) for i in range(n): lyst.append(i) #random.shuffle(lyst) #print("List before sort") #printList(lyst) #print("nnList after sort") bubbleSort(lyst) #printList(lyst) main()
  • 29. Chapter 05/sortingTest.py import random import time def shellSort(alist): sublistCount = len(alist) // 2 while sublistCount > 0: for startPosition in range(sublistCount): gapInsertionSort(alist, startPosition, sublistCount) #print("After increment of size", sublistCount, "the list is") #printList(alist) sublistCount = sublistCount // 2 def gapInsertionSort(alist, start, gap): for i in range(start + gap, len(alist), gap): currentValue = alist[i] position = i while position >= gap and
  • 30. alist[position - gap] > currentValue: alist[position] = alist[position - gap] position = position - gap alist[position] = currentValue def main(): lyst = [] for x in range(1000000): lyst.append(x) random.shuffle(lyst) start = time.time() lyst.sort() end = time.time() print("Time:", end - start) start = time.time() shellSort(lyst)
  • 31. end = time.time() print("Shell Time:", end - start) main()