SlideShare una empresa de Scribd logo
1 de 8
JORGE PARRADO
METODO INSERCION
HISTORIA
 Hacia 1952 se conocían suficientes
algoritmos: inserción, inserción
binaria, selección, burbuja, radix
sort, mezcla, . . .
 Se despierta el interés por su estudio
teórico. El análisis de la complejidad de los
algoritmos comienza con el estudio de los
algoritmos de ordenación.
FUNCIONAMIENTO
 El algoritmo consiste en realizar varias pasadas
sobre el array. En cada pasada se analiza un
elemento, y se intenta encontrar su orden relativo
entre los analizados en pasadas anteriores. Con
esto se logra ir manteniendo una lista ordenada
constantemente. Cada elemento a analizar se
desplaza por esa lista hasta encontrar su lugar.
Cuando todos los elementos del array han sido
analizados, la lista está completamente ordenada.
CARACTERÍSTICAS FUNDAMENTALES.
 La secuencia destino donde debe insertarse el
nuevo elemento ya esta ordenada.
 2.Búsqueda binaria para localizar el lugar de
inserción
 3. Desplazar elementos
 4.Insertar
DIAGRAMA DE FLUJO
SIMULACION
 1ª pasada: El primer elemento forma la lista ordenada, y vamos a ver qué hacemos con el segundo.
 45, 52, 21, 37, 49, 72, 14 → Comparamos 52 con el anterior. Como está en orden, paramos.
45, 52, 21, 37, 49, 72, 14 → 45 y 52 forman la lista ordenada ahora. (Sí, sí... están en orden entre
ellos 45<52)
 2ª pasada: Hay dos elementos en orden relativo entre ellos y vamos a ver qué hacemos con el
tercero.
 45, 52, 21, 37, 49, 72, 14 → Comparamos el 21 con el anterior (52). No están en orden, así que los
intercambiamos.
45, 21, 52, 37, 49, 72, 14 → Comparamos el 21 con el anterior (45). No están en orden, así que los
intercambiamos.
21, 45, 52, 37, 49, 72, 14 → Ya no hay más para comparar. El 21 está en su sitio con respecto a los
otros de la lista.
21, 45, 52, 37, 49, 72, 14 → Ahora 21, 45 y 52 forman la lista ordenada.
3ª pasada: Hay tres elementos en orden relativo entre ellos y vamos a ver qué hacemos con el
cuarto.
 21, 45, 52, 37, 49, 72, 14 → Comparamos el 37 con el anterior (52). No están en orden, así que los
intercambiamos.
21, 45, 37, 52, 49, 72, 14 → Comparamos el 37 con el anterior (45). No están en orden, así que los
intercambiamos.
21, 37, 45, 52, 49, 72, 14 → Comparamos el 37 con el anterior (21). Sí están en orden, así que
paramos.
21, 37, 45, 52, 49, 72, 14 → Ahora 21, 37, 45 y 52 forman la lista ordenada.
 4ª pasada: Hay cuatro elementos en orden relativo entre ellos y vamos a ver qué hacemos con el
quinto.
 21, 37, 45, 52, 49, 72, 14 → Comparamos el 49 con el anterior (52). No están en orden, así que los
intercambiamos.
21, 37, 45, 49, 52, 72, 14 → Comparamos el 49 con el anterior (45). sí están en orden, así que
paramos.
21, 37, 45, 49, 52, 72, 14 → Ahora 21, 37, 45, 49 y 52 forman la lista ordenada.
 5ª pasada: Hay cinco elementos en orden relativo entre ellos y vamos a ver
qué hacemos con el sexto.
 21, 37, 45, 49, 52, 72, 14 → Comparamos el 72 con el anterior (52). Sí
están en orden, así que paramos.
21, 37, 45, 49, 52, 72, 14 → Ahora 21, 37, 45, 49, 52 y 72 forman la lista
ordenada.
 6ª y última pasada: Hay seis elementos en orden relativo entre ellos y
vamos a ver qué hacemos con el séptimo.
 21, 37, 45, 49, 52, 72, 14 → Comparamos el 14 con el anterior (72). No
están en orden, así que los intercambiamos.
21, 37, 45, 49, 52, 14, 72 → Comparamos el 14 con el anterior (52). No
están en orden, así que los intercambiamos.
21, 37, 45, 49, 14, 52, 72 → Comparamos el 14 con el anterior (49). No
están en orden, así que los intercambiamos.
21, 37, 45, 14, 49, 52, 72 → Comparamos el 14 con el anterior (45). No
están en orden, así que los intercambiamos.
21, 37, 14, 45, 49, 52, 72 → Comparamos el 14 con el anterior (37). No
están en orden, así que los intercambiamos.
21, 14, 37, 45, 49, 52, 72 → Comparamos el 14 con el anterior (21). No
están en orden, así que los intercambiamos.
14, 21, 37, 45, 49, 52, 72 → Comparamos el 14 con el anterior (21). No
están en orden, así que los intercambiamos.
14, 21, 37, 45, 49, 52, 72 → Ya no hay más para comparar, así que el 14
está en su sitio.
 Ya no quedan elementos a anailizar al final del array, así que hemos
terminado y el array está ordenado
GRACIAS POR SU ATENCION…

Más contenido relacionado

Destacado

How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Applitools
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at WorkGetSmarter
 

Destacado (20)

How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 

Exposicion insercion

  • 2. HISTORIA  Hacia 1952 se conocían suficientes algoritmos: inserción, inserción binaria, selección, burbuja, radix sort, mezcla, . . .  Se despierta el interés por su estudio teórico. El análisis de la complejidad de los algoritmos comienza con el estudio de los algoritmos de ordenación.
  • 3. FUNCIONAMIENTO  El algoritmo consiste en realizar varias pasadas sobre el array. En cada pasada se analiza un elemento, y se intenta encontrar su orden relativo entre los analizados en pasadas anteriores. Con esto se logra ir manteniendo una lista ordenada constantemente. Cada elemento a analizar se desplaza por esa lista hasta encontrar su lugar. Cuando todos los elementos del array han sido analizados, la lista está completamente ordenada.
  • 4. CARACTERÍSTICAS FUNDAMENTALES.  La secuencia destino donde debe insertarse el nuevo elemento ya esta ordenada.  2.Búsqueda binaria para localizar el lugar de inserción  3. Desplazar elementos  4.Insertar
  • 6. SIMULACION  1ª pasada: El primer elemento forma la lista ordenada, y vamos a ver qué hacemos con el segundo.  45, 52, 21, 37, 49, 72, 14 → Comparamos 52 con el anterior. Como está en orden, paramos. 45, 52, 21, 37, 49, 72, 14 → 45 y 52 forman la lista ordenada ahora. (Sí, sí... están en orden entre ellos 45<52)  2ª pasada: Hay dos elementos en orden relativo entre ellos y vamos a ver qué hacemos con el tercero.  45, 52, 21, 37, 49, 72, 14 → Comparamos el 21 con el anterior (52). No están en orden, así que los intercambiamos. 45, 21, 52, 37, 49, 72, 14 → Comparamos el 21 con el anterior (45). No están en orden, así que los intercambiamos. 21, 45, 52, 37, 49, 72, 14 → Ya no hay más para comparar. El 21 está en su sitio con respecto a los otros de la lista. 21, 45, 52, 37, 49, 72, 14 → Ahora 21, 45 y 52 forman la lista ordenada. 3ª pasada: Hay tres elementos en orden relativo entre ellos y vamos a ver qué hacemos con el cuarto.  21, 45, 52, 37, 49, 72, 14 → Comparamos el 37 con el anterior (52). No están en orden, así que los intercambiamos. 21, 45, 37, 52, 49, 72, 14 → Comparamos el 37 con el anterior (45). No están en orden, así que los intercambiamos. 21, 37, 45, 52, 49, 72, 14 → Comparamos el 37 con el anterior (21). Sí están en orden, así que paramos. 21, 37, 45, 52, 49, 72, 14 → Ahora 21, 37, 45 y 52 forman la lista ordenada.  4ª pasada: Hay cuatro elementos en orden relativo entre ellos y vamos a ver qué hacemos con el quinto.  21, 37, 45, 52, 49, 72, 14 → Comparamos el 49 con el anterior (52). No están en orden, así que los intercambiamos. 21, 37, 45, 49, 52, 72, 14 → Comparamos el 49 con el anterior (45). sí están en orden, así que paramos. 21, 37, 45, 49, 52, 72, 14 → Ahora 21, 37, 45, 49 y 52 forman la lista ordenada.
  • 7.  5ª pasada: Hay cinco elementos en orden relativo entre ellos y vamos a ver qué hacemos con el sexto.  21, 37, 45, 49, 52, 72, 14 → Comparamos el 72 con el anterior (52). Sí están en orden, así que paramos. 21, 37, 45, 49, 52, 72, 14 → Ahora 21, 37, 45, 49, 52 y 72 forman la lista ordenada.  6ª y última pasada: Hay seis elementos en orden relativo entre ellos y vamos a ver qué hacemos con el séptimo.  21, 37, 45, 49, 52, 72, 14 → Comparamos el 14 con el anterior (72). No están en orden, así que los intercambiamos. 21, 37, 45, 49, 52, 14, 72 → Comparamos el 14 con el anterior (52). No están en orden, así que los intercambiamos. 21, 37, 45, 49, 14, 52, 72 → Comparamos el 14 con el anterior (49). No están en orden, así que los intercambiamos. 21, 37, 45, 14, 49, 52, 72 → Comparamos el 14 con el anterior (45). No están en orden, así que los intercambiamos. 21, 37, 14, 45, 49, 52, 72 → Comparamos el 14 con el anterior (37). No están en orden, así que los intercambiamos. 21, 14, 37, 45, 49, 52, 72 → Comparamos el 14 con el anterior (21). No están en orden, así que los intercambiamos. 14, 21, 37, 45, 49, 52, 72 → Comparamos el 14 con el anterior (21). No están en orden, así que los intercambiamos. 14, 21, 37, 45, 49, 52, 72 → Ya no hay más para comparar, así que el 14 está en su sitio.  Ya no quedan elementos a anailizar al final del array, así que hemos terminado y el array está ordenado
  • 8. GRACIAS POR SU ATENCION…