.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Articles >> .Net Framework >> Post New Resource Bookmark and Share   

 Subscribe to Articles

Difference between Queue and Stack?

Posted By:Syed Shakeer Hussain       Posted Date: November 21, 2009    Points: 15    Category: .Net Framework    URL: http://www.dotnetspark.com  
 

Queue:-
1)A Queue is a collection where elements are processed in "First in First Out".
2)The items that is put first in the Queue is read First.
3)
Enqueue() method adds an item to the end of the Queue.
4)
Dequeue() method reads and removes an item from the head of the Queue.
5)
Peek() method reads an item from the head of the Queue but does not remove an item.

Stack:-
1)Stack is a collection where elements are processed in "Last in First Out":.
2)The items that is added last to the Stack is read First.
3)
Push() method adds an item to the Top of the Queue.
4)
Pop() method returns an item from the Top of the Stack.
5)
Peek() method returns an item from the Top of the Stack but does not remove an item.
6)Structs are Value Type
7)Structs stored in Stack.It does not support Inheritance

 Subscribe to Articles

     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More Articles on C#, ASP.Net, Vb.Net, SQL Server and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend