[Tutor] Nodes and Queues?

Alan Gauld alan.gauld at btinternet.com
Wed May 11 17:31:09 CEST 2011


"Clara Mintz" <jamani.sana at hotmail.com> wrote

> I am sorry I am a beginner at python and I was reading 
> my book and I came across the terms Nodes and Queue. 
> I am sorry but I don't quite understand how they work. 

Its a bit of Comp Science terminology.
A Queue is a particular type of data structure somewhat 
like a Python list but usually implemented in other 
languages using a series of Node objects each of 
which holds a value and a link to the next Node. You 
then add values to the queue by creating a new 
Node and linking it to the existing queue.

In Python you would usually implement a queue using 
the standard list and use its pop/push methods and 
indexing to simulate the behaviour without the hassle 
of creating Node classes etc.

It suggests your book is a comp science oriented book 
that happens to use Python rather than a dedicated 
Python tutorial. (That is not necessarily a bad thing, 
it will better prepare you for learning other languages 
in the future)

HTH,

-- 
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/




More information about the Tutor mailing list