|
||||||
| Python Discussion forum for Python, a high-level language with simple syntax, but yet powerful. |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
|
|||
|
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.
|
| Sponsored Links |
|
|
|
|||
|
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. |
|
|||||
|
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 Programming is a branch of mathematics. |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
| WingedPanther | ........ | 2753.6 |
| Xav | ........ | 2704 |
| Brandon W | ........ | 1702.32 |
| John | ........ | 1207.73 |
| marwex89 | ........ | 1175.24 |
| morefood2001 | ........ | 966.05 |
| dcs | ........ | 655.75 |
| Steve.L | ........ | 475.59 |
| orjan | ........ | 418.58 |
| Aereshaa | ........ | 383.54 |
Goal: 100,000 Posts
Complete: 97%