Lost Password?

Go Back   CodeCall Programming Forum > Software Development > Python

Python Discussion forum for Python, a high-level language with simple syntax, but yet powerful.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-22-2006, 03:44 PM
Sionofdarkness Sionofdarkness is offline
Programming Expert
 
Join Date: Jul 2006
Posts: 385
Rep Power: 10
Sionofdarkness is on a distinguished road
Default 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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #2 (permalink)  
Old 07-26-2006, 01:20 AM
brackett brackett is offline
Programmer
 
Join Date: May 2006
Posts: 193
Rep Power: 10
brackett is on a distinguished road
Default

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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 07-26-2006, 08:38 PM
WingedPanther's Avatar   
WingedPanther WingedPanther is offline
Super Moderator
 
Join Date: Jul 2006
Age: 35
Posts: 2,035
Last Blog:
NaNoWriMo Day 23 The...
Rep Power: 24
WingedPanther is a jewel in the roughWingedPanther is a jewel in the roughWingedPanther is a jewel in the roughWingedPanther is a jewel in the rough
Default

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 | Linux Forum
Chat with other CodeCall members on IRC; connect to irc.codecall.net and join #codecall
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT -5. The time now is 11:27 AM.

Contest Stats

John ........ 223.00000
dargueta ........ 168.00000
Xav ........ 164.00000
gaylo565 ........ 18.00000
WingedPanther ........ 15.00000
|pH| ........ 15.00000
Johnnyboy ........ 3.00000
navghost ........ 1.00000

Contest Rules

CodeCall Goal

Goal: 100,000 Posts
Complete: 66%

Ads