Question

Where does top point, when implementing a stack with a LLL? Queue ADT: 1· 2. Where does front point, when implementing a queu
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Ans-1: While implementing a stack using a linear linked list (LLL) we use to insert the element at the beginning and also delete the element from the beginning, so top will point to the first element of the linked list or you can say that top will point to the node of the linked list which is also pointed by head pointer for ease of push and pop.

Ans-2:

a. front will point to the first element of the linked list i.e. head. in case of linear linked list (LLL)

b. rear will point to the last element of the linked list i.e. tail. in case of linear linked list (LLL)

c. rear will point to the last element of the circular linked list or you can say that rear will point to the node whose next pointer will point to the first node in the circular linked list (CLL).

Ans-3: Queue follows principle FIFO (First In First out)

So the order of removal is also the order of insertion that is:

10,20,30

Ans-4: Same as Ans-2

a. head

b. tail

Ans-5:

a. rear because then you can access data at front and rear without any linked list traversal because front is the node pointed by the rear node pointer field.

b. front data can be displayed by getting the address of the front node from the pointer field of the rear node and then accessing the data field of the front node.

c. rear data can be displayed simply by accessing the data field of the node pointed by the rear pointer.

Add a comment
Know the answer?
Add Answer to:
Where does top point, when implementing a stack with a LLL? Queue ADT: 1· 2. Where...
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. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT