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

Answer Posted / sudipto ghosh

yes it is possible to insert different types of element in a
stack.
insted of defining the member as int or float or so on. we
will define each element as a union which will be consisting
of all types of data type and only one can be used at a
time. in order to determine which type of element is being
pushed or poped we will define a flag with in union which
keeps the track of data type being used.

Is This Answer Correct ?    11 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is adt in data structure?

498


Can we add duplicate keys in a hashmap? What will happen if we attempt to add duplicate values?

481


How is the front of the queue calculated ?

730


What is meant by arraylist?

486


which is the simplest file structure? (Sequential, indexed, random)

793






What is collections singletonlist?

506


What is a list of lists?

520


What is the difference between a hashmap and hashtable?

440


Is hashmap fail safe?

513


Why is bubble sort stable?

491


Differentiate between queue and stack.

694


What is a static structure?

473


What is an object array?

531


Provide an algorithm to reverse a linked list without using recursion.

523


What is the order of b tree?

551