The rest of the chapter.
- I want to cover 1.9 briefly
- Please read everything else.
- What is a linked list (list)
- What is a doubly linked list?
- What is a circularly linked list?
- Check out klist.h in the kernel
- What is a stack?
- What is a queue?
- Check out kfifo.h.
- A tree
- Is a data structure where
- Data has a parent/child relationship
- Exactly one node, the root, has no parent
- Every other node has exactly one parent.
- A binary tree is a special case of a tree where each node has at most two children.
- A binary search tree is a binary tree with the special property that any value less than (or equal to) the value in a node is stored in the left sub-tre and any value greater is stored in the right sub-tree.
- This is used for quick data recovery
- Searching is O(n) for the degenerate case
- But O(log2(n)) for the best case.
- A red black tree is a binary tree with additional restrictions to keep it balanced.
- Really cool data structure
- Insert and delete routines require rebalancing when the tree becomes unbalanced.
- Which can be done quickly (O(log2(n)) on average
- A map/dictionary/hash table is an array that can be indexed with any arbitrary index.
- Not just 0..n, where n is the size of the array.
- It employs a hash function to map the index to the above range.
- And ideally has access time O(1)
- These are all high level.
- bitmaps are low level.
- Consider the system call
open
-
open
- This opens a file.
- One of the parameters is for file permissions
- rwx/ugo - 9 individual values.
- Plus three special bits.
- Way too many parameters.
- But in 12 bits, we can represent all 212 combinations.
- S_IXOTH
- Give execute permission to others.
- This is 000018
- S_IWOTH is 000028
- Take a look at bit.cpp.