Data structure - Is it possible to insert different type of elements in a stack? How?

Is it possible to insert different type of elements in a stack? How?

Yes, it is possible to insert different types of elements in a stack. Elements in a stack can be inserted using the “Push” operation. This operation writes an element on the stack and moving the pointer.

Is it possible to insert different type of elements in a stack? How?

Different elements can be inserted into a stack. This is possible by implementing union / structure data type. It is efficient to use union rather than structure, as only one item’s memory is used at a time.
Data structure - Explain in brief a linked list
Linked list - A linked list is a dynamic data structure. It consists of a sequence of data elements and a reference to the next record in the sequence.......
Data structure - Explain the types of linked lists
Types of linked lists - The types of linked lists are: Singly linked list: It has only head part and corresponding references to the next nodes.......
Data structure - How would you sort a linked list?
Sort a linked list - Step 1: Compare the current node in the unsorted list with every element in the rest of the list....
Post your comment