Next Greatest Element Algorithm And Flowchart