\documentclass[10pt,a4paper]{article} % Packages \usepackage{fancyhdr} % For header and footer \usepackage{multicol} % Allows multicols in tables \usepackage{tabularx} % Intelligent column widths \usepackage{tabulary} % Used in header and footer \usepackage{hhline} % Border under tables \usepackage{graphicx} % For images \usepackage{xcolor} % For hex colours %\usepackage[utf8x]{inputenc} % For unicode character support \usepackage[T1]{fontenc} % Without this we get weird character replacements \usepackage{colortbl} % For coloured tables \usepackage{setspace} % For line height \usepackage{lastpage} % Needed for total page number \usepackage{seqsplit} % Splits long words. %\usepackage{opensans} % Can't make this work so far. Shame. Would be lovely. \usepackage[normalem]{ulem} % For underlining links % Most of the following are not required for the majority % of cheat sheets but are needed for some symbol support. \usepackage{amsmath} % Symbols \usepackage{MnSymbol} % Symbols \usepackage{wasysym} % Symbols %\usepackage[english,german,french,spanish,italian]{babel} % Languages % Document Info \author{ps24} \pdfinfo{ /Title (cs-291-formula-s.pdf) /Creator (Cheatography) /Author (ps24) /Subject (CS 291 Formula's Cheat Sheet) } % Lengths and widths \addtolength{\textwidth}{6cm} \addtolength{\textheight}{-1cm} \addtolength{\hoffset}{-3cm} \addtolength{\voffset}{-2cm} \setlength{\tabcolsep}{0.2cm} % Space between columns \setlength{\headsep}{-12pt} % Reduce space between header and content \setlength{\headheight}{85pt} % If less, LaTeX automatically increases it \renewcommand{\footrulewidth}{0pt} % Remove footer line \renewcommand{\headrulewidth}{0pt} % Remove header line \renewcommand{\seqinsert}{\ifmmode\allowbreak\else\-\fi} % Hyphens in seqsplit % This two commands together give roughly % the right line height in the tables \renewcommand{\arraystretch}{1.3} \onehalfspacing % Commands \newcommand{\SetRowColor}[1]{\noalign{\gdef\RowColorName{#1}}\rowcolor{\RowColorName}} % Shortcut for row colour \newcommand{\mymulticolumn}[3]{\multicolumn{#1}{>{\columncolor{\RowColorName}}#2}{#3}} % For coloured multi-cols \newcolumntype{x}[1]{>{\raggedright}p{#1}} % New column types for ragged-right paragraph columns \newcommand{\tn}{\tabularnewline} % Required as custom column type in use % Font and Colours \definecolor{HeadBackground}{HTML}{333333} \definecolor{FootBackground}{HTML}{666666} \definecolor{TextColor}{HTML}{333333} \definecolor{DarkBackground}{HTML}{41298F} \definecolor{LightBackground}{HTML}{F3F1F8} \renewcommand{\familydefault}{\sfdefault} \color{TextColor} % Header and Footer \pagestyle{fancy} \fancyhead{} % Set header to blank \fancyfoot{} % Set footer to blank \fancyhead[L]{ \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{C} \SetRowColor{DarkBackground} \vspace{-7pt} {\parbox{\dimexpr\textwidth-2\fboxsep\relax}{\noindent \hspace*{-6pt}\includegraphics[width=5.8cm]{/web/www.cheatography.com/public/images/cheatography_logo.pdf}} } \end{tabulary} \columnbreak \begin{tabulary}{11cm}{L} \vspace{-2pt}\large{\bf{\textcolor{DarkBackground}{\textrm{CS 291 Formula's Cheat Sheet}}}} \\ \normalsize{by \textcolor{DarkBackground}{ps24} via \textcolor{DarkBackground}{\uline{cheatography.com/211338/cs/45769/}}} \end{tabulary} \end{multicols}} \fancyfoot[L]{ \footnotesize \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{LL} \SetRowColor{FootBackground} \mymulticolumn{2}{p{5.377cm}}{\bf\textcolor{white}{Cheatographer}} \\ \vspace{-2pt}ps24 \\ \uline{cheatography.com/ps24} \\ \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Cheat Sheet}} \\ \vspace{-2pt}Published 26th February, 2025.\\ Updated 27th February, 2025.\\ Page {\thepage} of \pageref{LastPage}. \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Sponsor}} \\ \SetRowColor{white} \vspace{-5pt} %\includegraphics[width=48px,height=48px]{dave.jpeg} Measure your website readability!\\ www.readability-score.com \end{tabulary} \end{multicols}} \begin{document} \raggedright \raggedcolumns % Set font size to small. Switch to any value % from this page to resize cheat sheet text: % www.emerson.emory.edu/services/latex/latex_169.html \footnotesize % Small font. \begin{multicols*}{4} \begin{tabularx}{3.833cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{3.833cm}}{\bf\textcolor{white}{Semantics}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{¬, ∃x,∀y (Highest, do first)} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{⋀} \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{⋁} \tn % Row Count 3 (+ 1) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{→ (Lowest, do last)} \tn % Row Count 4 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{3.833cm}}{\bf\textcolor{white}{Basic Equivalences}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{Negation} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{¬¬A} \tn % Row Count 2 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{3.833cm}}{\bf\textcolor{white}{Basic Equivalences}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{Some Conversions} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{𝐴 →𝐵≡¬𝐴∨𝐵} \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{¬(𝐴 →𝐵)≡𝐴∧¬𝐵} \tn % Row Count 3 (+ 1) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{𝐴 \seqsplit{→𝐵≡𝐴∧¬𝐵→False}} \tn % Row Count 4 (+ 1) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{∧ and ∨ are associative} \tn % Row Count 5 (+ 1) % Row 5 \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{(𝐴 ∧𝐵)∧𝐶 ≡𝐴∧(𝐵∧𝐶)} \tn % Row Count 6 (+ 1) % Row 6 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{(𝐴 ∨𝐵)∨𝐶 ≡𝐴∨(𝐵∨𝐶)} \tn % Row Count 7 (+ 1) % Row 7 \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{∧ and ∨ are commutativity} \tn % Row Count 8 (+ 1) % Row 8 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{\seqsplit{𝐴∧𝐵≡𝐵∧𝐴}} \tn % Row Count 9 (+ 1) % Row 9 \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{\seqsplit{𝐴∨𝐵≡𝐵∨𝐴}} \tn % Row Count 10 (+ 1) % Row 10 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{∧ and ∨ are Distributivity} \tn % Row Count 11 (+ 1) % Row 11 \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{\seqsplit{𝐴∧(𝐵∨𝐶)≡(𝐴∧𝐵)∨(𝐴∧𝐶)}} \tn % Row Count 13 (+ 2) % Row 12 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{\seqsplit{𝐴∨(𝐵∧𝐶)≡(𝐴∨𝐵)∧(𝐴∨𝐶)}} \tn % Row Count 15 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{x{0.9099 cm} x{1.15254 cm} x{0.97056 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{3.833cm}}{\bf\textcolor{white}{Proof Rules}} \tn % Row 0 \SetRowColor{LightBackground} Conjunction (Conj) & 𝐴, 𝐵 / 𝐴∧𝐵 & \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} \seqsplit{Simplification} (Simp) & 𝐴∧𝐵 / 𝐴 and & 𝐴∧𝐵 / 𝐵 \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} Addition (Add) & 𝐴 / 𝐴∨𝐵 and & 𝐵 / 𝐴∨𝐵 \tn % Row Count 6 (+ 2) % Row 3 \SetRowColor{white} Disjunctive Syllogism (DS) & 𝐴 ∨ 𝐵, ¬𝐴 / 𝐵 & 𝐴 ∨ 𝐵, ¬𝐴 / 𝐵 \tn % Row Count 9 (+ 3) % Row 4 \SetRowColor{LightBackground} Modus Ponens (MP) & 𝐴, 𝐴 →𝐵 / 𝐵 & \tn % Row Count 11 (+ 2) % Row 5 \SetRowColor{white} Conditional Proof (CP) & From𝐴, derive 𝐵/𝐴 →𝐵 & \tn % Row Count 14 (+ 3) % Row 6 \SetRowColor{LightBackground} Double Negation (DN) & ¬¬𝐴 / 𝐴 & 𝐴 /¬¬𝐴 \tn % Row Count 16 (+ 2) % Row 7 \SetRowColor{white} \seqsplit{Contradiction} (Contr) & 𝐴, ¬𝐴 / False & \tn % Row Count 18 (+ 2) % Row 8 \SetRowColor{LightBackground} Indirect Proof (IP) & From¬𝐴, derive False / 𝐴 & \tn % Row Count 21 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}---} \SetRowColor{LightBackground} \mymulticolumn{3}{x{3.833cm}}{These are all fractions with the first term appearing on top and the second one on the bottom. \newline \newline / this slash denotes where a fraction will be located} \tn \hhline{>{\arrayrulecolor{DarkBackground}}---} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{x{1.7165 cm} x{1.7165 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{3.833cm}}{\bf\textcolor{white}{CS 310 Lecture 5}} \tn % Row 0 \SetRowColor{LightBackground} Array Data Structure & A linear data structure defined as a collection of elements with the same or different data types. \tn % Row Count 5 (+ 5) % Row 1 \SetRowColor{white} & They exist in both single and multiple dimensions \tn % Row Count 8 (+ 3) % Row 2 \SetRowColor{LightBackground} Terms to understand the concept of Array. & o Element − Each item stored in an array is called an element. \tn % Row Count 12 (+ 4) % Row 3 \SetRowColor{white} & o Index − Each location of an element in an array has a numerical index. \tn % Row Count 16 (+ 4) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{3.833cm}}{\bf\textcolor{white}{CS 310 Lecture 5}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{Array Update Operation} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{1. Start} \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{2. Set LA{[}K-1{]} = ITEM} \tn % Row Count 3 (+ 1) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{3. Stop} \tn % Row Count 4 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{x{1.03122 cm} x{1.00089 cm} x{1.00089 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{3.833cm}}{\bf\textcolor{white}{CS 310 Lecture 5}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{3}{x{3.833cm}}{Common Features of Linked List} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} ➢Node: Each element in a LL is represented by a node, contains two components: & ➢Data: The actual data or value associated with the element. & ➢Next Pointer: A reference or pointer or address to the next node in the LL. \tn % Row Count 8 (+ 7) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{3}{x{3.833cm}}{➢Head: The first node in a LL is called the "head." It serves as the starting point.} \tn % Row Count 10 (+ 2) % Row 3 \SetRowColor{white} \mymulticolumn{3}{x{3.833cm}}{➢Tail: The last node in a linked list is called the "tail."} \tn % Row Count 12 (+ 2) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{3}{x{3.833cm}}{➢Data structures can be added to or removed from the LL during execution.} \tn % Row Count 14 (+ 2) % Row 5 \SetRowColor{white} \mymulticolumn{3}{x{3.833cm}}{➢Unlike an array, LL is a dynamically allocated DS that can grow and shrink.} \tn % Row Count 16 (+ 2) % Row 6 \SetRowColor{LightBackground} \mymulticolumn{3}{x{3.833cm}}{➢No elements need to be shifted after insertion and deletion.} \tn % Row Count 18 (+ 2) % Row 7 \SetRowColor{white} \mymulticolumn{3}{x{3.833cm}}{➢Various DSs can be implemented using an LL, such as stack, queue, graphs, hash, etc.} \tn % Row Count 20 (+ 2) % Row 8 \SetRowColor{LightBackground} \mymulticolumn{3}{x{3.833cm}}{➢Linked list contains 0 or more nodes. Last node points to null(address 0)} \tn % Row Count 22 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}---} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{3.833cm}}{\bf\textcolor{white}{CS 310 Lecture 5}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{p{3.833cm}}{\vspace{1px}\centerline{\includegraphics[width=5.1cm]{/web/www.cheatography.com/public/uploads/ps24_1740617317_Screenshot 2025-02-26 184807.png}}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{LIST-Traversal (L) \newline 1. Curr = L.head \newline 2. While Curr.next != NULL \newline 3. PRINT Curr} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{3.833cm}}{\bf\textcolor{white}{CS 310 Lecture 5}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{Linked List: Searching a Node} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{LIST-Searching (L,k)} \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{1. Curr = L.head} \tn % Row Count 3 (+ 1) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{2. While Curr != NULL and Curr.key != k} \tn % Row Count 4 (+ 1) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{3. Curr = Curr.next} \tn % Row Count 5 (+ 1) % Row 5 \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{4. return Curr} \tn % Row Count 6 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{3.833cm}}{\bf\textcolor{white}{CS 310 Lecture 5}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{p{3.833cm}}{\vspace{1px}\centerline{\includegraphics[width=5.1cm]{/web/www.cheatography.com/public/uploads/ps24_1740617818_Screenshot 2025-02-26 185624.png}}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{Doubly-linked list: Inserting at the beginning \newline \newline ➢The task can be performed by using the following 5 steps: \newline \newline ➢Firstly, allocate a new node. \newline \newline ➢Now put the required data in the new node. \newline \newline ➢Make the next of new\_node point to the current head of the DLL. \newline \newline ➢Make the previous of the current head point to new\_node. \newline \newline ➢Lastly, point head to new\_node.} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{3.833cm}}{\bf\textcolor{white}{Basic Equivalences}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{Disjunction} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{A ⋁ True ≣ True} \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{A ⋁ False ≣ A} \tn % Row Count 3 (+ 1) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{A ⋁ A ≣ A} \tn % Row Count 4 (+ 1) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{A ⋁ ¬A ≣ True} \tn % Row Count 5 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{3.833cm}}{\bf\textcolor{white}{Basic Equivalences}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{Absorption Laws} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{𝐴∧(𝐴∨𝐵) ≡ 𝐴} \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{𝐴∨(𝐴∧𝐵) ≡ 𝐴} \tn % Row Count 3 (+ 1) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{𝐴∧(¬𝐴∨𝐵) ≡ 𝐴∧𝐵} \tn % Row Count 4 (+ 1) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{\seqsplit{𝐴∨(¬𝐴∧𝐵)≡𝐴∨𝐵}} \tn % Row Count 5 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{p{0.72792 cm} x{1.15254 cm} x{1.15254 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{3.833cm}}{\bf\textcolor{white}{Program Correctness}} \tn % Row 0 \SetRowColor{LightBackground} AA \seqsplit{(Assignment} axiom) & \{𝑄(𝑥/𝑡)\} 𝑥 ≔ 𝑡 \{𝑄\} & \tn % Row Count 3 (+ 3) % Row 1 \SetRowColor{white} \seqsplit{Consequence} rules (A \& B) & 𝑃 →𝑅 and \{𝑅\} 𝑆 \{𝑄\} / \{𝑃\} 𝑆 \{𝑄\} & \{𝑃\} 𝑆 \{𝑇\} and 𝑇 →𝑄 / \{𝑃\} 𝑆 \{𝑄\} \tn % Row Count 7 (+ 4) \hhline{>{\arrayrulecolor{DarkBackground}}---} \SetRowColor{LightBackground} \mymulticolumn{3}{x{3.833cm}}{Loop invariants: A loop invariant is a condition that does not change after a loop has executed I.e. P} \tn \hhline{>{\arrayrulecolor{DarkBackground}}---} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{x{1.3732 cm} x{2.0598 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{3.833cm}}{\bf\textcolor{white}{Derived Proof Rules}} \tn % Row 0 \SetRowColor{LightBackground} Modus Tollens (MT) & 𝐴 →𝐵, ¬𝐵 / ¬𝐴 \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} Hypothetical Syllogism (HS) & 𝐴 → 𝐵, 𝐵 → 𝐶 / 𝐴 → 𝐶 \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} Proof by Cases (Cases) & 𝐴∨𝐵, 𝐴→𝐶, 𝐵→𝐶 / 𝐶 \tn % Row Count 6 (+ 2) % Row 3 \SetRowColor{white} Constructive Dilemma (CD) & 𝐴 ∨ 𝐵, 𝐴 → 𝐶, 𝐵 → D / 𝐶 ∨D \tn % Row Count 9 (+ 3) % Row 4 \SetRowColor{LightBackground} Destructive Dilemma (DD) & 𝐴 →𝐵, 𝐶 →𝐷, ¬𝐵∨¬D / ¬𝐴∨¬𝐶 \tn % Row Count 12 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{3.833cm}}{\bf\textcolor{white}{CS 310 Lecture 5}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{p{3.833cm}}{\vspace{1px}\centerline{\includegraphics[width=5.1cm]{/web/www.cheatography.com/public/uploads/ps24_1740608298_Screenshot 2025-02-26 161650.png}}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{3.833cm}}{\bf\textcolor{white}{CS 310 Lecture 5}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{Operations in Arrays} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{o Traverse − print all the array elements one by one.} \tn % Row Count 3 (+ 2) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{o Insertion − Adds an element at the given index.} \tn % Row Count 5 (+ 2) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{o Deletion − Deletes an element at the given index.} \tn % Row Count 7 (+ 2) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{o Search − Searches an element using the index or value.} \tn % Row Count 9 (+ 2) % Row 5 \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{o Update − Updates an element at the given index.} \tn % Row Count 11 (+ 2) % Row 6 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{o Display − Displays the contents of the array.} \tn % Row Count 12 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{3.833cm}}{\bf\textcolor{white}{CS 310 Lecture 5}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{Array Search Operation} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{1. Start} \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{2. Set J = 0} \tn % Row Count 3 (+ 1) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{3. Repeat steps 4 and 5 while J \textless{} N} \tn % Row Count 4 (+ 1) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{4. IF LA{[}J{]} == ITEM THEN GOTO STEP 6} \tn % Row Count 5 (+ 1) % Row 5 \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{5. Set J = J +1} \tn % Row Count 6 (+ 1) % Row 6 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{6. PRINT J, ITEM} \tn % Row Count 7 (+ 1) % Row 7 \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{7. Stop} \tn % Row Count 8 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{3.833cm}}{\bf\textcolor{white}{CS 310 Lecture 5}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{p{3.833cm}}{\vspace{1px}\centerline{\includegraphics[width=5.1cm]{/web/www.cheatography.com/public/uploads/ps24_1740609968_Screenshot 2025-02-26 164556.png}}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{➢Singly Linked List: Every node stores the address of the next node in the list and the last node \newline has the next address NULL.} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{3.833cm}}{\bf\textcolor{white}{CS 310 Lecture 5}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{Linked List: Operations} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{➢Accessing Elements/Traversing: Accessing a specific element in a linked list takes O(n) time since nodes are stored in non-contiguous locations, so random access is not possible.} \tn % Row Count 5 (+ 4) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{➢Searching: Searching a node in an LL takes O(n) time, as the whole list needs to be traversed in the worst case.} \tn % Row Count 8 (+ 3) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{➢Insertion: If we are at the position where we insert the element, insertion takes O (1) time.} \tn % Row Count 10 (+ 2) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{➢Deletion a/Destroy the list: Deletion takes O(1) time if we know the element's position to be deleted.} \tn % Row Count 13 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{3.833cm}}{\bf\textcolor{white}{CS 310 Lecture 5}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{p{3.833cm}}{\vspace{1px}\centerline{\includegraphics[width=5.1cm]{/web/www.cheatography.com/public/uploads/ps24_1740616870_Screenshot 2025-02-26 184047.png}}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{➢Doubly Linked Lists: Each node has two pointers: one pointing to the next node and one \newline pointing to the previous node. Allows for efficient traversal in both directions.} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{3.833cm}}{\bf\textcolor{white}{CS 310 Lecture 5}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{p{3.833cm}}{\vspace{1px}\centerline{\includegraphics[width=5.1cm]{/web/www.cheatography.com/public/uploads/ps24_1740617493_Screenshot 2025-02-26 185111.png}}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{LIST-Insert (L,x,k) \newline 1. if L.Head == NULL \newline 2. L.Head = x and Exit \newline 3. While Curr.key !=k and Curr !=NULL \newline 4. prevN = Curr \newline 5. Curr = Curr.Next \newline 6. If PrevN == NULL \newline 7. x.next = L.Head \newline 8. Head = x and exit \newline 9. PrevN = Curr and Curr = Curr.Next \newline 10. x.Next = Curr \newline 11. PrevN.Next = x} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{3.833cm}}{\bf\textcolor{white}{CS 310 Lecture 5}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{p{3.833cm}}{\vspace{1px}\centerline{\includegraphics[width=5.1cm]{/web/www.cheatography.com/public/uploads/ps24_1740618161_Screenshot 2025-02-26 190118.png}}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{Doubly-linked list: Inserting at the end \newline \newline ➢This can be done using the following 7 steps: \newline \newline ➢Create a new node (say new\_node). \newline \newline ➢Put the value in the new node. \newline \newline ➢Make the next pointer of new\_node as null. \newline \newline ➢If the list is empty, make new\_node as the head. \newline \newline ➢Otherwise, travel to the end of the linked list. \newline \newline ➢Now make the next pointer of last node point to new\_node. \newline \newline ➢Change the previous pointer of new\_node to the last node of the list.} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{3.833cm}}{\bf\textcolor{white}{Basic Equivalences}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{Conjunction} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{A ⋀ True ≣ A} \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{A ⋀ False ≣ False} \tn % Row Count 3 (+ 1) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{A ⋀ A ≣ A} \tn % Row Count 4 (+ 1) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{A ⋀ ¬A ≣ False} \tn % Row Count 5 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{3.833cm}}{\bf\textcolor{white}{Basic Equivalences}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{Absorption Laws} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{𝐴∧(𝐴∨𝐵) ≡ 𝐴} \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{𝐴∨(𝐴∧𝐵) ≡ 𝐴} \tn % Row Count 3 (+ 1) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{𝐴∧(¬𝐴∨𝐵) ≡ 𝐴∧𝐵} \tn % Row Count 4 (+ 1) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{\seqsplit{𝐴∨(¬𝐴∧𝐵)≡𝐴∨𝐵}} \tn % Row Count 5 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{p{0.72792 cm} x{1.15254 cm} x{1.15254 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{3.833cm}}{\bf\textcolor{white}{Program Correctness}} \tn % Row 0 \SetRowColor{LightBackground} AA \seqsplit{(Assignment} axiom) & \{𝑄(𝑥/𝑡)\} 𝑥 ≔ 𝑡 \{𝑄\} & \tn % Row Count 3 (+ 3) % Row 1 \SetRowColor{white} \seqsplit{Consequence} rules (A \& B) & 𝑃 →𝑅 and \{𝑅\} 𝑆 \{𝑄\} / \{𝑃\} 𝑆 \{𝑄\} & \{𝑃\} 𝑆 \{𝑇\} and 𝑇 →𝑄 / \{𝑃\} 𝑆 \{𝑄\} \tn % Row Count 7 (+ 4) % Row 2 \SetRowColor{LightBackground} \seqsplit{Composition} rule & \{𝑃\} 𝑆1 \{𝑄\} and \{𝑄\} 𝑆2 \{𝑅\} / \{𝑃\} 𝑆1;𝑆2 \{𝑅\} & \tn % Row Count 12 (+ 5) % Row 3 \SetRowColor{white} If-then Rule & \{𝑃 ∧𝐶\} 𝑆 \{𝑄\} and 𝑃 ∧¬𝐶 → 𝑄 & \{𝑃\} if 𝐶 then 𝑆 \{𝑄\} \tn % Row Count 16 (+ 4) % Row 4 \SetRowColor{LightBackground} \seqsplit{If-then-else} rule & \{𝑃 ∧𝐶\} 𝑆1 \{𝑄\} and \{𝑃 ∧¬𝐶\} 𝑆2 \{𝑄\} / \{𝑃\} if 𝐶 then 𝑆1 else 𝑆2 \{𝑄\} & \tn % Row Count 24 (+ 8) % Row 5 \SetRowColor{white} While rule & \{𝑃 ∧𝐶\} 𝑆 \{𝑃\} / \{𝑃\} while 𝐶 do 𝑆 \{𝑃 ∧¬𝐶\} & \tn % Row Count 29 (+ 5) \hhline{>{\arrayrulecolor{DarkBackground}}---} \SetRowColor{LightBackground} \mymulticolumn{3}{x{3.833cm}}{Loop invariants: A loop invariant is a condition that does not change after a loop has executed I.e. P} \tn \hhline{>{\arrayrulecolor{DarkBackground}}---} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{3.833cm}}{\bf\textcolor{white}{CS 310 Lecture 5}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{p{3.833cm}}{\vspace{1px}\centerline{\includegraphics[width=5.1cm]{/web/www.cheatography.com/public/uploads/ps24_1740608610_Screenshot 2025-02-26 162323.png}}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{3.833cm}}{\bf\textcolor{white}{CS 310 Lecture 5}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{Array Deletion Operation} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{1. Start} \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{2. Set J = K-1} \tn % Row Count 3 (+ 1) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{3. Repeat steps 4 and 5 while J \textless{} N} \tn % Row Count 4 (+ 1) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{4. Set LA{[}J{]} = LA{[}J + 1{]}} \tn % Row Count 5 (+ 1) % Row 5 \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{5. Set J = J+1} \tn % Row Count 6 (+ 1) % Row 6 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{6. Set N = N-1} \tn % Row Count 7 (+ 1) % Row 7 \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{7. Stop} \tn % Row Count 8 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{N - is the size of the array} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{3.833cm}}{\bf\textcolor{white}{CS 310 Lecture 5}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{Array Insertion Operation} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{1. Start} \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{2. Create an Array of a desired datatype and size.} \tn % Row Count 3 (+ 1) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{3.Initialize a variable 'i' as 0.} \tn % Row Count 4 (+ 1) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{4. Enter the element at the i-th index of the array.} \tn % Row Count 6 (+ 2) % Row 5 \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{5. Increment i by 1} \tn % Row Count 7 (+ 1) % Row 6 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{6. Repeat Steps 4 \& 5 until the end of the array.} \tn % Row Count 8 (+ 1) % Row 7 \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{7. Stop} \tn % Row Count 9 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{3.833cm}}{\bf\textcolor{white}{CS 310 Lecture 5}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{p{3.833cm}}{\vspace{1px}\centerline{\includegraphics[width=5.1cm]{/web/www.cheatography.com/public/uploads/ps24_1740616940_Screenshot 2025-02-26 184208.png}}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{➢Circular Linked Lists: A circular linked list is a type of linked list in which the first and the last \newline nodes are also connected to form a circle. There is no NULL at the end.} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{3.833cm}}{\bf\textcolor{white}{CS 310 Lecture 5}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{p{3.833cm}}{\vspace{1px}\centerline{\includegraphics[width=5.1cm]{/web/www.cheatography.com/public/uploads/ps24_1740617023_Screenshot 2025-02-26 184331.png}}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{Linked List: Empty List \newline ➢If a list currently contains 0 nodes, it is called the empty list. \newline ➢In this case, the list head points to null} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{3.833cm}}{\bf\textcolor{white}{CS 310 Lecture 5}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{p{3.833cm}}{\vspace{1px}\centerline{\includegraphics[width=5.1cm]{/web/www.cheatography.com/public/uploads/ps24_1740617168_Screenshot 2025-02-26 184533.png}}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{LIST-Append (L; x) \newline 1. if L.head == NULL \newline 2. L.head = x and Exit \newline 3. Curr = L.head \newline 3. While Curr.next != NULL \newline Curr = Curr.next \newline 4. Curr.next = x \newline \newline New Node is added to the end of the list} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{3.833cm}}{\bf\textcolor{white}{CS 310 Lecture 5}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{p{3.833cm}}{\vspace{1px}\centerline{\includegraphics[width=5.1cm]{/web/www.cheatography.com/public/uploads/ps24_1740617611_Screenshot 2025-02-26 185309.png}}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{Adjusting pointer around the node to be deleted \newline \newline LIST-Delete (L, k) \newline 1. if L.Head == NULL \newline 2. Exit \newline 3. While Curr.key !=k and Curr !=NULL \newline 4. PrevN = Curr \newline 5. Curr = Curr.Next \newline 6. If PrevN == NULL \newline 7. Curr = Head.Next \newline 8. delete Head and exit \newline 9. PrevN.Next = Curr.Next \newline 10. Delete Curr} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{3.833cm}}{\bf\textcolor{white}{CS 310 Lecture 5}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{p{3.833cm}}{\vspace{1px}\centerline{\includegraphics[width=5.1cm]{/web/www.cheatography.com/public/uploads/ps24_1740618268_Screenshot 2025-02-26 190402.png}}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{Circular-linked list operations: \newline ➢Insertion: Inserting At the Beginning, at the end, and after a given node. \newline ➢Deletion: Deleting from the Beginning, the end, and a Specific Node \newline ➢Display: This process displays the elements of a CLL.} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{3.833cm}}{\bf\textcolor{white}{Basic Equivalences}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{Implication} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{A → True ≣ True} \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{A → False ≣ ¬A} \tn % Row Count 3 (+ 1) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{True → A ≣ A} \tn % Row Count 4 (+ 1) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{False → A ≣ True} \tn % Row Count 5 (+ 1) % Row 5 \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{A → A ≣ True} \tn % Row Count 6 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{3.833cm}}{\bf\textcolor{white}{Basic Equivalences}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{De Morgan's Laws} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{¬(𝐴∧𝐵) ≡ ¬𝐴∨¬𝐵} \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{¬(𝐴∨𝐵) ≡ ¬𝐴∧¬𝐵} \tn % Row Count 3 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{3.833cm}}{\bf\textcolor{white}{Quantifiers}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{"An equivalence to be careful with"} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{∃𝑥(𝑝(𝑥) → 𝑞(𝑥)) ≡ ∀𝑥𝑝(𝑥) → ∃𝑥𝑞(𝑥)} \tn % Row Count 3 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{3.833cm}}{\bf\textcolor{white}{Quantifiers}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{Negations of quantifiers} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{¬(∀𝑥𝑊) ≡ ∃𝑥¬W} \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{¬(∃𝑥𝑊) ≡ ∀𝑥¬W} \tn % Row Count 3 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{3.833cm}}{\bf\textcolor{white}{Quantifiers}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{Formalize English sentences and entire arguments into FOPC} \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{∀𝑥 quantifies a conditional} \tn % Row Count 3 (+ 1) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{∃𝑥 quantifies a conjunction} \tn % Row Count 4 (+ 1) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{∀𝑥 with conditional for "all," "every," and "only."} \tn % Row Count 6 (+ 2) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{∃𝑥 with conjunction for "some," "there is," and "not all."} \tn % Row Count 8 (+ 2) % Row 5 \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{∀𝑥 with conditional or ¬∃𝑥 with conjunction for "no A is B."} \tn % Row Count 10 (+ 2) % Row 6 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{∃𝑥 with conjunction or ¬∀𝑥 with conditional for "not all A's are B."} \tn % Row Count 12 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{3.833cm}}{\bf\textcolor{white}{Inference Rules FOPC}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{UI} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{EI} \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{EG} \tn % Row Count 3 (+ 1) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{UG} \tn % Row Count 4 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{UI \& EI Add A and E from problem; UG, EG, Take the away A and E in the problem.} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{3.833cm}}{\bf\textcolor{white}{CS 310 Lecture 5}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{Array Traversal Operation} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{1. Start} \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{2. Initialize an Array, LA. // 1. Initialize an array called LA} \tn % Row Count 4 (+ 2) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{3. Initialize, i = 0. // 2. Set i - 0} \tn % Row Count 5 (+ 1) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{4. Print the LA{[}i{]} and increment i. // 3. Repeat Steps 4-5 while i \textless{} N} \tn % Row Count 7 (+ 2) % Row 5 \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{5. Repeat Step 4 until the end of the array. // 4. Print LA{[}i{]}} \tn % Row Count 9 (+ 2) % Row 6 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{6. End // 5. Increment the value of i by one. (Set i = i + 1)} \tn % Row Count 11 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{// represent possible modifications you can do that would still be counted as correct} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{p{0.76357 cm} p{0.63192 cm} p{0.76357 cm} p{0.47394 cm} } \SetRowColor{DarkBackground} \mymulticolumn{4}{x{3.833cm}}{\bf\textcolor{white}{CS 310 Lecture 5}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{4}{x{3.833cm}}{➢An abstract data type (ADT) in data structure is a data type defined with the help of some attributes and some functions} \tn % Row Count 3 (+ 3) % Row 1 \SetRowColor{white} ➢An abstract data type in the data structure can be & ➢A list data \seqsplit{structure} & ➢A stack data structure & ➢A queue data \seqsplit{structure} \tn % Row Count 8 (+ 5) % Row 2 \SetRowColor{LightBackground} ➢Linked List: A LL is a linear data structure \seqsplit{constructed} like a chain of nodes where & ➢Each node contains a data field & ➢A \seqsplit{reference(link/address/array-Indices)} to the next node in the list. & \tn % Row Count 16 (+ 8) % Row 3 \SetRowColor{white} \mymulticolumn{4}{x{3.833cm}}{➢Unlike Arrays, Linked List elements are not stored at a contiguous location.} \tn % Row Count 18 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}----} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{3.833cm}}{\bf\textcolor{white}{CS 310 Lecture 5}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{p{3.833cm}}{\vspace{1px}\centerline{\includegraphics[width=5.1cm]{/web/www.cheatography.com/public/uploads/ps24_1740617745_Screenshot 2025-02-26 185524.png}}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{Doubly-linked list: Operations \newline \newline ➢Insertion: Inserting At the Beginning, at the end, after a given node, and before a \newline given node. \newline \newline ➢Deletion: Deleting from the Beginning, end, and a specific node of the list \newline \newline ➢Display: This process displays the elements of a doubly LL.} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{3.833cm}}{\bf\textcolor{white}{CS 310 Lecture 5}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{p{3.833cm}}{\vspace{1px}\centerline{\includegraphics[width=5.1cm]{/web/www.cheatography.com/public/uploads/ps24_1740618057_Screenshot 2025-02-26 190030.png}}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{Doubly-linked list: Inserting after a given node \newline \newline ➢ Inserting after a given node can be done by: \newline \newline ➢Firstly create a new node (say new\_node). \newline \newline ➢Now insert the data in the new node. \newline \newline ➢Point the next of new\_node to the next of prev\_node. \newline \newline ➢Point the next of prev\_node to new\_node. \newline \newline ➢Point the previous of new\_node to prev\_node. \newline \newline ➢Change the pointer of the new node's previous pointer to new\_node.} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} % That's all folks \end{multicols*} \end{document}