Nov 25, 2017 at 6:12pm
Q: Write functions in C++ to insert (push) element into a dynamically allocated stack in ascending order.?
I need the complete coding for this problem.
Last edited on Nov 25, 2017 at 6:37pm
Nov 25, 2017 at 6:28pm
you can change int to whatever "element" might be.
std::stack<int>* sp = new std::stack<int>;
sp[0].push(3);
to push in order, get your data into a vector, sort it, and then push each element.
Last edited on Nov 25, 2017 at 6:29pm