top schools in delhi ncr

34
Top school in Delhi ncr By: By: School.edhole.com

Upload: edholecom

Post on 17-Nov-2014

89 views

Category:

Education


1 download

DESCRIPTION

it's all about children education

TRANSCRIPT

Page 1: Top schools in delhi ncr

Top school in Delhi ncr

By:By:

School.edhole.com

Page 2: Top schools in delhi ncr

Chapter 10 introduces trees. This presentation illustrates the

simplest kind of trees: Complete Binary Trees.

Complete Binary Trees

Data Structuresand Other ObjectsUsing C++

School.edhole.com

Page 3: Top schools in delhi ncr

Binary Trees

A binary tree has nodes, similar to nodes in a linked list structure.

Data of one sort or another may be stored at each node.

But it is the connections between the nodes which characterize a binary tree.

School.edhole.com

Page 4: Top schools in delhi ncr

Binary Trees

A binary tree has nodes, similar to nodes in a linked list structure.

Data of one sort or another may be stored at each node.

But it is the connections between the nodes which characterize a binary tree.

An example canillustrate how theconnections work

School.edhole.com

Page 5: Top schools in delhi ncr

A Binary Tree of States

In this example, the data contained at each node is one of the 50 states.

School.edhole.com

Page 6: Top schools in delhi ncr

A Binary Tree of States

Each tree has a special node called its root, usually drawn at the top.

School.edhole.com

Page 7: Top schools in delhi ncr

A Binary Tree of States

Each tree has a special node called its root, usually drawn at the top. The example tree

has Washingtonas its root.

School.edhole.com

Page 8: Top schools in delhi ncr

A Binary Tree of States

Each node is permitted to have two links to other nodes, called the left child and the right child.

School.edhole.com

Page 9: Top schools in delhi ncr

A Binary Tree of States

Each node is permitted to have two links to other nodes, called the left child and the right child.

School.edhole.com

Page 10: Top schools in delhi ncr

A Binary Tree of States

Children are usually drawn below a node.

The right child ofWashington is

Colorado.

The left child ofWashington is

Arkansas.

School.edhole.com

Page 11: Top schools in delhi ncr

A Binary Tree of States

Some nodes have only one child.

Arkansas has aleft child, but no

right child.

School.edhole.com

Page 12: Top schools in delhi ncr

A Quiz

Some nodes have only one child.

Which node has

only a right child?School.edhole.com

Page 13: Top schools in delhi ncr

A Quiz

Some nodes have only one child.

Florida hasonly a right child.

School.edhole.com

Page 14: Top schools in delhi ncr

A Binary Tree of States

A node with no children is called a leaf.

School.edhole.com

Page 15: Top schools in delhi ncr

A Binary Tree of States

Each node is called the parent of its children.

Washington is theparent of Arkansas

and Colorado.

School.edhole.com

Page 16: Top schools in delhi ncr

A Binary Tree of States

Two rules about parents:

The root has no parent.

Every other node has exactly one parent.

School.edhole.com

Page 17: Top schools in delhi ncr

A Binary Tree of States

Two nodes with the same parent are called siblings.

Arkansasand Coloradoare siblings.

School.edhole.com

Page 18: Top schools in delhi ncr

Complete Binary Trees

A complete binary tree is a special kind of binary tree which will be useful to us.

School.edhole.com

Page 19: Top schools in delhi ncr

Complete Binary Trees

A complete binary tree is a special kind of binary tree which will be useful to us.

When a completebinary tree is built,

its first node must bethe root.School.edhole.com

Page 20: Top schools in delhi ncr

Complete Binary Trees

The second node of a complete binary tree is always the left child of the root...

School.edhole.com

Page 21: Top schools in delhi ncr

Complete Binary Trees

The second node of a complete binary tree is always the left child of the root...

... and the third node is always the right child of the root.

School.edhole.com

Page 22: Top schools in delhi ncr

Complete Binary Trees

The next nodes must always fill the next level from left to right.

School.edhole.com

Page 23: Top schools in delhi ncr

Complete Binary Trees

The next nodes must always fill the next level from left to right.

School.edhole.com

Page 24: Top schools in delhi ncr

Complete Binary Trees

The next nodes must always fill the next level from left to right.

School.edhole.com

Page 25: Top schools in delhi ncr

Complete Binary Trees

The next nodes must always fill the next level from left to right.

School.edhole.com

Page 26: Top schools in delhi ncr

Complete Binary Trees

The next nodes must always fill the next level from left to right.

School.edhole.com

Page 27: Top schools in delhi ncr

Complete Binary Trees

The next nodes must always fill the next level from left to right.

School.edhole.com

Page 28: Top schools in delhi ncr

Is This Complete?

School.edhole.com

Page 29: Top schools in delhi ncr

Is This Complete?

School.edhole.com

Page 30: Top schools in delhi ncr

Is This Complete?

Yes! It is called the empty

tree, and it has no nodes, not even a root.

School.edhole.com

Page 31: Top schools in delhi ncr

Implementing a Complete Binary Tree

We will store the date from the nodes in a partially-filled array.

An array of dataWe don't care what's inthis part of the array.

An integer to keeptrack of how many nodes are in the tree

3

School.edhole.com

Page 32: Top schools in delhi ncr

Implementing a Complete Binary Tree

We will store the date from the nodes in a partially-filled array.

An array of dataWe don't care what's inthis part of the array.

An integer to keeptrack of how many nodes are in the tree

3

Read Section 10.2 tosee details of how

the entries are stored.School.edhole.com

Page 33: Top schools in delhi ncr

Binary trees contain nodes. Each node may have a left child and a right child. If you start from any node and move upward, you

will eventually reach the root. Every node except the root has one parent. The

root has no parent. Complete binary trees require the nodes to fill in

each level from left-to-right before starting the next level.

Summary

School.edhole.com

Page 34: Top schools in delhi ncr

THE END

Presentation copyright 2010 Addison Wesley Longman,For use with Data Structures and Other Objects Using Javaby Michael Main.

Some artwork in the presentation is used with permission from Presentation Task Force(copyright New Vision Technologies Inc) and Corel Gallery Clipart Catalog (copyrightCorel Corporation, 3G Graphics Inc, Archive Arts, Cartesia Software, Image ClubGraphics Inc, One Mile Up Inc, TechPool Studios, Totem Graphics Inc).

Students and instructors who use Data Structures and Other Objects Using C++ are welcometo use this presentation however they see fit, so long as this copyright notice remainsintact.

School.edhole.com