Can I represent a red black tree as an array?
It will have both positive and negative sides. This answer is applicable for C [since you mentioned this is what you will use]
Positive sides
- Lets assume you have created an array as pool of objects that you will use for red-black tree. Deleting an element or initializing a new element when the position is found will be a little fast, because you probably will use the memory pool you have created yourself.
Negative sides
- Yes the array will most probably end up taking more memory since the array will have empty slots sometimes.
- You have to be sure about the MAX size of the red-black trees in this case. So there is a limitation of size.
- You are not using the benefit of sequential memory space, so that might be a waste of resource.