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                                                 
1. if you provide an empty method within an abstract class, the method is an abstract...
1. if you provide an empty method within an abstract class, the method is an abstract method even if you do not explicitly use the keyword ____ when defining method a. virtual b. implement c. abstract d. extends 2. when you create a number of classes that inherit from each other, as well as multiple interfaces that you want to implement with these classes, you often will find it convenient to place these related classes in a ______- a.group b....