lunes, 31 de octubre de 2011

Analysis Algorithm

An algorithm is a finite set of unambiguous and effective instructions that indicate how to solve a problem, produce at least one outlet, receive zero or more inputs and to run, require a finite amount of resources.
The selection criteria are defined by CPU time, this implies that the program will be more efficient is faster.

For example Quicksort



In this case the strategy is to take an item and put in a pivotal part to the minor elements to the pivot and the other to those over the pivot. After recursive calls are made to order both parties. In this case also takes advantage of the fact that an array of size 1 isalready sorted.
The algorithm that starts the settlement into two parts (not equal) is defined in the algorithm 21. This algorithm part of the settlement into two parts using the first array element as a pivot.

In this case using the asymptotic analysis, we define:

Size of the problem: The array size
Basic Operation: Comparisons
To make the temporal analysis we noticed that the partitionalgorithm performs n comparisons. Informally this is because the pivot is compared against all array elements. We analyze each case quicksort.
Worst Case: Occurs when the pivot is the first element
Best case: The pivot is exactly half
In this case the array is divided into two parts of equal size.Assuming that n = 2k each party will have a size 2k 1 (for the pivot is now in order.)







Bibliography

- Thomas H. Cormen , Introduction to Algorithms, Mc Graw Hill, 2000
- Harel D., Algorithmics The Spirit of Computing, Addison Wesley, Segunda Edición, 1992
- Horowitz E., S. Sahni, Fundamentals of Computer Algorithms, Potomac, Maryland: Computer Science Press, Inc, 1978

1 comentario:

  1. Llegas a la pura introducción al tema, pero en realidad no provees el análisis del algoritmo ejemplo quicksort. Además el copy-paste de esta entrada es medio malo: "The algorithm that starts the settlement into two parts (not equal) is defined in the algorithm 21." ¿Cuál algorithm 21? No les voy a estar dando puntos por cualquier cosa que se les ocurra subir, en particular si no está ni bien hecha ni completa ni un trabajo propio suyo.

    ResponderEliminar