Simpler Insertion Sort Function

Return to Xholon khan computer-science.

All of the code on this page can be edited in place.


Python code

This code was provided in the Khan Academy video.

Try at ideone.com. Select only the lines from the above script that are between the opening and closing <script> tags.

Try at Xholon Chameleon. Select File > Open. Locate the Model > CompositeStructureHierarchy > Chameleon node (chameleon_0) in the tree. Select the entire above script, including the opening and closing <script> tags, and drag it on top of the Chameleon node. Or use copy and paste(right-click the Chameleon node and select Edit > Paste Last Child). The result should appear in the Java console.


Xholon-specific Python code

This is based on what I learned about Python lists from the Khan Academy video.

Try at Xholon Chameleon. Select File > Open. Locate the Model > CompositeStructureHierarchy > Chameleon node (chameleon_0) in the tree. To have the script do something meaningful, you should first select (click, control-click, and shift-click) several of the nodes in the tree. Select the entire above script, including the opening and closing <script> tags, and drag it on top of the Chameleon node. Or use copy and paste(right-click the Chameleon node and select Edit > Paste Last Child). The result should appear in the Java console.

This page uses CodeMirror.