Algorithms Python: Explains Algorithms with Beautiful Pictures Learn it Easy Better and Well by yang hu

Algorithms Python: Explains Algorithms with Beautiful Pictures Learn it Easy Better and Well by yang hu

Author:yang hu [hu, yang]
Language: eng
Format: azw3, epub
Published: 2020-08-13T16:00:00+00:00


while i < j and array[ i] <= threshold:

i+= 1

# Replace the high with a number larger than the threshold

if i < j:

array[ j] = array[ i]

j-= 1

array[ i] = threshold

# left quick_sort

quick_sort( array, low, i - 1 )

# right quick_sort

quick_sort( array, i + 1 , high)

def main ():

scores = [ 90 , 60 , 50 , 80 , 70 , 100 ]

sort( scores)

for score in scores:

print ( score, "," , end= "" )

if __name__ == "__main__" :

main()

Result:

50 ,60 ,70 ,80 ,90 ,100 ,

Binary Search Tree

Binary Search Tree:

1. If the left subtree of any node is not empty, the value of all nodes on the left subtree is less than the value of its root node;

2. If the right subtree of any node is not empty, the value of all nodes on the right subtree is greater than the value of its root node;

3. The left subtree and the right subtree of any node are also binary search trees.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.