How to find the running time of these two functions?
<p>I'm familiar with the big O notation and the running time and most of the time I can recognize the running time of an algorithm but I'm not sure with this one. 
I'm dealing with a tree here.</p>

<p><strong>First method:</strong></p>

<pre><code>static boolean containsData(TreeNode treeRoot, String data) {
    if(treeRoot == null)
        return false;
    if(data.equals(treeRoot.data))
        return (true);
    else if((data.compareTo(treeRoot.data))&lt;0)
        return(containsData(treeRoot.left, data));
    else
        return(containsData(treeRoot.right, data));
}
</code></pre>

<p><strong>Second method:</strong></p>

<pre><code>static boolean containsData2(TreeNode treeRoot,String data){
    if (treeRoot != null) {
        if (treeRoot.data.contains(data)) {
            return true;
        } else {
            return containsData2(treeRoot.left,data) || containsData2(treeRoot.right,data); 
        }
    }
    return false;   
}
</code></pre>

<p>I would say that both methods are <strong>O(n)</strong> I can not see how one of them would be <strong>O(log(n))</strong>.</p>