CB100

Notas, resueltos y tps de la materia Algoritmos y Estructuras de Datos
Index Commits Files Refs README
commit b1fb3644f29bf23c6baacf1af668b356095d0da0
parent 6e590ea4a9cba72f2782242497523940e9b89412
Author: Martin Kloeckner <mjkloeckner@gmail.com>
Date:   Mon, 14 Jul 2025 17:18:56 -0300

update PDF style

also fix words not breaking into syllables

Diffstat:
Mguias/complejidad_algoritmica/fix-math.lua | 93++++++++++++++++++++++++++++++++++++++++++++-----------------------------------
Mguias/complejidad_algoritmica/respuestas.md | 12++++++++----
Mguias/complejidad_algoritmica/respuestas.pdf | 0
Mguias/complejidad_algoritmica/style.tex | 26++++++++++++++++++++------
4 files changed, 80 insertions(+), 51 deletions(-)
diff --git a/guias/complejidad_algoritmica/fix-math.lua b/guias/complejidad_algoritmica/fix-math.lua
@@ -10,54 +10,65 @@ local eq_align_before_space = "-0.75em"
 local eq_align_after_space = "-0.75em"
 
 local function vspace(amount)
-  return pandoc.RawBlock('latex', '\\vspace{' .. amount .. '}')
+    return pandoc.RawBlock('latex', '\\vspace{' .. amount .. '}')
 end
 
 function walk_blocks(blocks)
-  local new_blocks = {}
-  for _, blk in ipairs(blocks) do
-    if blk.t == 'Para' then
-      -- Paras can contain inline math elements, so check and replace those as well
-      local new_inlines = {}
-      for _, inline in ipairs(blk.content) do
-        if inline.t == 'Math' and inline.mathtype == 'DisplayMath' then
-          table.insert(new_blocks, vspace(eq_before_space))
-          if inline.text:match('^\\begin{align%*?}') then
-            -- replace inline Math with RawBlock (convert Para to RawBlock)
-            table.insert(new_blocks, vspace(eq_align_before_space))
-            table.insert(new_blocks, pandoc.RawBlock('latex', inline.text))
-            table.insert(new_blocks, vspace(eq_align_after_space))
-          else
-            table.insert(new_blocks, pandoc.RawBlock('latex', '\\[' .. inline.text .. '\\]'))
-          end
-          table.insert(new_blocks, vspace(eq_after_space))
+    local new_blocks = {}
+    for _, blk in ipairs(blocks) do
+        if blk.t == 'Para' then
+            -- Paras can contain inline math elements, so check and replace those as well
+            local new_inlines = {}
+            for _, inline in ipairs(blk.content) do
+                if inline.t == 'Math' and inline.mathtype == 'DisplayMath' then
+                    table.insert(new_blocks, vspace(eq_before_space))
+                    if inline.text:match('^\\begin{align%*?}') then
+                        -- replace inline Math with RawBlock (convert Para to RawBlock)
+                        table.insert(new_blocks, vspace(eq_align_before_space))
+                        table.insert(new_blocks, pandoc.RawBlock('latex', inline.text))
+                        table.insert(new_blocks, vspace(eq_align_after_space))
+                    else
+                        table.insert(new_blocks, pandoc.RawBlock('latex', '\\[' .. inline.text .. '\\]'))
+                    end
+                    table.insert(new_blocks, vspace(eq_after_space))
+                else
+                    table.insert(new_inlines, inline)
+                end
+            end
+            -- Only add the Para if there is still content
+            if #new_inlines > 0 then
+                table.insert(new_blocks, pandoc.Para(new_inlines))
+            end
+
+        elseif blk.t == 'CodeBlock' or blk.t == 'RawBlock' then
+            -- Just keep them as is
+            table.insert(new_blocks, blk)
+
+        elseif blk.t == 'BlockQuote' or blk.t == 'Div' then
+            -- Recurse on nested blocks
+            table.insert(new_blocks, vspace("0.5em"))
+            blk.content = walk_blocks(blk.content)
+            table.insert(new_blocks, blk)
+            table.insert(new_blocks, vspace("0.5em"))
+
+        elseif blk.t == 'BulletList' or blk.t == 'OrderedList' then
+            -- process each item recursively
+            for i, item in ipairs(blk.content) do
+                blk.content[i] = walk_blocks(item)
+            end
+            table.insert(new_blocks, blk)
+
+        elseif blk.t == 'Item' then
+            blk.content = walk_blocks(blk.content)
+            table.insert(new_blocks, blk)
         else
-          table.insert(new_inlines, inline)
+            table.insert(new_blocks, blk)
         end
-      end
-      -- Only add the Para if there is still content
-      if #new_inlines > 0 then
-        table.insert(new_blocks, pandoc.Para(new_inlines))
-      end
-
-    elseif blk.t == 'CodeBlock' or blk.t == 'RawBlock' then
-      -- Just keep them as is
-      table.insert(new_blocks, blk)
-
-    elseif blk.t == 'BlockQuote' or blk.t == 'Div' then
-      -- Recurse on nested blocks
-      table.insert(new_blocks, vspace("0.5em"))
-      blk.content = walk_blocks(blk.content)
-      table.insert(new_blocks, blk)
-      table.insert(new_blocks, vspace("0.5em"))
-    else
-      table.insert(new_blocks, blk)
     end
-  end
-  return new_blocks
+    return new_blocks
 end
 
 function Pandoc(doc)
-  doc.blocks = walk_blocks(doc.blocks)
-  return doc
+    doc.blocks = walk_blocks(doc.blocks)
+    return doc
 end
diff --git a/guias/complejidad_algoritmica/respuestas.md b/guias/complejidad_algoritmica/respuestas.md
@@ -4,9 +4,10 @@ Algoritmos y Estructuras de Datos (CB100) - FIUBA
 Martin Klöckner - [mklockner@fi.uba.ar](mailto:mklockner@fi.uba.ar)
 
 > 1. Un algoritmo divide un problema de tamaño $n$ en dos subproblemas de tamaño
->    $n/2$ con un costo constante en cada paso adicional, obtener la complejidad
->    sabiendo que el costo real $T(n)$ es:
->    $$T(n) = 2T\left(\frac{n}{2}\right) + \Omicron(1)$$
+> $n/2$ con un costo constante en cada paso adicional, obtener la complejidad
+> sabiendo que el costo real $T(n)$ es: 
+> \vspace{-0.65em}
+> $$T(n) = 2T\left(\frac{n}{2}\right) + \Omicron(1)$$
 
 Como la función de costo real $T(n)$ depende de la misma función $T(n)$ pero con
 una entrada menor $n/2$ se trata de un algoritmo recursivo o iterativo. Por el
@@ -17,7 +18,8 @@ $$\begin{align}
 T(n) = 2T\left(\frac{n}{2}\right) + \Omicron(1)
 \end{align}$$
 
-Podemos obtener $T\left(\frac{n}{2}\right)$ reemplazando $n$ con $n/2$ en (1):
+De la ecuación anterior se puede obtener $T\left(\frac{n}{2}\right)$
+reemplazando $n$ con $n/2$:
 
 $$\begin{align}
 T\left(\frac{n}{2}\right) = 2T\left(\frac{n}{4}\right) +
@@ -109,6 +111,7 @@ expansión.
 
 > 2. Un algoritmo busca un valor en un array ordenado reduciendo el problema a
 >    la mitad en cada paso, con un costo constante para la comparación
+>    \vspace{-0.65em}
 >    $$T(n) = T\left(\frac{n}{2}\right) + \Omicron(1)$$
 
 Para obtener la complejidad algorítmica, utilizo el método de expansión:
@@ -188,6 +191,7 @@ $$\Rightarrow\boxed{T(n) = \Omicron(log(n))}$$
 
 > 3. Un algoritmo suma los elementos de una lista de $n$ números dividiendo la
 >    lista en dos partes de igual tamaño. 
+>    \vspace{-0.25em}
 >    $$T(n) = 2T\left(\frac{n}{2}\right) + \Omicron(n)$$
 
 En este caso aplico el teorema maestro en caso de poder aplicarse primero y
diff --git a/guias/complejidad_algoritmica/respuestas.pdf b/guias/complejidad_algoritmica/respuestas.pdf
Binary files differ.
diff --git a/guias/complejidad_algoritmica/style.tex b/guias/complejidad_algoritmica/style.tex
@@ -8,11 +8,11 @@
 %             right=2.00cm,
 %             bmargin=2.50cm]{geometry}
 \usepackage[a4paper,
-            top=2.00cm,
-            left=1.70cm,
-            right=1.70cm,
+            top=2.25cm,
+            left=2.00cm,
+            right=2.00cm,
             bottom=2.00cm,
-            bmargin=1.75cm]{geometry}
+            bmargin=2.25cm]{geometry}
 
 \usepackage{titlesec}
 \usepackage{fontspec}
@@ -202,7 +202,7 @@ BoldFont        =   *-Bold,
     enhanced,
     breakable,
     size=minimal,
-    left=-4pt,
+    left=8pt,
     top=8pt,
     bottom=8pt,
     right=8pt,
@@ -226,7 +226,7 @@ BoldFont        =   *-Bold,
 \renewcommand*{\thempfootnote}{\ [\arabic{mpfootnote}]\ }
 
 % space between text and footer
-\setlength\footskip{25pt}
+\setlength\footskip{38pt}
 \setlength{\skip\footins}{12pt}
 
 % align first letter of all the lines in the footnotes
@@ -264,3 +264,17 @@ BoldFont        =   *-Bold,
 \AtEndDocument{
   \end{multicols*}
 }
+
+\usepackage{enumitem}
+
+\setlist[enumerate]{
+  leftmargin=0pt,     % no global indentation
+  labelindent=0pt,    % label aligned with margin
+  itemindent=5pt,     % no extra indent
+  labelwidth=0pt,     % label takes no reserved space
+  align=left          % make wrapped lines align with the left edge, not number
+}
+
+\usepackage[spanish]{babel}
+\binoppenalty=10000 
+\relpenalty=10000