我有一个 BlankFragment
package com.hfad.addingafragmenttoframelayout;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import org.w3c.dom.Text;
/**
* A simple {@link Fragment} subclass.
*/
public class BlankFragment extends Fragment {
public BlankFragment() {
// Required empty public constructor
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
Log.d("message","onCreateView() of BlankFragment");
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_blank, container, false);
}
public void setText(String textToBeSet){
TextView tv = (TextView)this.getView().findViewById(R.id.fragmentText);
tv.setText(textToBeSet);
}
}
Run Code Online (Sandbox Code Playgroud)
它的布局是: …
考虑这个二叉搜索树的例子。
n =10 ;and if base = 2 then
Run Code Online (Sandbox Code Playgroud)
log n = log 2 (10) = 3.321928。
我假设这意味着搜索一个元素最多需要 3.321 步(访问)。我还假设 BST 是平衡二叉树。
现在要访问值为 25 的节点。我必须转到以下节点:
50
40
30
25
Run Code Online (Sandbox Code Playgroud)
所以我必须访问4个节点。3.321 几乎等于 4。
这种理解是对还是错?
algorithm tree binary-tree binary-search-tree data-structures
为什么以下代码:
"AB" .match(/(AB)/);
归还这个:
["ab","ab"]
虽然ab在字符串中出现一次ab,为什么ab在数组中出现两次?