Closed Thread
Results 1 to 3 of 3

Thread: Lists, Stacks, and Queues

  1. #1
    Sionofdarkness is offline Programming Expert
    Join Date
    Jul 2006
    Posts
    383
    Rep Power
    0

    Lists, Stacks, and Queues

    So lists can be used as stacks and queues, but what are lists, and how are stacks and queues different? I know I'm asking a lot, I'm just trying to learn the basics of the language.

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Posts
    Many

     
  3. #2
    brackett is offline Programmer
    Join Date
    May 2006
    Posts
    192
    Rep Power
    22
    I'm not a Delphi or Python guy, but lists queues and stacks are pretty universal, so I'll give it a shot.

    Lists: An unordered collection of objects

    Stacks: An ordered collection of objects, ordered by LIFO (Last In First Out)

    Queues: An ordered collection of objects, ordered by FIFO (First In First Out)

    Lists are usually just accessed by index, and don't really have an order to them. You would fill them by index, and they'd keep that order.

    Stacks will normally have a Push and a Pop method. Push puts an item (conceptually) on the "top" of the stack. Pop takes an item off the the "top" of the stack.

    Queues will normally have an Enqueue and Dequeue method. Enqueue puts an item (conceptually) on the "bottom" of the queue. Dequeue takes an item off the "top" of the queue.

  4. #3
    Join Date
    Jul 2006
    Posts
    16,475
    Blog Entries
    75
    Rep Power
    143
    Also, lists, queues and stacks are used in many different languages. Some provide built in implementations, but they are examples of data-structures... usually covered in their own course.
    Programming is a branch of mathematics.
    My CodeCall Blog | My Personal Blog

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 0
    Last Post: 10-21-2011, 06:38 AM
  2. Beginner C# Queues
    By chili5 in forum CSharp Tutorials
    Replies: 0
    Last Post: 08-20-2011, 09:33 AM
  3. Intermediate ADTs: Stacks and Queues Part 1: Using Arrays
    By WingedPanther in forum C Tutorials
    Replies: 9
    Last Post: 11-15-2009, 05:45 PM
  4. Intermediate ADTs: Stacks and Queues Part 2: Using Lists
    By WingedPanther in forum C Tutorials
    Replies: 4
    Last Post: 01-09-2009, 12:38 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts