Data structures and algorithms in C++
Data structures and algorithms in C++
2nd Edition
ISBN: 9780470460443
Author: Goodrich
Publisher: WILEY
Question
Book Icon
Chapter 6, Problem 12C
Program Plan Intro

Program Plan:

1. Below mentioned variables are used

  • ArrayList-integer array List
  • size- capacity of array List.
  • front- Index 0 of array.
  • rear-end of array.
  • rank- position of element to find.

2. Below Mentioned functions are used

  • enQueue()-toinsert the element in a circular array list
  • deQueue()-to delete the rear element.
  • displayQ()-display the elements of queue.
  • elementAtRank() − returns the value of element in position rank.
  • main()-main function in program that reads the input from user anddisplays the output.

Program description:

This program is for creating a circular array list which has a constant capacity. Since this is a circular array the front and rear positions are the same. So insertion of an element or deletion if an element need not requires a loop.

Blurred answer
Students have asked these similar questions
Demonstrate how to use pop_back function in vector C++. Given vector<int> v ={1,7,9,3,5,8}. Remove last element in the vector using pop_back and print the vector.
Declare an array X of type 2 dimensional, such that the first index can take values 0 to 9 and the second can take values 0 to 12. Also, the input for each dimension should be taken separately in 2 functions.
In OCaml, write a function printmat : bool array array -> unit = that given a bool matrix it prints it on screen with ones and zeros, instead of true and false.

Chapter 6 Solutions

Data structures and algorithms in C++

Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Operations Research : Applications and Algorithms
Computer Science
ISBN:9780534380588
Author:Wayne L. Winston
Publisher:Brooks Cole