Beispiel #1
0
def main():
    '''print("Enter the array elements : ")
  arr = [int(i) for i in input().split()]
  n = len(arr)'''
    arr = array_util.get_array()
    d = int(input("Enter the displacement:"))
    if isinstance(d, int) and d <= 0:
        print("Enter a valid input")
        return
    print("integer list before rotation : {}".format(arr))
    print("integer array after rotating left by {} positions {}".format(
        d, leftRotate(arr, d)))
Beispiel #2
0
def main():
    arr = array_util.get_array()
    print("array before reaaragment : {}".format(arr))
    print("array after reaaragment : {}".format(rearrange1(arr)))
def main():
    arr = array_util.get_array()
    print("array before reversal : {} ".format(arr))
    print("array after reversal : {}".format(reverse_array(arr)))
    print(arr)
    print("array after reversal : {}".format(reverse_with_slicing(arr)))
def main():
    arr = array_util.get_array()
    print("array before reaaragment of +ve and -ve : {}".format(arr))
    print("array after reaaragment of +ve and -ve : {}".format(
        rearrange_positive_negative(arr)))