本文整理汇总了Python中LinkedList.createLinkedList方法的典型用法代码示例。如果您正苦于以下问题:Python LinkedList.createLinkedList方法的具体用法?Python LinkedList.createLinkedList怎么用?Python LinkedList.createLinkedList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LinkedList
的用法示例。
在下文中一共展示了LinkedList.createLinkedList方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: evaluateCycleDetection
# 需要导入模块: import LinkedList [as 别名]
# 或者: from LinkedList import createLinkedList [as 别名]
def evaluateCycleDetection(sizeOfList, cycleDetectionAlgorithm, locationOfCycle):
'''
Evaluates the specified Linked List cycle detection algorithm by creating lists with cycles from size 2 up to the
specified size and returning a (python) list specifying the number of iterations it took to find the cycle.
'''
numberOfIterations = [] #y-axis
for i in range (2, sizeOfList):
list = LinkedList.createLinkedList(i, True, int(i * locationOfCycle))
containsCycle, iterationsForList = cycleDetectionAlgorithm(list)
assert containsCycle # all of the generated lists should contain cycles.
numberOfIterations.append(iterationsForList)
return numberOfIterations