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 a data structure that supports insert, delete, search and getRandom in constant time
- Design and Implement Special Stack Data Structure | Added Space Optimized Version
- 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 | On-Campus
- Amazon Interview Experience for SDE-I
- Amazon Interview Experience On Campus for SDE 1
- Amazon Interview Experience | MNIT Jaipur