Question

please answer these two questions properly about Stack data structure Q(1) What are their respective logical...

please answer these two questions properly about Stack data structure

Q(1) What are their respective logical and physical / storage structures .Q(2) At least one application example combining data structure and algorithm should be given.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Q(1). Logical storage structures:

Logical data structure or a logical storage sructure are data structures that can be built using physical storage structure like array and linkedlist. Logical storage structures denotes content, context of the data.

For example: Qeue, stack, tree , hash table etc.

Physical storage structures:

Physical storage structures or physical data structures are built based on physical aspects of the data .Physical storage structure shows the format and memory location of the data stored in a memory.

for example: Array, Linkedlist.

Q(2).Application example of a stack and its algorithm:

Stacks are most commonly used in evaluation of postfix,infix and prefix of an expression.

lets consider evaluating postfix of an expression using stack as an example

-To evaluate postfix of an expression, the expression us scanned from left to right and if an operand is found it is pushed into the stack.

-If the element is an operator two elements are popped out of stack.

-Repeat it till the end of the expression.

ALGORITHM:

  1. add ) to postfix expression.
  2. scan from left to right until ) is found.
  3. if an operand found push it into the stack.
  4. if an operator is found pop two elements.
  5. a==>top of the stack
  6. b==>second element of the stack
  7. evaluate b to a with respect to operator
  8. push b operator a to the stack
  9. result=pop
  10. END
Add a comment
Know the answer?
Add Answer to:
please answer these two questions properly about Stack data structure Q(1) What are their respective logical...
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