Understanding Sorting
In a sense the language sorting is sorting or choosing their. On the structure of data Sorting is sebuahmetode for data sorting, for example from the largest data to the smallest details. By means of the program should be able to compare between the data in the inputkan.
Meaning if there is a row of data, then the first will compare the data with the data. If
the data is larger than the data in the second and first data will
exchange position with the second data, so on until completely sorted
data from largest to smallest.
Sorting method very much and there is growing
· Bubble sort
· Selection Sort
· Insertion sort
· Merge sort
· Quick sort.
· etc.
1. Understanding the method Bubbel Sort
Bubble
sort (bubble method) is a method of sorting algorithms or by exchanging
data with the project if the data before it is greater than the data
afterwards continuously until it could be ascertained in a specific
iteration no more changes, or has been properly sorted. If there is no change means data is already sorted. Bubble sort is called for each key or data will slowly bubbled or membandingan the data into the right position.
This
method is easy to understand and programmed, but when compared to the
other methods we learned, this method is the least efficient method
because it has a lot of pertukara that require allocating memory to
execute this method.
2. Understanding methods of Selection Sort
Selection of different Sort with Bubble sort. Selection
Sort is basically choose the data to be sorted into two parts, namely
the various already sorted and parts which have not been in order.
The first step is look for the smallest of data first data until the last data. Then the smallest data exchanged with the data first. Thus, the first data now has the most small value compared to other data. The second step, the smallest us data search starting from the second to the last data. The smallest Data we gain data exchanged with the second and so on until all the elements in a State of terurutkan. This method is more effective than the bubble method because it does not require a lot of exchanges and of allocating memory.
3. Merge Sort
Understanding
the Merge Sort algorithm is being run as a result of too many lists
that are sorted, by producing more sorted lists as output. This merge algorithm adapted for tape drives. Its
use in the random access memory of associated has declined, because of
the many applications that merge algorithms have faster alternative when
you have random access memory which keeps all data. This
is because the algorithm is memory space or need at least twice as big
as it is performed recursively and put on two tables.
The merge sort algorithm to divide the table into two tables the same. Each table is sorted recursively, and then merged again to form a sorted table. Basic
implementation of merge sort algorithm uses three tables, two to store
an element of a table that has been in for two and one to store elements
that have been ordered. However, this algorithm can also be performed directly on two tables, thus saving space or memory required.
Merge algorithms generally have a set of pointers p0.n that points to a position in a set of lists L0.n. At first they point to the first item in each list. The following algorithms:
As long as p0.n still point to data in as a substitute in the end:
1. do something with data items that point to their own list.
2. find the pointers points to the item with the lowest key
4. Quick Sort
Pengerian
Quick Sort algorithm is being run as a result of too many lists that
are sorted, by producing more sorted lists as output. This merge algorithm adapted for tape drives. Its
use in the random access memory of associated has declined, because of
the many applications that merge algorithms have faster alternative when
you have random access memory which keeps all data. This
is because the algorithm is memory space or need at least twice as big
as it is performed recursively and put on two tables.
The merge sort algorithm to divide the table into two tables the same. Each table is sorted recursively, and then merged again to form a sorted table. Basic
implementation of merge sort algorithm uses three tables, two to store
an element of a table that has been in for two and one to store elements
that have been ordered. However, this algorithm can also be performed directly on two tables, thus saving space or memory required.
Merge algorithms generally have a set of pointers p0.n that points to a position in a set of lists L0.n. At first they point to the first item in each list. The following algorithms:
As long as p0.n still point to data in as a substitute in the end:
1. do something with data items that point to their own list.
2. find the pointers points to the item with the lowest key; helps one pointer to the next item in the list.
In General, the merge algorithm runs in time proportional to the sum of the length of the list; The
merge algorithm operates in large numbers in the list that will soon
multiply the sum of the length of the list at that time to output the
image points which pointers point to the lowest item, which can be
influenced by a heap (heap) based priority queue in O (lg n) time to O
(lg n) time (where n is the number on the list combined, m is the sum of the length of the list, and lg is log base 2). When combining the length m of two lists, there is a comparison of a lower jump 2 m-1 's in the worst case.
Output data item classic Merge (the one used in the merge sort)
0 comments:
Post a Comment