Skip to content

Latest commit

 

History

History
35 lines (26 loc) · 636 Bytes

README.md

File metadata and controls

35 lines (26 loc) · 636 Bytes

Graphs Implementation


DFS
import java.util.*;
class Main{
    public final int depthfirsts(int node, int result){
            /*PRE ORDER
             *
             * result.push(node,value);
             * */
        
            if(node.left) {
                depthfirsts(node.left, result);
            }
            

            result.push(node,value);
            

            if(node.right){
                depthfirsts(node.right);
            }
            
            /*POST ORDER
             * 
             * result.push(node,value);
             * */
            return result;
    }
}