Archive Pages Design$type=blogging

Definition of Stack

Stack is defined as a special type of data structure where items are inserted from one end called top of stack and items are deleted from th...

Stack is defined as a special type of data structure where items are inserted from one end called top of stack and items are deleted from the same end.

          Here, the last item inserted will be on top of stack. Since deletion is done from the same end, Last item is inserted is the First item to be deleted out from the stack and so, stack is also called Last In First Out (LIFO) data structure.

The various operations that can be performed on stacks are

         i.            Insert an item into the stack
       ii.            Delete an item from the stack
      iii.            Display the contents of the stack

·  Insert or push operation: Inserting an element in the stack is called push operation. This can be achieved by first increment top by 1 and then insert an item as shown below;
                top = top+1;
                s[top] = item;
These two statements can also be written as s[++top]= item
                             
When the stack is full the value of top will be [STACK SIZE -1] and it is not possible to insert any new item in the stack. This situation is called stack overflow.

·  Delete or Pop operation: Deleting the stack called pop operation. This can be achieved by first accessing the top element s[top] and then decremented top by one as shown below.
              Item = s[top--];
Each time, the item is deleted, top is decremented and finally, when the stack is empty the top will be -1. When the stack is empty, it is not possible to delete any item and this situation is called underflow of stack.

·      Display operation: Displaying the items of the stack is called display operation.

Applications of Stack:- A stack is very useful in situations when data have to be stored and then retrieved in the reverse order. Some applications of stack are listed below.
         i.            Function calls
       ii.            Large number Arithmetic
      iii.            Evaluation of arithmetic expressions


تعليقات

الاسم

Artificial Intelligence(AI) Backlinking Basic IT Best List Blogging Tips C C# C++ Computer Architecture Computer Fundamental Computer Security Computer/IT Officer Exam CSS Data Mining and Warehousing Data Recovery Tools Data Structure Database Management System E-commerce E-government Internet & Web Designing IT Law IT Tips and Tricks IT Tutorials Java JavaScript Keyword Research Tools MIS Multiple Choice Question (MCQ) Networking Online Earning Online IT Jobs Operating System Oracle Forms and Reports Programming Guide Programming Language SEO Social Networking Sites Software Download Software Engineering System Analysis and Design Top List VB.Net
false
rtl
item
Max6: Definition of Stack
Definition of Stack
Max6
https://maxs29.blogspot.com/2012/11/definition-of-stack.html
https://maxs29.blogspot.com/
http://maxs29.blogspot.com/
http://maxs29.blogspot.com/2012/11/definition-of-stack.html
true
4303790511137642940
UTF-8
لم يتم العثور على اى مواضيع شاهد الكل اقرأ المزيد رد احذف الرد حذف بواسطة الرئيسية صفحات مواضيع شاهد الكل نوصى لك التسميات الارشيف بحث لم يتم العثور على ماتبحث عنه عودة للرئيسية الاحد الاثنين الثلاثاء الاربعاء الخميس الجمعة السبت الاحد الاثنين الثلاثاء الاربعاء الخميس الجمعة السبت يناير فبراير مارس ابريل مايو يونيو يوليو اغسطس سبتمبر اكتوبر نوفمبر ديسمبر يناير فبراير مارس ابريل مايو يونيو يوليو اغسطس سبتمبر اكتوبر نوفمبر ديسمبر just now 1 دقيقة مضت $$1$$ دقيقة مضت 1 hour ago $$1$$ ساعة مضت الامس $$1$$ يوم مضى $$1$$ اسبوع مضى اكثر من 5 اسابيع مضت