Question

Describe why a class is ADT (Abstract Data Type)? Why a stack is ADT?

Describe why a class is ADT (Abstract Data Type)? Why a stack is ADT?

Homework Answers

Answer #1

Answer :

A Class usually contains various objects which implies a set of various data members along with their set of operations that are needed to be performed. And the member methods of class handles the instance variables. When a class is used as a type it provides only the essentials and hide the details . That's why the class is considered as ADT (Abstract Data Type).

Stack is considered as ADT (Abstract Data Type) because stack works on the principle of LIFO (last in first out), generally a stack is performed using the two fundamental operations which are PUSH and POP. Stack hides its implementation using arrays or linked lists but it organizes the data in logical and oredered manner.

Since stack hides the details and provides only the essentials, that's why stack is considered as ADT (Abstract Data Type).

NOTE: Queue is also considered as ADT (Abstract Data Type)

Thank You!!!

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Write a C program: Implement the abstract data type (ADT) queue (FIFO) of strings. ADT has...
Write a C program: Implement the abstract data type (ADT) queue (FIFO) of strings. ADT has the following methods: clear – clears the queue; is_empty – returns 1 if the queue is empty, otherwise 0; is_full – returns 1 if the queue is full, otherwise 0; add – adds a new string at the end of the queue; remove – removes the string from the front of the queue. Use ADT queue to solve the following problems: • Write an...
Describe the characteristics of an abstract class in java
Describe the characteristics of an abstract class in java
A. For the basic ADT Stack operations, list all cases when a StackException will be thrown....
A. For the basic ADT Stack operations, list all cases when a StackException will be thrown. b. For the basic ADT Queue operations, list all cases when a QueueException will be thrown.
a) Write a series of C++ statements (ADT functions) that uses push()and to create a stack...
a) Write a series of C++ statements (ADT functions) that uses push()and to create a stack S1 capable of holding 10 elements and which actually stores the following, the top of the stack being theleftmost element:〈12,2,3,6,5〉 b) Then write a series of statements usingpop()to take those elements out from the stack and enqueue() them all in a queue Q capable of holding 15 elements. Show that queue.(front to be the leftmost element). c) Finally create a second stack S2 in...
- implement the Stack ADT using the linked list approach. Use C++ program language #include "StackLinked.h"...
- implement the Stack ADT using the linked list approach. Use C++ program language #include "StackLinked.h" template StackLinked::StackLinked (int maxNumber) { } template StackLinked::StackLinked(const StackLinked& other) { } template StackLinked& StackLinked::operator=(const StackLinked& other) { } template StackLinked::~StackLinked() {    clear(); } template void StackLinked::push(const DataType& newDataItem) throw (logic_error) {    } template DataType StackLinked::pop() throw (logic_error) { } template void StackLinked::clear() {    StackNode* t;    while ( top != NULL)    {        t = top;       ...
Review the attached abstract. Is the title appropriate? Why or why not? What type of abstract...
Review the attached abstract. Is the title appropriate? Why or why not? What type of abstract is this? Would you consider this abstract well written? Why or why not? The relationship between nurses' perceptions of empowerment and patient satisfaction Purpose This study aims to explore the relationship between nurses' perceptions of empowerment and patient satisfaction using Kanter's theory as adapted by Laschinger and others. Research Question Is there a positive relationship between nurses' perceptions of empowerment and patient satisfaction? Method...
In C++ please explain Abstract Data Type? Please give some examples.
In C++ please explain Abstract Data Type? Please give some examples.
Which of the following situations described is a good situation to use an abstract class, and...
Which of the following situations described is a good situation to use an abstract class, and where it would be better to use than either a concrete class or an interface? When some methods in the class are abstract and some are concrete, and some variables in the class need to be private, while other variables need to be public When the inheriting class is closely related to the abstract class, such as with an "is-a" relationship When the objects...
Define an abstract class Name Java class that implements interface Comparable                              
Define an abstract class Name Java class that implements interface Comparable                                                 
Given main() complete the Stack class by writing the methods push() and pop(). The stack uses...
Given main() complete the Stack class by writing the methods push() and pop(). The stack uses an array of size 5 to store elements. The command Push followed by a positive number pushes the number onto the stack. The command Pop pops the top element from the stack. Entering -1 exits the program. Ex. If the input is Push 1 Push 2 Push 3 Push 4 Push 5 Pop -1 the output is Stack contents (top to bottom): 1 Stack...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT