+ Reply to Thread
Results 1 to 3 of 3

Thread: Lists, Stacks, and Queues

  1. #1
    Programming Expert Sionofdarkness is an unknown quantity at this point
    Join Date
    Jul 2006
    Posts
    383

    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. #2
    Programmer brackett is on a distinguished road
    Join Date
    May 2006
    Posts
    193
    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.

  3. #3
    Super Moderator WingedPanther has much to be proud of WingedPanther has much to be proud of WingedPanther has much to be proud of WingedPanther has much to be proud of WingedPanther has much to be proud of WingedPanther has much to be proud of WingedPanther has much to be proud of WingedPanther has much to be proud of WingedPanther has much to be proud of WingedPanther's Avatar
    Join Date
    Jul 2006
    Age
    36
    Posts
    11,686
    Blog Entries
    57
    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.
    CodeCall Blog | CodeCall Wiki | Shareware
    Programming is a branch of mathematics.
    My CodeCall Blog | My Personal Blog

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

     

Bookmarks

Bookmarks

     
        Algorithms and Data Structures

        Java tutorials

        Algorithms Forum

Posting Permissions

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