-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
73ca7bf
commit 85415d1
Showing
4 changed files
with
75 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
<!DOCTYPE html> | ||
|
||
<html> | ||
<head> | ||
<link rel="stylesheet" href="../../main.css"> | ||
<link rel="stylesheet" href="../main.css"> | ||
|
||
<title>Computer Science Revision</title> | ||
|
||
<link rel="icon" type="image/png" href="../icons/logo.svg"/> | ||
<meta property="og:image" content="../icons/logo.svg" /> | ||
<meta property="og:image:width" content="256" /> | ||
<meta property="og:image:height" content="256" /> | ||
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<meta name="description" content="1.08 - Merge Sort | Computer Science Revision"> | ||
</head> | ||
|
||
<body> | ||
<h1>1.08 – Merge Sort</h1> | ||
<h3 class="home-link"><a href="../">Computer Science Revision</a></h3> | ||
<br /> | ||
|
||
<a class="prev-link" href="../1-07-Bubble-Sort/">Previous: 1.07 - Bubble Sort</a> | ||
<br /> <br /> | ||
|
||
<p class="definition"> | ||
<img src="../icons/book.svg" class="icon" /> | ||
<strong>Merge sort</strong> is a more complicated sorting algorithm. | ||
</p> | ||
|
||
<p> | ||
The steps to do a merge sort are as follows: | ||
<br />   1. Keep splitting the list in half until all sublists contain one item | ||
<br />   2. Repeatedly merge and sort pairs of sublists into larger sublists | ||
<br />   3. Eventually, the whole list will be reconstructed in order | ||
</p> | ||
|
||
<p> | ||
Diagram 1 shows an example run of merge sort on a list of numbers. | ||
</p> | ||
|
||
<p class="diagram"> | ||
<img src="../icons/image.svg" class="icon" /> | ||
Diagram 1 <br /> <br /> | ||
<img src="./diagram1.png" width="300px" /> | ||
</p> | ||
|
||
<p class="question"> | ||
<img src="../icons/question.svg" class="icon" /> | ||
Which sorting algorithm is more efficient: merge sort or bubble sort? | ||
</p> | ||
|
||
<p class="spoiler noselect"> | ||
<el class="default">Tap/click to reveal</el> | ||
<el class="answer"> | ||
Merge sort (with a worst case <b>time complexity</b> on the order of <code>O(n log n)</code>) is much more efficient than | ||
bubble sort (worst case on the order of <code>O(n<sup>2</sup>)</code>), especially for larger lists. | ||
</el> | ||
</p> | ||
|
||
<br /> <br /> | ||
|
||
<div id="sub">© Rujul Nayak <el id="year">2024-</el></div> | ||
<script src="../../year.js"></script> | ||
|
||
<script src="../spoilers.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters