简体   繁体   中英

Merge Sort Array of Integers

Can anyone help me with this pratice question: 33 31 11 47 2 20 24 12 2 43. I am trying to figure out what the contents of the two output lists would be after the first pass of the Merge Sort.

The answer is supposedly: List 1: 33 11 47 12 List 2: 31 2 20 24 2 43

Not making any sense to me sense I was under the impression that the first pass was where it divided it into two lists at the middle....

33 31 11 47 2 20 24 12 At first the list divides into individual elements such that when a single ton list is formed each element is compared with the one next to it. So after first pass we have

31 33 11 47 2 20 12 24
After that

11 31 33 47 2 12 20 24
and then

2 11 12 20 24 3133 37

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM