Language Specific Flashcards
Concepts and facts specific to a languages - Java & C#
Stack Methods
Stack (Java)
- push(E item)
- pop()
- empty()
Queue Methods
Queue (Interface) (Java)
In order to instantiate an object use a concrete class like ArrayDequeue/ LinkedList
offer(e) : Add an element , returns true else false
poll() : remove the head of the queue
clone() : perform a shallow copy of the entire queue
Pair class in Java
the format is Pair
String toString() : This method will return the String representation of the Pair. K getKey() : It returns key for the pair. V getValue() : It returns value for the pair. int hashCode() : Generate a hash code for the Pair.
Data structure to identify the min entry in a list. For eg. in the meeting room problem, when we have to identify the meeting room that is available, in other words, the meeting end time is the least
Priority Queue or Min Heap [Java]
SortedList [C#]
For Meeting room problem - if the room we extracted from the top of the min heap isn’t free, then no other room is. So, we can save time here and simply allocate a new room.