In: Computer Science
Write an algorithm which has a pre-populated array an array_input of array type and separates it, every other character, into two separate arrays called array1 and array2.
Algorithm:
Hence, this is the algorithm for the above program.
Solution:
I would like to make a python program for it for just the example as we can easily write the same code in any language applicable. Please find the code below:
main.py
def split_array(array_input):
lnt= len(array_input)
array1 = array_input[0:lnt]
array2 = array_input[0:lnt]
return array1,array2
array_input = ['a','b','c','d','e','f']
array1, array2 = split_array(array_input)
print(array1)
print(array2)
Indentation
Output