Data structures. Arrays. Efficiency.

An array is a data structure that contains finite set of indexed elements of the same type, united by the same name.

Determining the index of the minimum element of the array and its value:

index = 0 // index of minimal element

min = arr[index] // value of minimal element

FOR i = 1 TO n - 1

IF min > arr[i]

THEN min = arr[i] 

end FOR

OUTPUT index, min

A two-dimensional array (2D array) is an array where each element is represented by a one-dimensional array. Each element of a two-dimensional array has two indices: row number (i) and column number (j).



Time efficiency is measuring the number of seconds an algorithm takes to complete. 

No alt text provided for this image

Time taken - the number of steps in the algorithm. 

Spaсу efficiency of an algorithm is the use of the minimum amount of resources such as memory

No alt text provided for this image

Space used - the amount of data that the algorithm needs to keep track of at once.   


Last modified: Thursday, 18 April 2024, 11:20 AM