Chapter 4 Arrays 1. Array is the first data sturcture invented for FORTRAN 1950's. 2. An arry is a consecutive group of related memory locations with a single name. To refer to a particular location or element within the array, we specify the array and the subscript. 3. A subscript i maybe an integer or integer expression. The subscript always start from 0, upto the size of array minus 1. 4. An array of type char can be used to store a character string. 5. If there are few initializer than elements in the array, the remaining elements are initialized to 0. 6. A character array can be initialized with string literal. 7. All strings must end with the null character 0. 8. It is required to include the header file string.h when a string function is referenced in a program. 9. A chacater array can be initialized with character constants in an initializer list. 10. The Array name is address constant, which contains the memory address of the first element in the array. 11. C++ provides the type qualifier const that enables programs to prevent modification of array values in a function. 12. Bubble sort and sequential search is simple and straight forward for a small array. 13. The performance of algorithms are represented by big-O notation, such as O(nlogn), O(N square), O(cube),... 14. Array are passed to function by simulated call-by-reference. 15. Binary search eliminates from consideration half the elements in the array after each comparison by locating the middle element of the array and comparing it to the search key. If they are equal, the search key is found and the subscript of the record is returned. Otherwise, the problem is reduced to searching one half of the array. 16. The size of the first subscript of a multiple-subscripted array is not required, but all the sub-sequent subscripts are required. The compiler use these sizes to determine the locations in memory of elements in the multiple subscripted arrays. 17. To pass one row of a double subscripted array to a function that receive a single subscripted array, simply pass the name of the array followed by the first subscript. 18. Strieve for program clarity. It is sometimes worthwhile to trade off the most efficient use of memory or processor time in favor of writing clearer programs. 19. We can apply static to the local array declaration so that array is not created and initialized each time the function is called, and the array is not destroyed each time the function is exited in the program. 20. An array must be sorted before the binary search method can be used. 21. Program should always verify inout data before proceed any further. 22. FORTRAN is column major, while COBOL, BASIC, Pascal, C/C++, VB are all row major. 23. C++ allow the program to access the element which is outside the subscript boundary, but the porogram will produce incorrect results. 24. To use constant for array size and loop boundary values can be used to avoid the so=called magic number. in the program. 25. Virtually, every organization must sort some data and in many cases massive amount of data. 26. Bubble sort, quiker sort, insertion sort, exchange sort, shell sort, radix sort, binary merge sort, and heap sort are among the popular sorting methods. 27. Defining the size of each array as a constant variable instead of a constant makes a program more scalable. 28. Although everything is doable, you have to measure the cost you must pay downstream. Chose the best solution forever. 29. Knight's tour, 8 queens problem and maze problem are good projects. 30. The combination of arrays and subcripts can be used to solve a lot of real world problems.