fc4c0f5bfda4fe90246d99767902dbf0a200c0d5,data_structures/heap/heap.py,,main,#,77

Before Change




def main():
    l = list(map(int, input().split()))
    h = Heap()
    h.buildHeap(l)
    h.heapSort()
    h.display()

After Change




def main():
    for unsorted in [
        [],
        [0],
        [2],
        [3, 5],
        [5, 3],
        [5, 5],
        [0, 0, 0, 0],
        [1, 1, 1, 1],
        [2, 2, 3, 5],
        [0, 2, 2, 3, 5],
        [2, 5, 3, 0, 2, 3, 0, 3],
        [6, 1, 2, 7, 9, 3, 4, 5, 10, 8],
        [103, 9, 1, 7, 11, 15, 25, 201, 209, 107, 5],
        [-45, -2, -5]
    ]:
        print("source unsorted list: %s" % unsorted)

        h = Heap()
        h.build_heap(unsorted)
        print("after build heap: ", end=" ")
        h.display()

        print("max value: %s" % h.get_max())
        print("delete max value: ", end=" ")
        h.display()

        h.insert(100)
        print("after insert new value 100: ", end=" ")
        h.display()

        h.heap_sort()
        print("heap sort: ", end=" ")
        h.display()
        print()


if __name__ == "__main__":
    main()
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 3

Instances


Project Name: TheAlgorithms/Python
Commit Name: fc4c0f5bfda4fe90246d99767902dbf0a200c0d5
Time: 2020-01-14
Author: hzhilamp@163.com
File Name: data_structures/heap/heap.py
Class Name:
Method Name: main


Project Name: allenai/allennlp
Commit Name: 614c507d88e9797fb86216e41ef6fa83e33b30f7
Time: 2017-08-31
Author: mattg@allenai.org
File Name: allennlp/data/tokenizers/character_tokenizer.py
Class Name: CharacterTokenizer
Method Name: tokenize


Project Name: mil-tokyo/webdnn
Commit Name: 2571186c26968de784585bdabf0c0979e9608a85
Time: 2017-04-20
Author: y.kikura@gmail.com
File Name: src/graph_builder/optimizer/util.py
Class Name:
Method Name: listup_operator_in_order