First Solution
The solution would be that on the database side you have a column of Product ID as your primary key and some other column as needed. On your coding side, you will need a function to get all of productID on database and put them in an sorted array of int or long, depending on the number of product. From that you can simply create a function that look through that array using binary search to check the existent of the product.
Binary search algorithm.
Second Solution
You can create object class of product that contain ProductID and whatever needed. From that you can created
Binary Tree using your productID to sort the object. To look up the inventory, you would have to create a function similar to Binary search algorithm
EDIT: Your table probably looks like :
PRODUCT_TABLE : PRODUCT_ID AS Primary Key,GROUP_ID As Foreign Key, PRODUCT_NAME, PRODUCT_PRICE
GROUP_TABLE : GROUP_ID As Primary Key, Group_Name
NOTE: You probably want 2 binary trees one for product and one for group. In the Group class and Product class will need the property that reference to one another