Data Structure - Array (Concept and C++ code)
Array
Array stores a fixed-size sequential collection of elements of same type
each data is correspond to an index
By index, direct access to data is possible
Sequentially process the same type of data
Advantages of Arrays
- Quick access using index
Disadvantages of Arrays
- It is not easy to add or delete data if data is variable.
- Since the fixed amount of memory space is declared, it is difficult to add new data unless you know the maximum length of the array.
- After deleting the data, there is a problem to pull the data that was existing behind
- When declaring data of array type, size of maximum length must be declared in advance
Example (C++)
Count frequency of how many ‘M’ has been appeared inside the dataset