Learning about algorithms and data structures from a more humble POV
May 20, 2011 8:26 PM Subscribe
What can a common PHP/MySQL-based CMS package teach me about data structures and algorithms?
I would like to start learning more about the "important bits" of data structures and algorithms.
I work with different content management systems all day. Sometimes I am up to my elbows in PHP.
What I'd like to do is start learning about the theory behind this type of code -- what sort of data structures, algorithms, and theories am I looking at -- rather than start with an abstract view that I keep getting from textbooks and online explanations.
Like, I look at a linked list, pointers, O(n log n), etc. in a textbook, and I feel like I'm coming unmoored from my current reality.
Thanks for any help!
posted by circular to computers & internet (7 answers total) 6 users marked this as a favorite
Similarly when you ask MySQL to fetch rows from the users table where ID = 56, it would be insane if MySQL had to scan every row from the start (table scan) to find that one. Instead it uses an index, which is sorted by ID, so it can use a binary search to find the appropriate row. This is again an internal implementation detail, however. There is a terrific amount of this kind of thing going on under the covers, from your application to the C library it was written on top of to the operating system kernel that it runs under. I'm not sure how much code you will find at the actual CMS layer that would exhibit classic data structures, because once you have efficient associative arrays you tend to use that for most of your needs. For example, to de-dupe a list of words, you use an associative array and set each key to some constant value, then you extract all the keys of the array (array_keys()). Or to sort a list of words you use one of the language's built in sorting functions and you don't really care how that's implemented, but under the hood there's a quicksort algorithm going on.
posted by Rhomboid at 8:57 PM on May 20, 2011