From eec6292056e6f6d6aa9f52ed2b71585e60632568 Mon Sep 17 00:00:00 2001
From: Mohit Agarwal <mohit.agarwal@sky.com>
Date: Mon, 1 Jan 2024 18:55:33 +0000
Subject: Rewriting

---
 notes/algorithms.tex | 24 +++++++++++++-----------
 1 file changed, 13 insertions(+), 11 deletions(-)

(limited to 'notes/algorithms.tex')

diff --git a/notes/algorithms.tex b/notes/algorithms.tex
index 4801766..bffe1a9 100644
--- a/notes/algorithms.tex
+++ b/notes/algorithms.tex
@@ -91,11 +91,11 @@ of order so we would swap them. Here are some but not all steps on the
 original list $n$
 
 \begin{align*}
-    &n = \{2,6,4,7,8,3,9,0\} \mbox{ comparing 2 and 6} \\
-    &n = \{2,4,6,7,8,3,9,0\} \mbox{ comparing 6 and 4, \textit{swap}} \\
-    &n = \{2,4,6,7,8,3,9,0\} \mbox{ comparing 6 and 7} \\
-    &n = \{2,4,6,7,8,3,9,0\} \mbox{ comparing 7 and 8} \\
-    &n = \{2,4,6,7,3,8,9,0\} \mbox{ comparing 8 and 3, \textit{swap}} \\
+    &n = \{\color{red}2\color{black},\color{red}6\color{black},4,7,8,3,9,0\} \mbox{ comparing 2 and 6} \\
+    &n = \{2,\color{red}4\color{black},\color{red}6\color{black},7,8,3,9,0\} \mbox{ comparing 6 and 4, \textit{swap}} \\
+    &n = \{2,4,\color{red}6\color{black},\color{red}7\color{black},8,3,9,0\} \mbox{ comparing 6 and 7} \\
+    &n = \{2,4,6,\color{red}7\color{black},\color{red}8\color{black},3,9,0\} \mbox{ comparing 7 and 8} \\
+    &n = \{2,4,6,7,\color{red}3\color{black},\color{red}8\color{black},9,0\} \mbox{ comparing 8 and 3, \textit{swap}} \\
     &...
 \end{align*}
 
@@ -111,13 +111,15 @@ sequentially add the smaller value between the lists to the output
 
 \begin{align*}
     list\ 1  &&list\ 2  &&output\ list\\
-    \{1,3,5\}&&\{2,4,6\}&&\{\}       &&\mbox{}\\
-    \{3,5\}  &&\{2,4,6\}&&\{1\}      &&\mbox{Comparing 1 and 2, we start with 1}\\
-    \{3,5\}  &&\{4,6\}  &&\{1,2\}    &&\mbox{Comparing 3 and 2, we add 2}\\
-    \{5\}    &&\{4,6\}  &&\{1,2,3\}  &&\mbox{Comparing 3 and 4, we add 3}\\
-    \{5\}    &&\{6\}    &&\{1,2,3,4\}&&\mbox{Comparing 5 and 4, we add 4}\\
-    \{\}     &&\{6\}    &&\{1,2,3,4,5\}&&\mbox{Comparing 5 and 6, we add 5}\\
+    \{{\color{red}1},3,5\}&&\{{\color{red}2},4,6\}&&\{\}       &&\mbox{}\\
+    \{{\color{red}3},5\}  &&\{{\color{red}2},4,6\}&&\{1\}      &&\mbox{Comparing 1 and 2, we start with 1}\\
+    \{{\color{red}3},5\}  &&\{{\color{red}4},6\}  &&\{1,2\}    &&\mbox{Comparing 3 and 2, we add 2}\\
+    \{{\color{red}5}\}    &&\{{\color{red}4},6\}  &&\{1,2,3\}  &&\mbox{Comparing 3 and 4, we add 3}\\
+    \{{\color{red}5}\}    &&\{{\color{red}6}\}    &&\{1,2,3,4\}&&\mbox{Comparing 5 and 4, we add 4}\\
+    \{\}     &&\{{\color{red}6}\}    &&\{1,2,3,4,5\}&&\mbox{Comparing 5 and 6, we add 5}\\
     \{\}     &&\{\}     &&\{1,2,3,4,5,6\}&&\mbox{Comparing nothing and 6, we add 6}\\
+    \{\}     &&\{\}     &&\{1,2,3,4,5,6\}&&\mbox{Lists 1 \& 
+    2: we are finished}\\
 \end{align*}
 
 \section{Programming languages}
-- 
cgit v1.2.3

