Question 11
A linear data structure enables the
user to add address from rear end and remove address
from front. Define a class Diary
with the following details:
Class name :
Diary
Data members /
instance variables:
Q[ ] :
array to store the addresses
Size : stores the maximum capacity of the
array
start : to point the index of the front end
end : to point the index of the rear end
Member functions:
Diary (int max) :
constructor to initialize the data
member
size=max, start=0 and end=0
void pushadd(String n) :
to add address in the diary from the
rear end if possible, otherwise display
the message “ NO SPACE”
String popadd( ) :
removes and returns the address from
the
front end of the diary if any, else
returns “?????”
void show( ) :
displays all the addresses in the diary
(a) Specify the class Diary giving
details of the functions void pushadd(String) and
String popadd( ). Assume that the
other functions have been defined.
The main function
and algorithm need NOT be written.
(b) Name the
entity used in the above data structure arrangement : Answer QUEUE
In computer science, a queue is a collection of entities that are maintained in a sequence and can be modified by the addition of entities at one end of the sequence and the removal of entities from the other end of the sequence. By convention, the end of the sequence at which elements are added is called the back, tail, or rear of the queue, and the end at which elements are removed is called the head or front of the queue, analogously to the words used when people line up to wait for goods or services.
The operation of adding an element to the rear of the queue is known as enqueue, and the operation of removing an element from the front is known as dequeue. Other operations may also be allowed, often including a peek or front operation that returns the value of the next element to be dequeued without dequeuing it.
Intermediate Question Paper 2022 in Telangana You may download Model Question Papers for all subjects for old and TSBIE Inter 1st / 2nd Exam 2022 from Telangana Board 12th Question Paper 2022. To begin with, TS 12th Question Paper 2022 the Telangana State Sr Inter Sample Question Papers for 2022 Exam Preparer Students Using Old Impotent Papers Obtain Below Pages. Plus 2 Quarterly Model Questions Papers for the TS Intermediate Board.
ReplyDelete