answersLogoWhite

0

implement the queue ADT using an array

User Avatar

Wiki User

15y ago

What else can I help you with?

Continue Learning about Engineering

A program for queue ADT by using arrays in c plus plus?

Arrays are not suitable for implementing queues because while they are ideal for adding to the end, the are not ideal for extraction from the beginning. For that you need a deque. Regardless, the STL (standard template library) already provides an efficient queue ADT in std::queue.


Difference between data structures and ADT?

Abstract Data Types:ADT is a mathematically specified entity that defines a set of its instances, with:a specific interface - a collection of signatures of methods that can be invoked on an instance,a set of axioms that define the semantics of the methods (i.e., what the methods do to instances of the ADT, but not how)Abstract Data Types (Examples):Lists, TreesStacks, QueuesPriority Queue, Union-FindDictionaryData StructureIn a general sense, any data representation is a data structure.Example: An integerMore typically, a data structure is meant to be an organization for a collection of data items.From: Shoaib Sidhu


Give an example of an abstract data type?

some common adt's which prived useful in agreat variety of applications are container, deque ,list, map, multimap ,multiset , queue ,setstack, string, tree "another answer" "if we declare an integer value in c++, int x, we can say that the name attribute has value(x) and that the type attribute has value(int x=4) the value of attribute has value four.


How you describe operations of stack ADT using c template functions?

No, because C does not support the concept of template functions. Template functions only exist in C++, never in C.


Write a c plus plus programs for stack using arrays?

//Program on Stack ADT Using Arrays #include<iostream.h> #include<conio.h> #define maxSize 10 #include<stdlib.h> class stack { public: stack(); // constructor call the display function void pop(); //used to pop the value as per user demand void push(); //used for push the value as per user demand int empty(); //used to check the stack int full(); //used to check the stack whether it is full as max limit is 80 void display(); //used to display menu for operations void stackDisplay(); //used to display whole stack items void operation(); //used to enter the user choice private: int top; int item[maxSize]; }; stack::stack() { top = 0; display(); } void stack :: display() { cout << "STACK MAIN MENU GIVEN BELOW" << endl; cout << "PRESS 1 FOR PUSH THE ITEM ON STACK" << endl; cout << "PRESS 2 FOR POP THE ITEM ON STACK" << endl; cout << "PRESS 3 FOR DISPLAY THE WHOLE STACK" << endl; cout << "PRESS 4 FOR EXIT THE PROGRAM" << endl; cout<<"ENTER YOUR CHOICE" << endl; operation(); } void stack :: operation() { int choice; cin >> choice; switch(choice) { case 1: push(); break; case 2: pop(); break; case 3: stackDisplay(); break; case 4: exit(4); default: cout << "PLZ ENTER VALID NUMBER" <<endl; operation(); } } int stack::empty() { if( top 0) { cout<<"THE STACK IS EMPTY UNDERFLOW" << endl; cin.get(); } else { char ch; cout<<"AS THE LAST ELEMENT IN STACK IS "<<item[top] << endl; top = top-1; cout<<"WANT TO POP OUT ANOTHER ELEMENT y/n" << endl; cin>>ch; if(ch=='y') pop(); cin.get(); } cout<<"PRESS ENTER TO GO TO MAIN MENU " << endl; cin.get(); clrscr(); display(); } void stack::stackDisplay() { cout<<"THE ELEMENTS IN STACK IS"<<endl; for(int i = 1;i <= top; i++) { cout << item[i] << endl; } cin.get(); cout<<"PRESS ENTER FOR MAIN MENU " << endl; cin.get(); clrscr(); display(); } void main() { clrscr(); gotoxy(15,10); cout<<"WELCOME TO THE PROGRAM OF STACK MADE BY SAURABH " << endl; gotoxy(15,11); cout<<"________________________________________________" << endl; cin.get(); clrscr(); stack obj; getch(); } BY. SAURABH (GNDU RC JAL CSE 2nd YEAR)

Related Questions

A program for queue ADT by using arrays in c plus plus?

Arrays are not suitable for implementing queues because while they are ideal for adding to the end, the are not ideal for extraction from the beginning. For that you need a deque. Regardless, the STL (standard template library) already provides an efficient queue ADT in std::queue.


What is adt about?

ADT has several meanings and it depends on where and how you are using this acronym/abbreviation. In retail: ADT = Average dollar per transaction.


Where can one find an ADT authorized dealer?

An ADT authorized dealer can be found through the official ADT website, which has a locator tool to help individuals find authorized dealers in their area. Additionally, one can contact ADT directly via phone to inquire about authorized dealers in their region. It is important to ensure that any dealer claiming to be authorized by ADT is indeed listed as such on the official website to guarantee the legitimacy and quality of the services provided.


What is the market cap for ADT Corporation ADT?

As of July 2014, the market cap for ADT Corporation (ADT) is $5,833,743,993.72.


What is the symbol for ADT Corporation in the NYSE?

The symbol for ADT Corporation in the NYSE is: ADT.


What does the acronym ADT stand for in ADT Security?

The acronym ADT, as in ADT Security, originally stood for American District Telegraph in the 1800s, but now the company is known more simply as ADT Security.


How do you turn the volume up on adt alarm system?

how to turn volume up on ADT


Who owns adt?

As an ADT employee I report to ADT first , then ADT North America, then ADT World Wide and final is Tyco International , our owner.


Where can ADT stickers be obtained?

"You can either obtain an Adt sticker by actually buying service from the ADT company, OR you can go to a site like ebay or amazon and get them there if you wish to just make people think that you have ADT."


Can you tell me a good website to find adt security alarms?

The ADT company website would be the best place to look at ADT security systems and information about them. ADT is likely the most knowledgeable about their own systems.


Have you heard of ADT home Alarms?

ADT alarms? Are they a authorized ADT dealer? Call here and find out 1-888-369-0260


Where is the headquartes for ADT?

The headquarters for ADT Security are located in Boca Raton Florida.