FIND A SMALLEST NUMBER USING ARRAY
INTRODUCTION:
What is an array?
In computer science, an array is a data structure
consisting of a collection of elements (values or
variables), of same memory size, each identified
by at least one array index or key. An array is
stored such that the position of each element can
be computed from its index tuple by a
mathematical formula. The simplest type of data
structure is a linear array, also called one-
dimensional array.
For example:
In array numbers are stored in linear manner,
that is they are either stored in ascending order
or in descending order.
But in most of the cases the number in respected
array are stored in ascending order
ABSTRACT:
In this micro-project we are going to find the
smallest number in an array .
Problem: Finding the smallest number in an
array is a common problem in computer science.
Methodology: The most straightforward way to
solve this problem is to repeat or go through the
array and compare each element with the
current minimum value. If the element is smaller
than the current minimum, update the minimum
value. This algorithm has time complexity.
Results: The algorithm successfully finds the
smallest number in an array with a time
complexity . This algorithm can be used in
various applications, such as sorting algorithms
and data analysis.
Its applications in different fields.
ALGORITHM:
Smallest code
.model small
.data
array dw 12h,31h 02h,45h,65h
sm db 0
.code
mov ax, @data
mov ds ,ax
mov si, offset array
mov al,[si]
dec cx
incsi
cmp al,[si]
next
mov al,[si]
next:
loop up
mov sm,al
mov al, 4ch
int 21h
end