本文整理汇总了Python中linkedlist.LinkedList.display方法的典型用法代码示例。如果您正苦于以下问题:Python LinkedList.display方法的具体用法?Python LinkedList.display怎么用?Python LinkedList.display使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类linkedlist.LinkedList
的用法示例。
在下文中一共展示了LinkedList.display方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: range
# 需要导入模块: from linkedlist import LinkedList [as 别名]
# 或者: from linkedlist.LinkedList import display [as 别名]
for i in range(10):
myList.insertNode(randint(0,9))
def partition(self):
pivot = self.first.data
start = self.first
temp = self.first
while(temp.next!=None):
if(temp.next.data < pivot):
nextElement = temp.next.next
temp.next.next = start
start = temp.next
temp.next=nextElement
else:
temp = temp.next
self.first = start
LinkedList.partition = partition
myList.display()
myList.partition()
myList.display()
示例2: while
# 需要导入模块: from linkedlist import LinkedList [as 别名]
# 或者: from linkedlist.LinkedList import display [as 别名]
secondStack=[]
while(temp!=None):
secondStack.append(temp.data)
temp = temp.next
def insertFirst(theList,data):
node = Node(data)
node.next = theList.first
theList.first = node
carry =0
result = LinkedList()
while (firstStack or secondStack):
num1 = firstStack.pop() if firstStack else 0
num2 = secondStack.pop() if secondStack else 0
sum = num1 + num2 + carry
carry = sum / 10
sum = sum % 10
insertFirst(result,sum)
if( (not firstStack and not secondStack) and carry!=0):
insertFirst(result,carry)
result.display()
示例3: cluster
# 需要导入模块: from linkedlist import LinkedList [as 别名]
# 或者: from linkedlist.LinkedList import display [as 别名]
flag=1
break
else:
temp=temp.next
y=y+1
if(flag==0):
l.add(stok1[x],pos_count)
pos_count=pos_count+1
x=x+1
#print "zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz"
#hash_table[tempnode.name]=pos_count
#print "zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz"
#hash_table[tempnode.name]=pos_count
l.display()
for x in hash_table.keys():
print x
#Ranking the sentences inside the cluster
elig_sent=[]
elig_sent_pos=[]
elig_sent_score=[]
temp_clust=l.head
while (temp_clust != None):
# twice ranking sentence cluster(only one sentence), inturn similarity cluster.
temp_sent_clust=temp_clust.child
max_score=0
sen_pos=0
max_sentence="aaa"
sentence=temp_sent_clust.data
while (temp_sent_clust != None):