image thumbnail

Comparison of C++, Java, Python, Ruby and MATLAB Using Object Oriented Example

by

 

28 Feb 2008 (Updated )

RedBlack Tree Binary Search Example Used to Compare of C++, Java™, Python, Ruby and MATLAB® Code

Editor's Notes:

This file was selected as MATLAB Central Pick of the Week

NodeVisitor
classdef NodeVisitor < handle
    % Inheriting from handle class provides reference behavior
    % Copyright 2008-2009 The MathWorks, Inc

    methods
        function visit(self,node,depth)
            if ~isempty(node.val)
                fprintf('(%d:%d:%d), ', node.val, node.color, depth);
            end
        end
    end
end

Contact us