forked from OmkarPathak/Data-Structures-using-Python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathP01_ReversingArray.py
More file actions
18 lines (15 loc) · 489 Bytes
/
P01_ReversingArray.py
File metadata and controls
18 lines (15 loc) · 489 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# Author: OMKAR PATHAK
import Arrays
def reversingAnArray(start, end, myArray):
while(start < end):
myArray[start], myArray[end - 1] = myArray[end - 1], myArray[start]
start += 1
end -= 1
if __name__ == '__main__':
myArray = Arrays.Array(10)
myArray.insert(2, 2)
myArray.insert(1, 3)
myArray.insert(3, 1)
print('Array before Reversing:',myArray)
reversingAnArray(0, len(myArray), myArray)
print('Array after Reversing:',myArray)