[Tutor] data structures general query

Alan Gauld alan.gauld at yahoo.co.uk
Wed Jun 26 17:50:28 EDT 2019


On 26/06/2019 19:46, Mats Wichmann wrote:

> I forgot to add the snide-comment part of "what are these good for":
> 
> (a) binary search trees are excellent for Computer Science professors
> who want to introduce recursion into their classes.
> 
> (b) all the classic data structures are candidates for being job
> interview questions ("implement a linked list in Python on the whiteboard")

That's a good point that I intended to make in my response but forgot.

In practice, Python's data structure can mimic these classic data
structures and do so more efficiently than trying to write them
from scratch in Python.

So while they all have Computer Science theoretic pros and cons, in
practice, Python programmers tend to ignore them and use lists, sets,
tuples and dictionaries. And if they need anything more complex
classes or pre-built modules. It's a very rare problem that needs
a traditional data structure in Python.

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos




More information about the Tutor mailing list