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

Post Comment