BITácora de Software: divide y vencerás

Bitacora de software: Programación web, programación de escritorio, programación de servicios, configuración de servidores, IIS, lenguajes de programación C++, C#, PHP, trinity core, unity, jquery, arduino, etc.

 

Mostrando entradas con la etiqueta divide y vencerás. Mostrar todas las entradas
Mostrando entradas con la etiqueta divide y vencerás. Mostrar todas las entradas

jueves, 30 de marzo de 2017

[C++] Algoritmo de ordenamiento por mezcla - Merge Sort

marzo 30, 2017 0
[C++] Algoritmo de ordenamiento por mezcla - Merge Sort

El algoritmo de ordenamiento por mezcla (merge sort en inglés) es un algoritmo de ordenamiento externo estable basado en la técnica divide y vencerás. Es de complejidad O(n log n), fue desarrollado en 1945 por John Von Neumann

In computer science, merge sort (also commonly spelled mergesort) is an efficient, general-purpose, comparison-based sorting algorithm. Most implementations produce a stable sort, which means that the implementation preserves the input order of equal elements in the sorted output. Mergesort is a divide and conquer algorithm that was invented by John von Neumann in 1945. A detailed description and analysis of bottom-up mergesort appeared in a report by Goldstine and Neumann as early as 1948.

[C++] Busqueda Ternaria - Divide y Vencerás

marzo 30, 2017 0
[C++] Busqueda Ternaria - Divide y Vencerás

Podemos plantearnos también diseñar un algoritmo de búsqueda “ternaria”, que primero compara con el elemento en posición n/3 del vector, si éste es menor que el elemento x a buscar entonces compara con el elemento en posición 2n/3, y si no coincide con x busca recursivamente en el correspondiente subvector de tamaño 1/3 del original. ¿Conseguimos así un algoritmo mejor que el de búsqueda binaria?
We may also consider designing a "ternary" search algorithm, which First compared to the element in position n / 3 of the vector, if this is less The element x to look for and compare with the element in position 2n / 3, and if not Match recursively searching for the corresponding 1/3 size subvector From the original. Did we get a better algorithm than binary search?

sábado, 18 de febrero de 2017

[C++] Quicksort

febrero 18, 2017 0
[C++] Quicksort
El ordenamiento rápido (quicksort en inglés) es un algoritmo creado por el científico británico en computación C. A. R. Hoare, basado en la técnica de divide y vencerás, que permite, en promedio, ordenar n elementos en un tiempo proporcional a n log n.
Quicksort (sometimes called partition-exchange sort) is an efficient sorting algorithm, serving as a systematic method for placing the elements of an array in order. Developed by Tony Hoare in 1959, with his work published in 1961, it is still a commonly used algorithm for sorting. When implemented well, it can be about two or three times faster than its main competitors, merge sort and heapsort.