File:AvlTreeExample.svg

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search

Original file (SVG file, nominally 700 × 386 pixels, file size: 100 KB)

Captions

Captions

Add a one-line explanation of what this file represents

Summary

[edit]
Description
English: An example of adding numbers into an AVL tree.
Date
Source Own work
Author Dirk Hünniger

Licensing

[edit]
I, the copyright holder of this work, hereby publish it under the following licenses:
w:en:Creative Commons
attribution share alike
This file is licensed under the Creative Commons Attribution-Share Alike 3.0 Unported license.
You are free:
  • to share – to copy, distribute and transmit the work
  • to remix – to adapt the work
Under the following conditions:
  • attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
  • share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.
GNU head Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled GNU Free Documentation License.
You may select the license of your choice.

How I made it

[edit]

I used graphviz to draw the graph and postprocessed it with inkscape. here is the source file for the dot program which is part of graphviz.

digraph G {
	//size="5,5"
	//ratio=compress
	//compound=true;
	subgraph clusterb1 {
		label="before first roation (single) ";
		node [shape="record"];
		b110[label="<f0>|<f1> 10|<f2>",style=filled,color=grey];
		b120[label="<f0>|<f1> 20|<f2>"];
		b115[label="<f0>|<f1> 15|<f2>"];
		b110:f2->b120;
		b120:f0->b115;	
	}
	subgraph clustera1{
		label="after first roation";
		node [shape="record"];
		a110[label="<f0>|<f1> 10|<f2>"];
		a120[label="<f0>|<f1> 20|<f2>"];
		a115[label="<f0>|<f1> 15|<f2>"];
		a115:f0->a110;
		a115:f2->a120;
	}
	subgraph clusterb2{
		rankdir="TB"
		label="before second roation (single)";
		node [shape="record"];
		b210[label="<f0>|<f1> 10|<f2>"];
		b220[label="<f0>|<f1> 20|<f2>",style=filled,color=grey];
		b215[label="<f0>|<f1> 15|<f2>"];
		b231[label="<f0>|<f1> 31|<f2>"];
		b255[label="<f0>|<f1> 55|<f2>"];
		b215:f0->b210;
		b215:f2->b220;
		b220:f2->b231;
		b231:f2->b255;
	}
	subgraph clustera2{
		rankdir="TB"
		label="after second roation";
		node [shape="record"];
		a210[label="<f0>|<f1> 10|<f2>"];
		a220[label="<f0>|<f1> 20|<f2>"];
		a215[label="<f0>|<f1> 15|<f2>"];
		a231[label="<f0>|<f1> 31|<f2>"];
		a255[label="<f0>|<f1> 55|<f2>"];
		a215:f0->a210;
		a215:f2->a231;
		a231:f2->a255;
		a231:f0->a220;
	}
	subgraph clusterb3{
		rankdir="TB"
		label="before third roation (double)";
		node [shape="record"];
		b310[label="<f0>|<f1> 10|<f2>"];
		b320[label="<f0>|<f1> 20|<f2>"];
		b315[label="<f0>|<f1> 15|<f2>",style=filled,color=grey];
		b331[label="<f0>|<f1> 31|<f2>"];
		b355[label="<f0>|<f1> 55|<f2>"];
		b319[label="<f0>|<f1> 19|<f2>"];
		b315:f0->b310;
		b315:f2->b331;
		b331:f2->b355;
		b331:f0->b320;
		b320:f0->b319;
	}
	subgraph clustera3{
		rankdir="TB"
		label="after third roation";
		node [shape="record"];
		a310[label="<f0>|<f1> 10|<f2>"];
		a320[label="<f0>|<f1> 20|<f2>"];
		a315[label="<f0>|<f1> 15|<f2>"];
		a331[label="<f0>|<f1> 31|<f2>"];
		a355[label="<f0>|<f1> 55|<f2>"];
		a319[label="<f0>|<f1> 19|<f2>"];
		a320:f0->a315;
		a320:f2->a331;
		a331:f2->a355;
		a315:f0->a310;
		a315:f2->a319;
	}
	subgraph clusterb4{
		rankdir="TB"
		label="before fourth roation (single)";
		node [shape="record"];
		b410[label="<f0>|<f1> 10|<f2>",style=filled,color=grey];
		b420[label="<f0>|<f1> 20|<f2>"];
		b415[label="<f0>|<f1> 15|<f2>"];
		b431[label="<f0>|<f1> 31|<f2>"];
		b455[label="<f0>|<f1> 55|<f2>"];
		b419[label="<f0>|<f1> 19|<f2>"];
		b408[label="<f0>|<f1> 8|<f2>"];
		b404[label="<f0>|<f1> 4|<f2>"];
		
		b420:f0->b415;
		b420:f2->b431;
		b431:f2->b455;
		b415:f0->b410;
		b415:f2->b419;
		b410:f0->b408;
		b408:f0->b404;
	}
	subgraph clustera4{
		rankdir="TB"
		label="after fourth roation";
		node [shape="record"];
		a410[label="<f0>|<f1> 10|<f2>"];
		a420[label="<f0>|<f1> 20|<f2>"];
		a415[label="<f0>|<f1> 15|<f2>"];
		a431[label="<f0>|<f1> 31|<f2>"];
		a455[label="<f0>|<f1> 55|<f2>"];
		a419[label="<f0>|<f1> 19|<f2>"];
		a408[label="<f0>|<f1> 8|<f2>"];
		a404[label="<f0>|<f1> 4|<f2>"];
		
		a420:f0->a415;
		a420:f2->a431;
		a431:f2->a455;
		a415:f0->a408;
		a415:f2->a419;
		a408:f2->a410;
		a408:f0->a404;
	}
	
	subgraph clusterb5{
		rankdir="TB"
		label="before fifth roation (double)";
		node [shape="record"];
		b510[label="<f0>|<f1> 10|<f2>"];
		b520[label="<f0>|<f1> 20|<f2>"];
		b515[label="<f0>|<f1> 15|<f2>",style=filled,color=grey];
		b531[label="<f0>|<f1> 31|<f2>"];
		b555[label="<f0>|<f1> 55|<f2>"];
		b519[label="<f0>|<f1> 19|<f2>"];
		b508[label="<f0>|<f1> 8|<f2>"];
		b504[label="<f0>|<f1> 4|<f2>"];
		b511[label="<f0>|<f1>11|<f2>"];
		
		b520:f0->b515;
		b520:f2->b531;
		b531:f2->b555;
		b515:f0->b508;
		b515:f2->b519;
		b508:f2->b510;
		b508:f0->b504;
		b510:f2->b511;
		
	}
	subgraph clustera5{
		rankdir="TB"
		label="after fifth roation";
		node [shape="record"];
		a510[label="<f0>|<f1> 10|<f2>"];
		a520[label="<f0>|<f1> 20|<f2>"];
		a515[label="<f0>|<f1> 15|<f2>"];
		a531[label="<f0>|<f1> 31|<f2>"];
		a555[label="<f0>|<f1> 55|<f2>"];
		a519[label="<f0>|<f1> 19|<f2>"];
		a508[label="<f0>|<f1> 8|<f2>"];
		a504[label="<f0>|<f1> 4|<f2>"];
		a511[label="<f0>|<f1>11|<f2>"];
		
		a520:f0->a510;
		a510:f2->a515;
		a510:f0->a508;
		a508:f0->a504;
		a515:f0->a511;
		a520:f2->a531;
		a531:f2->a555;
		a515:f2->a519;
		
	}

}

File history

Click on a date/time to view the file as it appeared at that time.

Date/TimeThumbnailDimensionsUserComment
current14:52, 4 May 2009Thumbnail for version as of 14:52, 4 May 2009700 × 386 (100 KB)Dirk Hünniger (talk | contribs){{Information |Description={{en|1=An example of adding numbers into an AVL tree.}} |Source=Own work by uploader |Author=Dirk Hünniger |Date=4 May 2009 |Permission= |other_versions= }} <!--{{ImageUpload|full}}--> [[Category:AVL-tr

There are no pages that use this file.