I am trying to work on a program which searches for an IP in the file and tells if its belongs to a range ?
Example
"202385408","202385919","PR"
"202385920","202386431","US"
"202386432","202387455","VI",
"202387456","202517983","US"
"202517984","202517991","PR"
"202517992","202706431","US"
"202706432","202706943","PR"
So entering 202386435 should return "VI" [ Line 3 ]
and entering 202387460 should return US [ Line 4]
I need to do this using a binary tree or similar data structure since sequential search in a file with 1000,000 records take forever.
Any thoughts would be really appreciated.
Thanks
Example
"202385408","202385919","PR"
"202385920","202386431","US"
"202386432","202387455","VI",
"202387456","202517983","US"
"202517984","202517991","PR"
"202517992","202706431","US"
"202706432","202706943","PR"
So entering 202386435 should return "VI" [ Line 3 ]
and entering 202387460 should return US [ Line 4]
I need to do this using a binary tree or similar data structure since sequential search in a file with 1000,000 records take forever.
Any thoughts would be really appreciated.
Thanks