# Selection Algorithm
#
# @author : irfanudin ridho
# @email : irfan.ub@gmail.com
# @date : December 31, 2010
# @version : 1.0
class SA:
def __init__(self,data):
self.data = data
def getMinIndex(self):
minIndex = 0
lenn = len(self.data)
for i in range(lenn):
if(self.data[i]<self.data[minIndex]):
minIndex = i
return minIndex
def getMinValue(self):
return self.data[self.getMinIndex()]
def getMaxIndex(self):
maxIndex = 0
lenn = len(data)
for i in range(lenn):
if(self.data[i]>self.data[maxIndex]):
maxIndex = i
return maxIndex
def getMaxValue(self):
return self.data[self.getMaxIndex()]
#
# @author : irfanudin ridho
# @email : irfan.ub@gmail.com
# @date : December 31, 2010
# @version : 1.0
class SA:
def __init__(self,data):
self.data = data
def getMinIndex(self):
minIndex = 0
lenn = len(self.data)
for i in range(lenn):
if(self.data[i]<self.data[minIndex]):
minIndex = i
return minIndex
def getMinValue(self):
return self.data[self.getMinIndex()]
def getMaxIndex(self):
maxIndex = 0
lenn = len(data)
for i in range(lenn):
if(self.data[i]>self.data[maxIndex]):
maxIndex = i
return maxIndex
def getMaxValue(self):
return self.data[self.getMaxIndex()]
No comments:
Post a Comment