我有一个表,其中存储所有项目信息及其 ID。现在我想创建一个包含所有客户的表并记录购买了哪些商品。对此最好的解决方案是什么?我想如果像这样存储它的话效率不是很高:
|customer_id | username | password | boughtproducts |
| 1 | herbert |123 |productid1,pid2...|
Run Code Online (Sandbox Code Playgroud)
你会怎么做?
我有以下界面:
interface MySortedCollection<T extends Comparable<T>> {
boolean isElement(T t);
void insert(T t);
void printSorted();
}
Run Code Online (Sandbox Code Playgroud)
我尝试使用AVLTree来实现接口:
public class AVLTree<T> implements MySortedCollection{
private AVLNode<T> tree=null;
public AVLTree (){
}
public boolean isElement(T t){
}
public void insert(T t){
if(tree==null){
tree= new AVLNode<T>(t);
}
}
public void printSorted(){}
}
Run Code Online (Sandbox Code Playgroud)
但是我得到了错误:
error: AVLTree is not abstract and does not override abstract
method insert(Comparable) in MySortedCollection
public class AVLTree<T> implements MySortedCollection{
Run Code Online (Sandbox Code Playgroud)
怎么了?