top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

What is the stack, what is its advantage. Please explain in detail with the example of application where stack is used?

+1 vote
340 views
What is the stack, what is its advantage. Please explain in detail with the example of application where stack is used?
posted Apr 18, 2017 by Leon Martinović

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

2 Answers

+1 vote

Stack is one kind of data structure and it works in principle "Last In First Out". A stack is created when a function is called and it grows when statements of function gets executed. Once function finishes its execution stack is removed.

answer Apr 19, 2017 by Ganesh
+1 vote

Adding to what Ganesh has explained -

Stack is one kind of data structure and it works in principle "Last In First Out". It has primarily two operations: push the item into the stack, and pop the item out of the stack. In a stack elements can be added and removed from the stack only at the top. push adds an item to the top of the stack, pop removes the item from the top. A helpful analogy is to think of a stack of books; you can remove only the top book, also you can add a new book on the top.

Stack

Some Applications:
"undo" mechanism in computer software where we keep pushing the operation list in a stack and whenever user press undo we pop from the stack and reverse the operation.
"Function of the C" whenever a function is called we push the context to the stack and whenever function finished we pop the context from the stack.
"reverse a word" push a given word to stack - letter by letter - and then pop letters from the stack.

Image Credit: Wiki

answer Apr 19, 2017 by Salil Agrawal
Similar Questions
+5 votes

I gone through the RFC4006 but didnt get the context of below paragraph

   Certain applications require multiple credit-control sub-sessions.
   These applications would send messages with a constant Session-Id
   AVP, but with a different CC-Sub-Session-Id AVP.  If several credit
   sub-sessions will be used, all sub-sessions MUST be closed separately
   before the main session is closed so that units per sub-session may
   be reported.  The absence of this AVP implies that no sub-sessions
   are in use.

But here my question is
1. What could be the types of Multiple credit-ontrol Sub-session?
2. How can we include different cc-sub-session-ID for each sub-session, please give me an example with message structure using CCR message.

...