Skip to content

Commit f57caa6

Browse files
committed
test
1 parent 2f98935 commit f57caa6

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

Mergesort/README.markdown

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,12 @@
33
Goal: Sort an array from low to high (or high to low)
44

55
Invented in 1945, mergesort is a fairly efficient sorting algorithm with a best, worst, and average time complexity of O(n log n). The idea behind Mergesort
6-
is to **divide and conquer**. I'd like to call it **split first** and **merge after**.
6+
is to **divide and conquer**. I'd like to call it **split first** and **merge after**. Assume you're given an array of numbers and you need to put them in the right order. The merge sort algorithm works as follows:
7+
8+
- Put the numbers in a pile. The pile is unsorted.
9+
- Split the pile into 2. Now you have **two unsorted piles** of numbers.
10+
- Keep splitting the resulting piles until you can't anymore; In the end, you will have *n* piles with 1 number in each pile
11+
- Begin to **merge** the piles together by sequentially pairing a pile with another pile. During each merge, you want to sort the contents in order
12+
13+
14+

0 commit comments

Comments
 (0)