OUR EXPERT
Mihalis Tsoukalos is a systems engineer and a technical writer. You can reach him at www. mtsoukalos.eu and @mactsouk.
QUICK TIP
MAKING SENSE OF HASH TABLES
QUICK TIP
LINKED LISTS
OUR EXPERT
The main benefit of using a binary tree or a tree in general is that you can quickly find out if an element is present or not, compared to performing a linear search. Trees are also good at modelling relationships and hierarchical data. Let’s begin by discussing the basics of binary trees before we start implementing binary trees in Python.
Linked lists are popular in computer science because of their simplicity, versatility and ease of use.
A hash table is a data structure that stores one or more key and value pairs. It can store keys of any type and uses a hash function to compute an index into an array of buckets or slots, from which a value can be found. Ideally, the hash function will assign each key to a unique bucket. Unfortunately, this rarely happens. Therefore, the most crucial feature of the hash function is that it should produce a uniform distribution of the hash values.
There’s no point in sorting a binary tree because trees are sorted by default in their own way. This special sorting depends on the way new nodes are inserted in the binary tree. What’s important is, when possible, to have our binary trees balanced to speed up their operations.
Strictly speaking, a linked list is a structure with a finite set of elements. Each element uses at least two memory locations: one for the data and the other for a pointer that links the current element to the next one in the sequence of elements that construct the linked list. This is also known as a singly (or single) linked list.
Mihalis Tsoukalos is a systems engineer and a technical writer. You can reach him at www. mtsoukalos.eu and @mactsouk.