• Pada Algoritma pencarian banyak yang bisa kita temukan atau gunakan. Ada Merge Sort, Quick Sort, Bubble Sort, dan...
  • Pada dasarnya algoritma searching banyak kita jumpai. Apalagi hanya untuk mencari nilai minimum dan nilai maximum...
  • Kalian pasti sudah tahu apa itu Deret Fibonacci, ya benar. (Padahal gak jawab). Tetapi pada pembahasan kali ini kita akan membuar program...
  • Metoda Pencarian Biner ( Binary Search) hanya bisa diterapkan jika data array sudah terurut. Pengurutan Array bisa menggunakan jenis sorting ...
  • Salah satu contoh tipe algoritma brute force lainnya adalah linear search (pencarian berurutan), Dikatakan demikian karena algoritma ini menggunakan ...

Thursday, May 19, 2011

Array : Reversing Array Element (Membalik Elemen Array)

Arrays are data structures that contain data types that have the same type. Arrays are also a bunch of memory-related (contiguous). Arrays have the same name and type. To refer to a particular location or element in the array à + name of the array index.

Arary following illustration
Array name
c[1]
-45
c[2]
6
c[3]
0
c[4]
72
c[5]
1543
     Position number
Upon the memory we can modify it so that we can reverse the order of elements or numbers included in the array elements.

In the program we could use the swap, namely the exchange of array elements. For example:

Now how to implement into the programming language. We simply change the value element of an array. Ie having a smaller element is converted into a larger and elements that have a larger element is converted into smaller ones. So that the artifacts of a pattern and we can determine the recurrence formula.

I get the formula like this:

To better understand the longer I have to prepare a finished program. So that could be better understood anymore. Programs can be didownliad in here. check it bro!
Readmore

Wednesday, May 18, 2011

Merge Sort : Ordering Numbers to Merge Sort Method (Mengurutkan Bilangan dengan Metode Merge Sort)

Merge sort is a sorting algorithm in computer science designed to meet the needs of sorting on a data set that does not allow to be stored in computer memory because the amount is too large. This algorithm was invented by John von Neumann in 1945.

Algorithms merge sort
The main principle is implemented in the algorithm merge-sort often referred to as divide and conquer (bahasa Indonesia: pecah-belah dan taklukkan). How it works merge sort algorithm is to divide the given data array into two smaller parts. Both of the new array will then be sorted separately. After both lists are composed of fruit, then the new array will be formed as a result of the merger of two previous lines. According to its effectiveness, this algorithm works with the level of effectiveness O(nlog(n)).

Examples of application of an array as a data source to be sorted {12, 9, 4, 99, 120, 1, 3, 10} are as follows:

 To illustrate how the merge sort runs as follows:

As learning materials are also source code. Source code can be run with the compiler Jeliot (Java Eliot).
Source code can be downloaded in here
Hopefully helpful friend. Eagerness to continue learning! :D

Referensi : wikipedia
Readmore

Quick Sort : Sorting Random Numbers with Quick Sort (Mengurutkan Bilangan Acak dengan Quick Sort)


Quicksort is a divide and conquer algorithms. Quicksort first big divide the list into two sub-lists are smaller, low and high elements. Quicksort can then recursively sort the sub-list.

These steps are :
  1. Select an element, called a pivot, from the list.
  2. Then list all elements with values ​​less than the pivot moved before or left side of pivote, while all elements with value greater than the pivot moved to the right of the pivot. This is called the partition operation.
  3. Recursively sort the list of sub-elements that are smaller and sub​​-list elements is greater.

For more details, note the following images :

How it works sort the numbers with the Quick Sort is as follows:

 
For a complete program that can be tried can be downloaded at here
Java-language programs. In order to be executed in Jeliot (Java Eliot).
Readmore

Tutorial Algorithm and Programming ©Template Blogger Green by Dicas Blogger.

To Up