我正在尝试创建一个Generic类,E extends Comparable E但我在Eclipse中收到一条警告说:
LinkedList.Node是原始类型.应该参数化对泛型类型LinkedList E .Node E的引用
这是代码:
public class LinkedList<E extends Comparable<E>>
{
// reference to the head node.
private Node head;
private int listCount;
// LinkedList constructor
public void add(E data)
// post: appends the specified element to the end of this list.
{
Node temp = new Node(data);
Node current = head;
// starting at the head node, crawl to the end of the list
while(current.getNext() != null)
{
current = current.getNext();
}
// …Run Code Online (Sandbox Code Playgroud) 我想检查一下我对Big-O表示法的理解.如果我有代码:
for(int bound = 1; bound <= n; bound *= 2){
for( int i = 0; i < bound; i++) {
for(int j = 0; j < n; j += 2){
.....Code
}
for(int j = 1; j < n; j *= 2){
......Code
}
}
}
Run Code Online (Sandbox Code Playgroud)
这个N 3的Big-O表示法?