MCPcopy Create free account
hub / github.com/subbarayudu-j/TheAlgorithms-Python / printNGE

Function printNGE

data_structures/stacks/next.py:3–13  ·  view source on GitHub ↗
(arr)

Source from the content-addressed store, hash-verified

1from __future__ import print_function
2# Function to print element and NGE pair for all elements of list
3def 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
16arr = [11,13,21,3]

Callers 1

next.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected