Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

two pointer function in python

def reverseArray(array):
    start, end = 0, len(array)-1
    while start< end:
        array[start], array[end] = array[end] , array[start]
        start += 1
        end -= 1
  
array = [10, 20, 30, 40, 50]      
reverseArray(array)
print(array)
 
PREVIOUS NEXT
Tagged: #pointer #function #python
ADD COMMENT
Topic
Name
7+1 =