Московский Государственный Университет им. Циолковского
Студент : Заливнов Олег
Группа : 5МС-II-23
Лекция : 8
Тема : Деревья
TREES
Plan:
1)The tree presenation of data constructions.
2) What is tree?
a) definition
b) the terminology
c) types of trees
3) Tree applications in encoding systems.
Elementar data can have different types (string,integer and so on). But if to talk about complex data construction it have no type. Complex data constructions consist of simple data, and CDC are stored as data searching algorithm. and that is why CDC are the "selectors" - mechanism of searching and accesing of data.
Such kinds of data as complex data constructions are need to organize search.
We can describe CDC in different ways. For example we can describe it in the way as it described in the programming language Cobol :
1 University
2 (first fac.)
2 (second fac.) 2 (third fac.) 2 (fourth fac.) 2 fifth fac.
3 PM
4 (Pasha)
4 (Andrey) 3 IT
4 (Zhenia) 4 (Olga)
3 MS
4 (Oleg)
4 (Helen)
4 (Artem).
Where the word in brackets (e.g. (Oleg) means the elementary data construction).
The most powerful way of description a CDC is a tree.
NOW WHAT IS TREE ?
Tree is a connected undirected graph with no simple circuits. So a tree cannot contain multile edges or loops, and so tree is a simple graph.
Example 1 :
D ----------- A ------------ C ¦ ¦ ¦
¦ ¦ ¦
¦ B ---- F ¦
¦ ¦
E H ---- G ----- I ----- J
this is a tree ;
Example 2 :
E ---------- A ---------- B
¦ ¦ ¦
¦ ¦ ¦
F D----------- C
it is not the tree, because path A-B-C-D is a loop;
Example 3 :
A ------- B
¦
D ----+---- E ------ F
¦
C
it is not the tree too because this graph is not connected;
Also we can select a special vertex and call it a root and assign the direction to each edge. And we call such tree a ROOTED tree.
Example 4 :
A ---- B A ---