# write adt for stack operations

Ok, I dont understand whats the difference between: write code for stack operations and write adt for stack operations?

lets say the operation is push() and pop(). So what different code is to be written for adt?

• Depends. What about completeness (isEmpty())? What about infrastructure (equals(), C++&co.: new and dispose())? (begineer?) – greybeard Dec 4 '20 at 8:30

For instance, a queue ADT might have the following functions: enqueue, dequeue, front. The enqueue function takes data and adds it to the back of the queue; the dequeue function removes data from the front of the queue and returns it; finally the front function simply returns the first data in the queue but does not remove it.
The above is the most basic queue ADT, but you could have other functions like back, isEmpty, or even something weird like thirdPlaceInQueue. It all depends on what your needs are. Be careful though, giving too much functionality may lead to a different ADT. For instance, if you gave a queue ADT the ability to add to the front and remove from the back, you would then have a deque ADT.