-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Rakesh Kumar T edited this page May 4, 2020
·
11 revisions
Ip-model is a light-weight Data structure to perform operations on IP's efficiently. We can add & remove Ip's, especially check the presence in O(1) time.
The DS is designed by leveraging the advantages of Radix Tree.
Steps for adding, removing and checking Individual IP's:
- Convert IP in binary form, append the 4 8-bits as a single 32bit unit
- Insert/Remove the 32bit number into/from Radix tree
Time Complexity: O(1)
Steps to adding and removing CIDR's
- Covert the given CIDR into list of IP's
- Iterate over the list & follow the same Steps for adding/removing Ipv4