title: Does passing a variable with a large amount of data cost a lot of memory and time in Mathematica?
body: <p>I am coding up an algorithm for constructing a suffix tree in Mathematica based on Ukkonen's algorithm. </p>
  
  <p>The question I have is, will passing my entire tree structure (which I have stored in a list) to a function to search through, cost my program a lot of memory and time since I have to use some of the functions multiple times in the algorithm?</p>
  
  <p>For example, I have a function that searches for the children of a specific node, and I use the <code>Select</code> function to search the entire tree. </p>
  
  <pre><code>getChildren[parentID_] := Select[tree, #[[3]] == parentID &amp;];
  </code></pre>
  
  <p>However I need to access the tree, so is it reasonable to pass the entire tree structure to the function? Since it doesn't seem that there is a way to make a variable global to the entire notebook. Or is there some alternate way to get around this?</p>