0 0 votes Consider an efficient implementation of a data structure STACK-MAX that support an operation “max( )” that reports the current maximum among all elements in the stack. Normal stack operations i.e., push, pop are also to be supported. The size of above data structure after performing following operation push (5), push (6), push (7), pop, max, push (6), push (8), pop, pop, max, push (5) is ________ (in bytes). Assume that an integer can be stored in 4 bytes. 12 or 24?? Programming in C + – abhishek tiwary 851 views answer comment Share Follow Print See all 5 Comments 5 5 Comments reply Show 2 previous comments Ashwin Kulkarni commented Dec 5, 2017 reply Follow flag It max() does not push or pop something into stack? Its just gives answer to user is it true? if yes then ans will be 12. After all operations 5,6,5 will be present in the stack! 0 0 replyShare abhishek tiwary commented Dec 5, 2017 reply Follow flag @ Ashwin Kulkarni yes 12 i am also thinking like this but in made easy sol they are maintaining two columns and increases the size by 24 i do not know why?? 0 0 replyShare sathvikchiramana commented Jul 14, 2018 reply Follow flag Ans is 32...Refer geeksforgeeks https://www.google.co.in/amp/s/www.geeksforgeeks.org/tracking-current-maximum-element-in-a-stack/amp/ 0 0 replyShare Please log in or register to add a comment.