Skip to content

Instantly share code, notes, and snippets.

@halilgezer
Created April 14, 2022 22:52
Show Gist options
  • Save halilgezer/2013d84cc1fc879ce1dbdee262acb4ab to your computer and use it in GitHub Desktop.
Save halilgezer/2013d84cc1fc879ce1dbdee262acb4ab to your computer and use it in GitHub Desktop.
Merge Sort Project
[16,21,11,8,12,22] -> Merge Sort
1 ) Show the steps acording to insertion merge algorithm
step 1
[16,21,11] / [8,12,22]
step 2
[16,21] [11] / [8,12] [22]
step 3
[16,21] [11] / [8,12] [22]
step 4
[16] [21] [11] / [8] [12] [22]
step 5
[16] [21] [11] / [8] [12] [22] checed but no need to change
step 6
[16 , 21] [11] / [8 , 12] [22]
step 7
[11 , 21 , 16] / [8 , 12 , 22]
step 8 - final
[8,11,12,16,21,22]
2 ) What is the Big-O notation?
In everys steps we check the n/2 iterations. In the end we must check log(n) * n items so
O ( n* (log(n))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment