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
What are basic algorithms?
When ArrayIndexOutOfBoundsException occurs?
What is a queue in data structure?
What is long data type?
Define graph?
Which sorting algorithm has minimum number of swaps?
How many null values are allowed in a set?
What is homogeneous array?
An array having 100 elements have numbers from 1 to 99 randomly out of which any number is repeated. Find the repeated number in minimum time and space complexity.
What is the time complexity of selection sort?
What does arraylist remove return?
Can you dynamically allocate arrays in expanded memory?
Explain heapsort. What is its complexity?
Which is best array or linked list?
What do you mean by 2-3-4 tree?