answersLogoWhite

0


Best Answer

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.

User Avatar

Wiki User

9y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: A program for queue ADT by using arrays in c plus plus?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Array implementation of priority queue example program in c plus plus?

yes


Would you Write c plus plus program using array for Fibonacci number?

You can write a C++ fib pro using arrays but the problem is the prog becomes very complicated since u need to pass the next adding value in an array.....


C plus plus program that display student name course and grade using arrays of strings?

enum field { name, course, grade }; std::string student[3]; student[name] = "Joe Bloggs"; student[course] = "C++ Programming"; student[grade] = "A+";


Example program arrays in turbo c plus plus?

Yes, you can use for-loop in a C program compiled by Turbo C.


C plus plus program using a stacks converting a postfix-infix?

Yes


Program to get a system time using c plus plus?

time in hours second minute


What is the Difference between arrays in c and c plus plus?

Nothing whatsoever. They are exactly the same.


How do you swap two arrays in c plus plus using string?

You can't. While a string is a character array, an array is not necessarily a string. Treating arrays as if they were strings simply to swap them is madness. The correct way to physically swap arrays A and B is to copy A to a new array, C, then copy B to A, then C to B. If the arrays are the same size this is not a problem. If they are different sizes, you can only swap them if they are dynamic (not static). This means you must reallocate them. To speed up the process, copy the smallest array to C, first. A much better approach would be to point at the two arrays and swap the pointers instead.


Array in c plus plus must be defined at compil time?

No. Arrays can be defined at runtime, just as they can in C. It's just that it's generally more convenient to use vectors instead of dynamic arrays at runtime, thus arrays are generally used statically, at compile time.


How do you write a program in C plus plus plus plus How do you write a program in C to swap two variables without using the third oneo swap two variables without using the third one?

To swap two variables without using a third variable, use exclusive or manipulation... a ^= b; b ^= a; a ^= b;


Program to generate Fibonacci series using storage class in c plus plus?

i dn't know. haha


How do you write a C plus plus program that displays a pyramid of Xes on the screen using a for loop?

printf ("x")