• 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, July 7, 2011

Arrays C + +: Changing Array Dimensions 2 Become 1 Dimensions

Any type can be used as the base type of an array. We can create an array of ints, an array of Strings, an array of Object and so on. Mainly, because the array is the type Java class, we can create an array of type array.

For example an array of type int [], also has an array of type int automatically [][], the "array of arrays of type int". Array is called a two-dimensional array. Of course, with type int juag [][], we can make [][][], arraynya of type int which is a 3-dimensional array, and so on. There is no limit how many dimensions the array that we created, but rather something that is usually done to make the array more than 3 dimensions. Our discussion will be devoted to two-dimensional array. Type BaseType [] [] is usually pronounced "two-dimensional array of type base-type" or "array of array base-type".

How to connect the array?
easy course, each would be met with an array using a loop. Simply look at an example. In the picture below is how to create two-dimensional array into one dimensional arrays. The key was the statement that is in the green box.




Having lived keluaranya print. The full program can be downloaded here.

Jadilah yang pertama mengomentari

Post a Comment

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

To Up