This relationship was not included in the Order of Algorithms graph. Here, the size of the data set does not affect the number of steps this type of algorithm takes. For example:
public int howBig(ArrayList<Integer> list){
return list.size();
}
The number of data items in the array could vary from 0...4000, but this does not affect the howBig algorithm. It will take one step regardless of how big the data set is.
A constant time algorithm could have more than just one step, as long as the number of steps is independent of the size (N) of the data set.
Last modified: January 26, 2023
Back to Order Of Algorithms