数据结构与算法习题 replacement selection sort(置换选择排序)
Time Limit: 1000ms Memory Limit: 65536kB
Description
Given an original run made up of intergers, and a binary minimumheap,you are required touse the heap to implement the replacement selection sort, and output the firstrun. For example, given a run of 29,14,35,13 and a heap(marked as16,19,31,25,21,56,40), the first run got by using replacement selection sort will be 16,19,21,25.
Input
The first line contains two intergers m and n, m is the number of the elements of the original run, n is the size of the binary minimum heap.
The second line contains m intergers, that is the original run.
The third line contains n intergers, the elements of the heap that has been constructed(in order, from the top of the heap to the bottom of the heap, from left to right)
Output
The output contains on