SlideShare una empresa de Scribd logo
Programación en C 34
Ordenación por selección
• En éste método, en el i-ésimo paso seleccionamos el
elemento con la llave de menor valor, entre a[i],…,
a[n] y lo intercambiamos con a[i].
• Como resultado, después de i pasadas, el i-ésimo
elemento menor ocupará a[1],…, a[i] en el lugar
ordenado.
• La complejidad del algoritmo es O(n2).
Programación en C 35
Ordenación por selección
7
6
5
4
3
2
1
Or
12
12
42
42
67
44
18
94
55
06
67
06
18
94
55
44
Programación en C 36
Ordenación por selección
7
6
5
4
3
2
1
Or
55
12
12
42
42
42
67
44
18
94
12
06
67
44
18
94
55
06
67
06
18
94
55
44
Programación en C 37
Ordenación por selección
7
6
5
4
3
2
1
Or
18
55
12
12
42
42
42
42
67
44
55
94
12
06
67
44
18
94
12
06
67
44
18
94
55
06
67
06
18
94
55
44
Programación en C 38
Ordenación por selección
7
6
5
4
3
2
1
Or
18
18
55
12
12
42
42
42
42
42
67
44
55
94
12
06
67
44
55
94
12
06
67
44
18
94
12
06
67
44
18
94
55
06
67
06
18
94
55
44
Programación en C 39
Ordenación por selección
7
6
5
4
3
2
1
Or
18
18
18
55
12
12
42
42
42
42
42
42
67
94
55
44
12
06
67
44
55
94
12
06
67
44
55
94
12
06
67
44
18
94
12
06
67
44
18
94
55
06
67
06
18
94
55
44
Programación en C 40
Ordenación por selección
7
6
5
4
3
2
1
Or
18
18
18
18
55
12
12
42
42
42
42
42
42
42
67
94
55
44
12
06
67
94
55
44
12
06
67
44
55
94
12
06
67
44
55
94
12
06
67
44
18
94
12
06
67
44
18
94
55
06
67
06
18
94
55
44
Programación en C 41
Ordenación por selección
7
6
5
4
3
2
1
Or
18
18
18
18
18
55
12
12
42
42
42
42
42
42
42
42
67
94
55
44
12
06
67
94
55
44
12
06
94
67
55
44
12
06
67
44
55
94
12
06
67
44
55
94
12
06
67
44
18
94
12
06
67
44
18
94
55
06
67
06
18
94
55
44
Programación en C 42
/************************************************************************
* Programa: ord_seleccion.c *
* Descripción: Programa que ordena un array mediante el metodo seleccion *
* Autor: Pedro Corcuera *
* Revisión: 1.0 2/02/2008 *
************************************************************************/
#include <stdio.h>
main()
{
float t,a[]={10.0,8.0,5.5,3.4,3.2,2.5,2.2,1.5};
int i,j,k,n;
n = sizeof(a)/sizeof (float);
for(i = 0; i < n-1; i++)
{
k = i; t = a[i];
for (j = i+1; j < n; j++)
{
if (a[j] < t)
{ t = a[j]; k = j;
}
a[k] = a[i]; a[i] = t;
}
}
for(i = 0; i < n; i++)
printf("%d %10.2f n",i,a[i]);
}
Ordenación por selección: código

Más contenido relacionado

Último

PLANIFICACION INDUSTRIAL ( Gantt-Pert-CPM ).docx
PLANIFICACION INDUSTRIAL ( Gantt-Pert-CPM ).docxPLANIFICACION INDUSTRIAL ( Gantt-Pert-CPM ).docx
PLANIFICACION INDUSTRIAL ( Gantt-Pert-CPM ).docx
Victor Manuel Rivera Guevara
 
TR-514 (3) - BIS copia seguridad DOS COLUMNAS 2024 1.6.24 PREFERIDO.wbk.wbk S...
TR-514 (3) - BIS copia seguridad DOS COLUMNAS 2024 1.6.24 PREFERIDO.wbk.wbk S...TR-514 (3) - BIS copia seguridad DOS COLUMNAS 2024 1.6.24 PREFERIDO.wbk.wbk S...
TR-514 (3) - BIS copia seguridad DOS COLUMNAS 2024 1.6.24 PREFERIDO.wbk.wbk S...
FRANCISCOJUSTOSIERRA
 
Ciclo de Otto. Máquinas térmicas para el estudio de la termodinámica química
Ciclo de Otto. Máquinas térmicas para el estudio de la termodinámica químicaCiclo de Otto. Máquinas térmicas para el estudio de la termodinámica química
Ciclo de Otto. Máquinas térmicas para el estudio de la termodinámica química
ycalful01
 
Distribución Muestral de Diferencia de Medias
Distribución Muestral de Diferencia de MediasDistribución Muestral de Diferencia de Medias
Distribución Muestral de Diferencia de Medias
arielemelec005
 
NORMATIVA AMERICANA ASME B30.5-2021 ESPAÑOL
NORMATIVA AMERICANA ASME B30.5-2021 ESPAÑOLNORMATIVA AMERICANA ASME B30.5-2021 ESPAÑOL
NORMATIVA AMERICANA ASME B30.5-2021 ESPAÑOL
Pol Peña Quispe
 
IMPORTANCIA DE LOS LIPIDOS EN FARMACIA.pdf
IMPORTANCIA DE LOS LIPIDOS EN FARMACIA.pdfIMPORTANCIA DE LOS LIPIDOS EN FARMACIA.pdf
IMPORTANCIA DE LOS LIPIDOS EN FARMACIA.pdf
JonathanFernandoRodr
 
Becas de UOC _ Caja Ingenieros 2024-25.pdf
Becas de UOC _ Caja Ingenieros 2024-25.pdfBecas de UOC _ Caja Ingenieros 2024-25.pdf
Becas de UOC _ Caja Ingenieros 2024-25.pdf
UOC Estudios de Informática, Multimedia y Telecomunicación
 
tema-6.4-calculo-de-la-potencia-requerida-para-transporte-de-solidos-.pptx
tema-6.4-calculo-de-la-potencia-requerida-para-transporte-de-solidos-.pptxtema-6.4-calculo-de-la-potencia-requerida-para-transporte-de-solidos-.pptx
tema-6.4-calculo-de-la-potencia-requerida-para-transporte-de-solidos-.pptx
DianaSG6
 
Plan de Desarrollo Urbano de la Municipalidad Provincial de Ilo
Plan de Desarrollo Urbano de la Municipalidad Provincial de IloPlan de Desarrollo Urbano de la Municipalidad Provincial de Ilo
Plan de Desarrollo Urbano de la Municipalidad Provincial de Ilo
AlbertoRiveraPrado
 
Joseph juran aportaciones al control de la calidad
Joseph juran aportaciones al control de la calidadJoseph juran aportaciones al control de la calidad
Joseph juran aportaciones al control de la calidad
KevinCabrera96
 
TEMA 11. FLUIDOS-HIDROSTATICA.TEORIApptx
TEMA 11.  FLUIDOS-HIDROSTATICA.TEORIApptxTEMA 11.  FLUIDOS-HIDROSTATICA.TEORIApptx
TEMA 11. FLUIDOS-HIDROSTATICA.TEORIApptx
maitecuba2006
 
CODIGO DE SEÑALES Y COLORES NTP399 - ANEXO 17 DS 024
CODIGO DE SEÑALES Y COLORES NTP399 - ANEXO 17 DS 024CODIGO DE SEÑALES Y COLORES NTP399 - ANEXO 17 DS 024
CODIGO DE SEÑALES Y COLORES NTP399 - ANEXO 17 DS 024
JuanChaparro49
 
monografia sobre puentes 1234456785432o5
monografia sobre puentes 1234456785432o5monografia sobre puentes 1234456785432o5
monografia sobre puentes 1234456785432o5
garciacordovadiuler
 
FISICA_Hidrostatica_uyhHidrodinamica.pdf
FISICA_Hidrostatica_uyhHidrodinamica.pdfFISICA_Hidrostatica_uyhHidrodinamica.pdf
FISICA_Hidrostatica_uyhHidrodinamica.pdf
JavierAlejosM
 
Diagrama de flujo "Resolución de problemas".pdf
Diagrama de flujo "Resolución de problemas".pdfDiagrama de flujo "Resolución de problemas".pdf
Diagrama de flujo "Resolución de problemas".pdf
joseabachesoto
 
Flujograma de gestión de pedidos de usuarios.
Flujograma de gestión de pedidos de usuarios.Flujograma de gestión de pedidos de usuarios.
Flujograma de gestión de pedidos de usuarios.
thatycameron2004
 
Vehiculo para niños con paralisis cerebral
Vehiculo para niños con paralisis cerebralVehiculo para niños con paralisis cerebral
Vehiculo para niños con paralisis cerebral
everchanging2020
 
Seguridad en mineria los Controles criticos
Seguridad en mineria los Controles criticosSeguridad en mineria los Controles criticos
Seguridad en mineria los Controles criticos
Melvin191754
 
ANÁLISIS MASAS PATRIMONIALES y financieros
ANÁLISIS MASAS PATRIMONIALES y financierosANÁLISIS MASAS PATRIMONIALES y financieros
ANÁLISIS MASAS PATRIMONIALES y financieros
Daniel Gonzalez
 
01-introduccion-a-la-perforacion.pdf de minas
01-introduccion-a-la-perforacion.pdf de minas01-introduccion-a-la-perforacion.pdf de minas
01-introduccion-a-la-perforacion.pdf de minas
ivan848686
 

Último (20)

PLANIFICACION INDUSTRIAL ( Gantt-Pert-CPM ).docx
PLANIFICACION INDUSTRIAL ( Gantt-Pert-CPM ).docxPLANIFICACION INDUSTRIAL ( Gantt-Pert-CPM ).docx
PLANIFICACION INDUSTRIAL ( Gantt-Pert-CPM ).docx
 
TR-514 (3) - BIS copia seguridad DOS COLUMNAS 2024 1.6.24 PREFERIDO.wbk.wbk S...
TR-514 (3) - BIS copia seguridad DOS COLUMNAS 2024 1.6.24 PREFERIDO.wbk.wbk S...TR-514 (3) - BIS copia seguridad DOS COLUMNAS 2024 1.6.24 PREFERIDO.wbk.wbk S...
TR-514 (3) - BIS copia seguridad DOS COLUMNAS 2024 1.6.24 PREFERIDO.wbk.wbk S...
 
Ciclo de Otto. Máquinas térmicas para el estudio de la termodinámica química
Ciclo de Otto. Máquinas térmicas para el estudio de la termodinámica químicaCiclo de Otto. Máquinas térmicas para el estudio de la termodinámica química
Ciclo de Otto. Máquinas térmicas para el estudio de la termodinámica química
 
Distribución Muestral de Diferencia de Medias
Distribución Muestral de Diferencia de MediasDistribución Muestral de Diferencia de Medias
Distribución Muestral de Diferencia de Medias
 
NORMATIVA AMERICANA ASME B30.5-2021 ESPAÑOL
NORMATIVA AMERICANA ASME B30.5-2021 ESPAÑOLNORMATIVA AMERICANA ASME B30.5-2021 ESPAÑOL
NORMATIVA AMERICANA ASME B30.5-2021 ESPAÑOL
 
IMPORTANCIA DE LOS LIPIDOS EN FARMACIA.pdf
IMPORTANCIA DE LOS LIPIDOS EN FARMACIA.pdfIMPORTANCIA DE LOS LIPIDOS EN FARMACIA.pdf
IMPORTANCIA DE LOS LIPIDOS EN FARMACIA.pdf
 
Becas de UOC _ Caja Ingenieros 2024-25.pdf
Becas de UOC _ Caja Ingenieros 2024-25.pdfBecas de UOC _ Caja Ingenieros 2024-25.pdf
Becas de UOC _ Caja Ingenieros 2024-25.pdf
 
tema-6.4-calculo-de-la-potencia-requerida-para-transporte-de-solidos-.pptx
tema-6.4-calculo-de-la-potencia-requerida-para-transporte-de-solidos-.pptxtema-6.4-calculo-de-la-potencia-requerida-para-transporte-de-solidos-.pptx
tema-6.4-calculo-de-la-potencia-requerida-para-transporte-de-solidos-.pptx
 
Plan de Desarrollo Urbano de la Municipalidad Provincial de Ilo
Plan de Desarrollo Urbano de la Municipalidad Provincial de IloPlan de Desarrollo Urbano de la Municipalidad Provincial de Ilo
Plan de Desarrollo Urbano de la Municipalidad Provincial de Ilo
 
Joseph juran aportaciones al control de la calidad
Joseph juran aportaciones al control de la calidadJoseph juran aportaciones al control de la calidad
Joseph juran aportaciones al control de la calidad
 
TEMA 11. FLUIDOS-HIDROSTATICA.TEORIApptx
TEMA 11.  FLUIDOS-HIDROSTATICA.TEORIApptxTEMA 11.  FLUIDOS-HIDROSTATICA.TEORIApptx
TEMA 11. FLUIDOS-HIDROSTATICA.TEORIApptx
 
CODIGO DE SEÑALES Y COLORES NTP399 - ANEXO 17 DS 024
CODIGO DE SEÑALES Y COLORES NTP399 - ANEXO 17 DS 024CODIGO DE SEÑALES Y COLORES NTP399 - ANEXO 17 DS 024
CODIGO DE SEÑALES Y COLORES NTP399 - ANEXO 17 DS 024
 
monografia sobre puentes 1234456785432o5
monografia sobre puentes 1234456785432o5monografia sobre puentes 1234456785432o5
monografia sobre puentes 1234456785432o5
 
FISICA_Hidrostatica_uyhHidrodinamica.pdf
FISICA_Hidrostatica_uyhHidrodinamica.pdfFISICA_Hidrostatica_uyhHidrodinamica.pdf
FISICA_Hidrostatica_uyhHidrodinamica.pdf
 
Diagrama de flujo "Resolución de problemas".pdf
Diagrama de flujo "Resolución de problemas".pdfDiagrama de flujo "Resolución de problemas".pdf
Diagrama de flujo "Resolución de problemas".pdf
 
Flujograma de gestión de pedidos de usuarios.
Flujograma de gestión de pedidos de usuarios.Flujograma de gestión de pedidos de usuarios.
Flujograma de gestión de pedidos de usuarios.
 
Vehiculo para niños con paralisis cerebral
Vehiculo para niños con paralisis cerebralVehiculo para niños con paralisis cerebral
Vehiculo para niños con paralisis cerebral
 
Seguridad en mineria los Controles criticos
Seguridad en mineria los Controles criticosSeguridad en mineria los Controles criticos
Seguridad en mineria los Controles criticos
 
ANÁLISIS MASAS PATRIMONIALES y financieros
ANÁLISIS MASAS PATRIMONIALES y financierosANÁLISIS MASAS PATRIMONIALES y financieros
ANÁLISIS MASAS PATRIMONIALES y financieros
 
01-introduccion-a-la-perforacion.pdf de minas
01-introduccion-a-la-perforacion.pdf de minas01-introduccion-a-la-perforacion.pdf de minas
01-introduccion-a-la-perforacion.pdf de minas
 

Destacado

Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
Skeleton Technologies
 
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
Neil 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 2024
Albert 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 Insights
Kurio // 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 2024
Search 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 summary
SpeakerHub
 
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 Intent
Lily Ray
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
Rajiv Jayarajah, MAppComm, ACC
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
Christy Abraham Joy
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
Vit 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 management
MindGenius
 
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 Work
GetSmarter
 
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike RoutesMore than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
Project for Public Spaces & National Center for Biking and Walking
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
DevGAMM Conference
 

Destacado (20)

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
 
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike RoutesMore than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
 

algortimo de seleccion.pdf

  • 1. Programación en C 34 Ordenación por selección • En éste método, en el i-ésimo paso seleccionamos el elemento con la llave de menor valor, entre a[i],…, a[n] y lo intercambiamos con a[i]. • Como resultado, después de i pasadas, el i-ésimo elemento menor ocupará a[1],…, a[i] en el lugar ordenado. • La complejidad del algoritmo es O(n2).
  • 2. Programación en C 35 Ordenación por selección 7 6 5 4 3 2 1 Or 12 12 42 42 67 44 18 94 55 06 67 06 18 94 55 44
  • 3. Programación en C 36 Ordenación por selección 7 6 5 4 3 2 1 Or 55 12 12 42 42 42 67 44 18 94 12 06 67 44 18 94 55 06 67 06 18 94 55 44
  • 4. Programación en C 37 Ordenación por selección 7 6 5 4 3 2 1 Or 18 55 12 12 42 42 42 42 67 44 55 94 12 06 67 44 18 94 12 06 67 44 18 94 55 06 67 06 18 94 55 44
  • 5. Programación en C 38 Ordenación por selección 7 6 5 4 3 2 1 Or 18 18 55 12 12 42 42 42 42 42 67 44 55 94 12 06 67 44 55 94 12 06 67 44 18 94 12 06 67 44 18 94 55 06 67 06 18 94 55 44
  • 6. Programación en C 39 Ordenación por selección 7 6 5 4 3 2 1 Or 18 18 18 55 12 12 42 42 42 42 42 42 67 94 55 44 12 06 67 44 55 94 12 06 67 44 55 94 12 06 67 44 18 94 12 06 67 44 18 94 55 06 67 06 18 94 55 44
  • 7. Programación en C 40 Ordenación por selección 7 6 5 4 3 2 1 Or 18 18 18 18 55 12 12 42 42 42 42 42 42 42 67 94 55 44 12 06 67 94 55 44 12 06 67 44 55 94 12 06 67 44 55 94 12 06 67 44 18 94 12 06 67 44 18 94 55 06 67 06 18 94 55 44
  • 8. Programación en C 41 Ordenación por selección 7 6 5 4 3 2 1 Or 18 18 18 18 18 55 12 12 42 42 42 42 42 42 42 42 67 94 55 44 12 06 67 94 55 44 12 06 94 67 55 44 12 06 67 44 55 94 12 06 67 44 55 94 12 06 67 44 18 94 12 06 67 44 18 94 55 06 67 06 18 94 55 44
  • 9. Programación en C 42 /************************************************************************ * Programa: ord_seleccion.c * * Descripción: Programa que ordena un array mediante el metodo seleccion * * Autor: Pedro Corcuera * * Revisión: 1.0 2/02/2008 * ************************************************************************/ #include <stdio.h> main() { float t,a[]={10.0,8.0,5.5,3.4,3.2,2.5,2.2,1.5}; int i,j,k,n; n = sizeof(a)/sizeof (float); for(i = 0; i < n-1; i++) { k = i; t = a[i]; for (j = i+1; j < n; j++) { if (a[j] < t) { t = a[j]; k = j; } a[k] = a[i]; a[i] = t; } } for(i = 0; i < n; i++) printf("%d %10.2f n",i,a[i]); } Ordenación por selección: código