Create a customized data structure such that it has functions :-
All the functions should be of O(1)
Question Source : amazon interview questions
1) create a custom stack of type structure with two elements, (element, min_till_now)
2) implement the functions on this custom data type
5 inserted successfully 7 inserted successfully 3 inserted successfully min element :: 3 removed successfully 2 inserted successfully 9 inserted successfully Last element :: 9 0 inserted successfully min element :: 0 removed successfully 11 inserted successfully min element :: 2
Time complexity : Each function runs in O(1)
This article is contributed by Mandeep Singh. If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
- Stack Data Structure (Introduction and Program)
- Design and Implement Special Stack Data Structure | Added Space Optimized Version
- Design a data structure that supports insert, delete, search and getRandom in constant time
- How to create mergable stack?
- Introduction to Data Structures | 10 most commonly used Data Structures
- Difference between Stack and Queue Data Structures
- Amazon Data Engineer Internship interview experience
- Design data structures and algorithms for in-memory file system
- Design the Data Structures(classes and objects)for a generic deck of cards
- Why companies like Amazon, Microsoft, Google focuses on Data Structures and Algorithms : Answered
- Amazon Interview Experience for SDE-1
- Minimum integer that can be obtained by swapping adjacent digits of different parity
- Find the number of unique pairs satisfying given conditions
- Parsing String of symbols to Expression