(arr)
| 1 | from __future__ import print_function |
| 2 | # Function to print element and NGE pair for all elements of list |
| 3 | def printNGE(arr): |
| 4 | |
| 5 | for i in range(0, len(arr), 1): |
| 6 | |
| 7 | next = -1 |
| 8 | for j in range(i+1, len(arr), 1): |
| 9 | if arr[i] < arr[j]: |
| 10 | next = arr[j] |
| 11 | break |
| 12 | |
| 13 | print(str(arr[i]) + " -- " + str(next)) |
| 14 | |
| 15 | # Driver program to test above function |
| 16 | arr = [11,13,21,3] |