AI EducademyAIEducademy
🌳

Fundamentos de IA

🌱
AI Seeds

Empieza desde cero

🌿
AI Sprouts

Construye bases

🌳
AI Branches

Aplica en la práctica

🏕️
AI Canopy

Profundiza

🌲
AI Forest

Domina la IA

🔨

Maestría en IA

✏️
AI Sketch

Empieza desde cero

🪨
AI Chisel

Construye bases

⚒️
AI Craft

Aplica en la práctica

💎
AI Polish

Profundiza

🏆
AI Masterpiece

Domina la IA

🚀

Preparación Profesional

🚀
Plataforma de Entrevistas

Comienza tu camino

🌟
Dominio Conductual

Domina las habilidades blandas

💻
Entrevistas Técnicas

Supera la ronda de código

🤖
Entrevistas de IA y ML

Dominio en entrevistas de ML

🏆
Oferta y Más Allá

Consigue la mejor oferta

Ver Todos los Programas→

Laboratorio

7 experimentos cargados
🧠Playground de Red Neuronal🤖¿IA o Humano?💬Laboratorio de Prompts🎨Generador de Imágenes😊Analizador de Sentimiento💡Constructor de Chatbots⚖️Simulador de Ética
🎯Entrevista simuladaEntrar al Laboratorio→
ViajeBlog
🎯
Acerca de

Hacer la educación en IA accesible para todos, en todas partes

❓
Preguntas Frecuentes

Common questions answered

✉️
Contact

Get in touch with us

⭐
Open Source

Construido de forma abierta en GitHub

Empezar
AI EducademyAIEducademy

Licencia MIT. Open Source

Aprender

  • Académicos
  • Lecciones
  • Laboratorio

Comunidad

  • GitHub
  • Contribuir
  • Código de Conducta
  • Acerca de
  • Preguntas Frecuentes

Soporte

  • Invítame a un Café ☕
  • Términos de Servicio
  • Política de Privacidad
  • Contacto
Académicos de IA e Ingeniería›🌿 AI Sprouts›Lecciones›Algoritmos Explicados
📝
AI Sprouts • Principiante⏱️ 15 min de lectura

Algoritmos Explicados

Algorithms Explained

In the previous lesson, you learned that data is the fuel for AI. But fuel alone does not move a car - you need an engine. In AI, that engine is an algorithm. Every time an AI system makes a prediction, recommends a video, or detects spam, an algorithm is doing the heavy lifting behind the scenes.

What Is an Algorithm?

An algorithm is simply a step-by-step set of instructions for solving a problem. You follow algorithms every day without realising it.

  • A recipe is an algorithm: combine ingredients in a specific order to produce a cake.
  • Flat-pack furniture instructions are an algorithm: follow each step to build a bookshelf.
  • Driving directions are an algorithm: turn left, go straight, turn right, arrive.

The key idea is that an algorithm must be precise, ordered, and repeatable - anyone following the same steps should get the same result.

A flowchart showing a simple decision algorithm: Is it raining? If yes, take an umbrella. If no, wear sunglasses.
An algorithm is a clear set of instructions - like a flowchart that guides you to a decision.
🤯

The word "algorithm" comes from the name of a 9th-century Persian mathematician, Muhammad ibn Musa al-Khwarizmi, who wrote one of the first books on systematic problem-solving.

Everyday Algorithm Examples

Before we dive into AI, let us look at two simple algorithms you already understand intuitively.

Sorting a Hand of Cards

When you pick up a hand of playing cards and arrange them in order, you are running a sorting algorithm:

  1. Look at the first two cards. Swap them if they are out of order.
  2. Move to the next pair. Compare and swap again.
  3. Repeat until the entire hand is sorted.

This is essentially how bubble sort works - one of the simplest sorting algorithms in computer science.

Finding a Word in a Dictionary

You do not start at page one and read every word. Instead, you:

  1. Open the dictionary roughly in the middle.
  2. Check if the word you need comes before or after that page.
Lección 2 de 160% completado
←Cómo los Datos Impulsan la IA

Discussion

Sign in to join the discussion

Sugerir una edición a esta lección
  • Discard the half you do not need and repeat.
  • This is called binary search, and it is incredibly efficient. It can find any word among a million entries in about 20 steps.

    🧠Verificación Rápida

    Why is binary search faster than reading every entry from the start?

    How Algorithms Power AI

    AI algorithms are more sophisticated than sorting cards, but the principle is the same: follow structured steps to reach an answer. Here are two foundational AI algorithms.

    Decision Trees

    A decision tree asks a series of yes-or-no questions to classify something.

    Example - Is this email spam?

    1. Does the subject line contain "FREE MONEY"? → If yes, likely spam.
    2. Is the sender in your contacts? → If yes, probably not spam.
    3. Does it contain more than five links? → If yes, lean towards spam.

    Each question is a branch, and each final answer is a leaf. Decision trees are easy to understand, which makes them popular when humans need to explain the AI's reasoning.

    K-Nearest Neighbours (KNN)

    KNN classifies something by looking at the closest examples it has already seen.

    Imagine you move to a new neighbourhood and want to know if a house is expensive or affordable. You look at the five nearest houses (your "neighbours") and check their prices. If most are expensive, you predict yours is too.

    KNN works exactly the same way with data points - it finds the K closest examples and takes a vote.

    🤔
    Think about it:

    If you asked three friends for a film recommendation and two of them suggested the same film, you would probably watch that one. That is the core idea behind KNN - majority rules among your nearest neighbours.

    🧠Verificación Rápida

    In a K-Nearest Neighbours algorithm with K=5, how does the model make its prediction?

    Big O Notation: Fast vs Slow Algorithms

    Not all algorithms are equally fast. Computer scientists use Big O notation to describe how an algorithm's speed changes as the data grows.

    | Notation | Name | Example | Speed | |----------|------|---------|-------| | O(1) | Constant | Looking up a value by index | ⚡ Instant | | O(log n) | Logarithmic | Binary search | 🚀 Very fast | | O(n) | Linear | Reading every item in a list | 🏃 Decent | | O(n²) | Quadratic | Comparing every item to every other | 🐢 Slow |

    You do not need to memorise the maths. The key insight is this: as your dataset grows, a poorly chosen algorithm can go from fast to impossibly slow.

    🤯

    Google processes over 8.5 billion searches per day. If their search algorithm were O(n²) instead of highly optimised, a single search could take hours instead of milliseconds.

    💡

    Big O notation is not about exact speed - it is about how speed scales. An O(n) algorithm might be slow on tiny data but will always outperform an O(n²) algorithm as the dataset grows large.

    Why Choosing the Right Algorithm Matters

    There is no single "best" algorithm. The right choice depends on:

    • The problem type - Are you classifying images or predicting numbers?
    • The data size - Some algorithms struggle with millions of rows.
    • Explainability needs - Can you use a black box, or must you explain every decision?
    • Speed requirements - Does the answer need to arrive in milliseconds or can it take minutes?

    A decision tree might be perfect for a simple loan approval system where transparency is required. But for recognising objects in a photo, you would need a neural network - which we will explore in the next lesson.

    🤔
    Think about it:

    A hospital needs an AI to help diagnose patients. Should they choose an algorithm that is highly accurate but impossible to explain, or one that is slightly less accurate but shows its reasoning clearly? What are the trade-offs?

    🧠Verificación Rápida

    Which factor is LEAST important when choosing an AI algorithm?

    Key Takeaways

    • An algorithm is a step-by-step set of instructions for solving a problem.
    • Decision trees classify by asking sequential yes/no questions.
    • K-Nearest Neighbours classifies by looking at the closest known examples.
    • Big O notation tells us how an algorithm's speed scales with data size.
    • Choosing the right algorithm depends on the problem, data, and constraints.

    Next, we will look at the most powerful family of algorithms in modern AI: neural networks.