Skip to main content
ICT
A16 - Single Dimension Arrays
 
Main   Previous Next
 

E. Arrays and Algorithms page 7 of 10

In the following list, we introduce five important algorithms that are quite common in programs that analyze data in arrays. You will meet these again in later lessons and labs.

  1. Insertion is a standard problem that must be solved for all data structures. Suppose an array had 10 values and an 11th value was to be added. We are assuming the array can store at least 11 values.

    1. If we could place the new value at the end, there would be no problem.

    2. But if the new value must be inserted at the beginning of the list in position 0, the other 10 values must be moved one cell over in the list.

  2. Deletion of a value creates an empty cell that probably must be dealt with. The most likely solution, after deleting a value, is to move all values that are to the right of the empty spot one cell to the left.

  3. A traversal of an array consists of visiting every cell location, probably in order. The visit could involve printing out the array, initializing the array, finding the largest or smallest value in the array, etc.

  4. Sorting an array means to organize values in either ascending or descending order. These algorithms will be covered in depth in future lessons.

  5. Searching an array means to find a specific value in the array. There are several standard algorithms for searching an array. These will be covered in future lessons.

 

Main   Previous Next
Contact
 © ICT 2006, All Rights Reserved.