Array
Algorithm
- Start
- Initialize an array
arr[MAX]
and a variablen
(number of elements). - Create:
- Ask user for
n
. - Read
n
elements into the array.
- Ask user for
- Menu:
- Display options:
- Insert
- Delete
- Display
- Exit
- Display options:
- Insert Operation:
- Ask for position
pos
and valueval
. - Shift elements from
pos
to the right. - Insert
val
atpos
. - Increment
n
.
- Ask for position
- Delete Operation:
- Ask for position
pos
. - Shift elements from
pos+1
to left. - Decrement
n
.
- Ask for position
- Display Operation:
- Print all
n
elements of the array.
- Print all
- Repeat menu until Exit is selected.
- Stop
Flowchart
