diff --git a/data_structures/stacks/next_greater_element.py b/data_structures/stacks/next_greater_element.py index 02a86196f5bf..29a039b9698b 100644 --- a/data_structures/stacks/next_greater_element.py +++ b/data_structures/stacks/next_greater_element.py @@ -1,6 +1,13 @@ -# Function to print element and NGE pair for all elements of list def printNGE(arr): - + """ + Function to print element and Next Greatest Element (NGE) pair for all elements of list + NGE - Maximum element present afterwards the current one which is also greater than current one + >>> printNGE([11,13,21,3]) + 11 -- 13 + 13 -- 21 + 21 -- -1 + 3 -- -1 + """ for i in range(0, len(arr), 1): next = -1