Created
August 24, 2019 22:23
-
-
Save nikasulo/5e7f9cacb197fe89c4b2da6b4f269e82 to your computer and use it in GitHub Desktop.
Compare the max to other numbers in the window
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#check if the current item in the array is greater than what our max currently is | |
if max < array[i] | |
#if it is, first remove the max | |
remove_max(deque) | |
#now set the current index value of the array as the max | |
set_max(deque, array[i]) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment