Stack data structure in

By: Issac Emailed: 1647 times Printed: 2122 times    

Latest comments
By: rohit kumar - how this program is work
By: Kirti - Hi..thx for the hadoop in
By: Spijker - I have altered the code a
By: ali mohammed - why we use the java in ne
By: ali mohammed - why we use the java in ne
By: mizhelle - when I exported the data
By: raul - no output as well, i'm ge
By: Rajesh - thanx very much...
By: Suindu De - Suppose we are executing

Stack is another useful data structure in which is based upon push-pop method. It works on LIFO mechanism, the last value inserted will be the first one to be removed.

Syntax of Stack push and pop operations
Push: to add an item in the stack datastructure 
Syntax: Stack.Push (Object)
Pop: to return the item last inserted item in the stack 
Syntax: Stack.Pop ()
Return: the last object in the Stack 
Contains: to Check whether an object is in the stack or not
Syntax: Stack.Contains (Object)

VB.NET SourceCode 

Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, 
ByVal e As System.EventArgs) Handles Button1.Click
Dim stackTable As New Stack
If stackTable.Contains("4") Then
MsgBox("not exist")
End If
End Sub
End Class

When you run this program it numbers 1 to 7 (items) into the sack and then checks whether item “4” exists in the stack or not if it exists then the last item added is popped out(7 is popped out) if you check contains with 8 (i.e If stacktable.contains(“8”) ) then it will say not exist. Home | All Tutorials | Latest Tutorials

Sponsored Links

If this tutorial doesn't answer your question, or you have a specific question, just ask an expert here. Post your question to get a direct answer.

Bookmark and Share


1. View Comment

How about using stack in microprocessor subj.??? do you have any idea how to push and pop only???

View Tutorial          By: Private at 2015-08-18 01:43:18

Your name (required):

Your email(required, will not be shown to the public):

Your sites URL (optional):

Your comments:

More Tutorials by Issac
Save/Write/Read image file from/to a database using Java program
How to modify the objects using java classes
Java program for Cloning
Java program for changeable wrapper class
A tutorial on Chat Server and Chat Client in
Chat Server in
Chat client in
How to open and read an XML file in
How to create an XML file in
XML and
How to create an XML file in VB.NET using Dataset
Multi Threaded Client Socket Programming in
Multi Threaded Server Socket Programming in
Multi threaded Socket Programming in
Client Socket Program sample in

More Tutorials in
Scope in
Unstructured Exception Handling in
Structured Exception Handling in
Creating Sub Procedures in
Creating Functions in
Passing a Variable Number of Arguments to Procedures in
Specifying Optional Arguments with default values in Procedures in
Preserving a Variable's Values between Procedure Calls in
Procedure Delegates in
Properties in
Understanding Scope in
Using Resume Next and Resume Line in
Using On Error GoTo 0 in
Getting an Exception's Number and Description in
Raising an Exception Intentionally in

More Latest News
Most Viewed Articles (in )
For Loop in
For Each…Next Loop in
Read Data from Excel using OLEDB in VB.NET 2005
Insert cell data in an Excel file using OLEDB in
How to export from DataGridView to excel using
Client Socket Program sample in
OleDbDataAdapter class in
Using Multiple Catch Statements in
The For Loop in
What is .NET Framework and the Common Language Runtime?
Assemblies, Solutions and Projects in VB .NET
Operators in
If…Else Statements in
Do Loop in
Handling Dates and Times in
Most Emailed Articles (in
How to Open and Edit Cells in an Excel 2007 file in VB.NET
Format Excel 2007 Page in VB.NET
Nested If and Single line if statement
Multi threaded Socket Programming in
Using Select Case in
How to export from DataGridView to excel using
Structured Exception Handling in
Properties in
To read the entire worksheet in an Excel workbook through Code
How to create an XML file in
A tutorial on Chat Server and Chat Client in
Changes in Controls from VB6 to
“Using If with And” and Comparing two integers using If
For Loop in
Stack data structure in