\begin{figure}
\footnotesize
\begin{alltt}
function Training(data)
   if allSameClass(data)
      return Node(data.row.class)
    
   for(attribute in data)
      informationGain = InfoGain(attribute)
  
   bestAttribute = attribute with maximum informationGain
   
   if bestAttribute is continuous
      threshold = value which, if bestAttribute is split on will have the highest informationGain 
                  across the two subsets of the data
      nodes.push(Training(data given bestAttribute value \(>\) threshold))
      nodes.push(Training(data given bestAttribute value \(\leq\) threshold))
   else
      for(value in bestAttribute)
         nodes.push(Training(data given bestAttribute == value))
    
   nodes = Prune(nodes, data)
    
   return nodes
  
function Prune(nodes)
   errorOfChilderen = 0
   for each node in nodes
      errorOfChilderen += ClassifyByMajorityClass(data given attribute == value)
    
   errorOfParent = ClassifyByMajorityClass(data)
  
   if errorOfParent < errorOfChilderen
      return \{\}
   else
      return nodes

function Testing(data)
   for(row in data)
      results += Classify(row, tree)
   return results

function Classify(row, tree)
   if(IsLeaf(tree))
      return tree.class
  	
   return Classify(row, tree.nodeForValue(row[tree.attribute]))
\end{alltt}
\caption{Pseudo code of C4.5}\label{fig:pseudoCode-c45}
\end{figure}
