Author |
Topic: data structure for storinh IP Addresses (Read 2325 times) |
|
witee
Newbie
Posts: 48
|
|
data structure for storinh IP Addresses
« on: Oct 15th, 2010, 11:06pm » |
Quote Modify
|
you are given n lists of IP addresses for eg. as follows 10.0.0.0,121.32.3.5,192.168.0.1,... 10.4.23.2,169.34.5.1,198.1.1.1,... ... Design a data structure to store these values so that you will be able to fire queries like a) IP address 10.x.3.x appears in which lists? b) How many times does 10.4.x.x appear before 192.168.x.x ? c) How many time does 169.34.5.1 appear?
|
|
IP Logged |
|
|
|
eenampicchi
Newbie
Posts: 10
|
|
Re: data structure for storinh IP Addresses
« Reply #1 on: Nov 1st, 2010, 12:46pm » |
Quote Modify
|
Perhaps we can store the addresses as tables of values, with each table containing only information from one list. These tables are akin to database tables, and optimization techniques used on those tables - such as indexes and so on might be applicable here. Query techniques can also be the same as those used in databases.
|
|
IP Logged |
|
|
|
Grimbal
wu::riddles Moderator Uberpuzzler
Gender:
Posts: 7527
|
|
Re: data structure for storinh IP Addresses
« Reply #2 on: Nov 8th, 2010, 10:00am » |
Quote Modify
|
on Oct 15th, 2010, 11:06pm, witee wrote:b) How many times does 10.4.x.x appear before 192.168.x.x ? |
| I don't understand this one. Does it mean: how many times does any 10.4.x.x appear before the first 192.168.x.x in the same list? For matching x.x's? Or across all lists? Are the IP addresses unique in each list?
|
|
IP Logged |
|
|
|
|