Skip to content

Commit

Permalink
Add Merge Sort page
Browse files Browse the repository at this point in the history
  • Loading branch information
nayakrujul committed Jan 29, 2024
1 parent 73ca7bf commit 85415d1
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 0 deletions.
5 changes: 5 additions & 0 deletions CompSci/1-07-Bubble-Sort/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@ <h3 class="home-link"><a href="../">Computer Science Revision</a></h3>
</el>
</p>

<br />

<a class="next-link" href="../1-08-Merge-Sort/">Next: 1.08 - Merge Sort</a>

<br /> <br />
<br /> <br />

<div id="sub">© Rujul Nayak <el id="year">2024-</el></div>
Expand Down
Binary file added CompSci/1-08-Merge-Sort/diagram1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
69 changes: 69 additions & 0 deletions CompSci/1-08-Merge-Sort/index.html
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 &ndash; 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 /> &emsp; 1. Keep splitting the list in half until all sublists contain one item
<br /> &emsp; 2. Repeatedly merge and sort pairs of sublists into larger sublists
<br /> &emsp; 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>
1 change: 1 addition & 0 deletions CompSci/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ <h3><strong>Chapter 1 - Algorithms</strong></h3>
<li><a href="./1-05-Binary-Search/">1.05 - Binary Search</a></li>
<li><a href="./1-06-Searching-Algorithms-Comparison/">1.06 - Searching Algorithms Comparison</a></li>
<li><a href="./1-07-Bubble-Sort/">1.07 - Bubble Sort</a></li>
<li><a href="./1-08-Merge-Sort/">1.08 - Merge Sort</a></li>
</ul>

<div id="sub">© Rujul Nayak <el id="year">2024-</el></div>
Expand Down

0 comments on commit 85415d1

Please sign in to comment.