to da funchio urite ash feoram Oukput as Show transcribed image text to da funchio urite ash feoram Oukput as
Solution
1.Function for input array
input(){
while read linedo my_array=(“${my_array[@]}” $line)doneecho ${my_array[@]}
2.Function for output array
output(){
echo ${my_array[@]
}
3. Function for merge
merge() {
local first=2
local second=$(( $1 + 2 ))
for i in ${@:2}
do
if [[ $first -eq $(( $1 + 2 )) ]]
then
echo ${@:$second:1} ; ((second += 1))
else
if [[ $second -eq $(( ${#@} + 1 )) ]]
then
echo ${@:$first:1} ; ((first += 1))
else
if [[ ${@:$first:1} -lt ${@:$second:1} ]]
then
echo ${@:$first:1} ; ((first += 1))
else
echo ${@:$second:1} ;
OR
OR