Unit-II

advertisement
Unit II- Tree structures
Session 1:
Time :20 minutes
Topic: Definition -Trees
Activity: Board activity
Description: Trees concept was highlighted on the board
The points were
1. Trees- collection of Nodes
2. Root, children and leaves, siblings
3. Definition of Path, length ,depth,Height,degree and level of the tree.
Time: 20 minutes
Topic: Tree traversal with an application
Activity: Presentation and Board activity
Description:
Tree concept was explained through PPT slides.
The concepts was highlighted on the board
1. Inorder Traversal
2. Preorder Traversal
3. Postorder Traversal
Time: 10 minutes
Topic: Conclusion
Activity: Question and Answer
1.
2.
3.
4.
5.
6.
7.
8.
What is tree?
Define root,node and leaves of tree.
Define path of a tree.
Compare height and depth of tree.
Define length of path.
Define ancestor and descendent nodes
Define degree of node
Define Level of tree.
H.Ambika,AP/CSE,VRS college of Engg & Tech,Arasur
CS2202 Datastructures
Website Links:
1. en.wikipedia.org/wiki/Tree_(data_structure
2. www.cse.unt.edu/~rada/CSCE3110/Lectures/Trees.ppt
3. ebookbrowse.com/cs/cs2202
4. en.wikipedia.org/wiki/Tree_traversal
5. www.cse.unt.edu/~rada/CSCE3110/Lectures/Trees.ppt
6. www.youtube.com/watch?v=gvPOTGGnn8k
H.Ambika,AP/CSE,VRS college of Engg & Tech,Arasur
CS2202 Datastructures
Session 2:
Time :10 minutes
Topic: Recap: Trees and tree traversals
Activity: Quiz
Description: Teacher divides the learners into 3 teams and ask quiz related to the previous
class points. The questions were
9. What is tree?
10. Define root,node and leaves of tree.
11. Define path of a tree.
12. Compare height and depth of tree.
13. Define length of path.
14. Define ancestor and descendent nodes
15. Define degree of node
16. Define Level of tree.
17. What is inorder traversal?
18. What is preorder traversal?
19. What is postorder traversal?
20. What is traversal?
Time: 30 minutes
Topic: Left child right sibling data structures for general trees
Activity: Writing Board
Description:
List concept was explained through PPT slides.
The concepts was highlighted on the board
1. Arrows that point downward are first child pointers
2. Arrows that go left to right are next sibling pointers
3. Null pointers are not drawn because there are too many.
Time: 10 minutes
Topic: Conclusion
Activity: Show and tell
1
/
/
/
2---3---4
/
/
H.Ambika,AP/CSE,VRS college of Engg & Tech,Arasur
CS2202 Datastructures
5---6 7
/
8---9
Website Links:
1. www.cs.utexas.edu/~novak/cs315115.html
2. programmers.stackexchange.com/.../are-trees-organised-by-a-firstchild-n...
3. xlinux.nist.gov/dads/HTML/binaryTreeRepofTree.html
H.Ambika,AP/CSE,VRS college of Engg & Tech,Arasur
CS2202 Datastructures
Session 3:
Time :20 minutes
Topic: Binary trees
Activity: Presentation and Unspoken words
Description: Trees concept was highlighted on the board
The points were
4.
5.
6.
7.
8.
Tree with no node more than two children
Full binary tree
Perfect binary tree
Complete binary tree
Atmost complete binary tree
Time: 20 minutes
Topic: Implementation of Binary trees
Activity: Presentation and Board activity
Description: The slides were presented and points are
1. Linear representation
2. Linked representation
Time: 10 minutes
Topic: Conclusion
Activity: Recall the keywords
1.
2.
3.
4.
5.
6.
7.
Binary tree
Tree with two childrens for each node
Linear binary tree
Binary tree operations
Insert, delete operations
Left child (2i)
Right child(2i+1)
Website Links:
1. en.wikipedia.org/wiki/Binary_tree
2. www.cis.upenn.edu/~matuszek/cit594-2004/.../14-binary-trees.ppt
3. www.cis.upenn.edu/~matuszek/cit594-2012/.../09-binary-trees.ppt
H.Ambika,AP/CSE,VRS college of Engg & Tech,Arasur
CS2202 Datastructures
Session 4:
Time :20 minutes
Topic: Expression trees
Activity: Board activity
Description: Trees concept was highlighted on the board
The points were
9. Binary Tree with leaf nodes are operands and interior nodes are operators.
10. Using postfix expression
11. Steps in drawing expression trees
Time: 20 minutes
Topic: Example of Expression trees
Activity: Presentation and Discussion
Description: The slides were presented and points are




Read one symbol from postfix expression
Check whether symbol is an operand or operator,
A) if symbol is an operand, create one node tree and push a pointer onto stack.
B) If symbol is operator pop two symbols and from new tree with root as operator and
T1 as left child and T2 as right child. Pointer to this new tree is pushed onto stack.
Time: 10 minutes
Topic: Conclusion
Activity: Learner led activity
The problems was solved on the board by the learners step by step.
Eg: ab+cde+* *
Website Links:
1. en.wikipedia.org/wiki/Binary_expression_tree
2. cs.nyu.edu/courses/fall11/CSCI-GA.1133-001/.../Expression_Trees.pdf
3. www.cse.unr.edu/~bebis/CS308/PowerPoint/BinaryExpressionTrees.ppt
4. www.csd.uwo.ca/~vmazalov/CS1027a/notes/CS1027-Trees.ppt
H.Ambika,AP/CSE,VRS college of Engg & Tech,Arasur
CS2202 Datastructures
Session 5:
Time :05 minutes
Topic: Application of trees
Activity: Board activity
Description: Application of trees were discussed on board and point were
1.Files ,menu system
2. Indexes in a book
3. Internet protocols
4. Compiler
5. Databases
Time: 20 minutes
Topic: Tree expressions
Activity: Presentation and Board activity
Description: The slides were presented and points are
3. Linear representation
4. Linked representation
Time: 20 minutes
Topic: Tree traversals
Activity: Presentation and Board activity
The traversals were presented and points were
Inorder traversal(LVR)
Preorder traversal(VLR)
Post order traversal(LRV)
Time: 05 minutes
Topic: Conclusion
Activity: Learner led activity
Problems were given to students to solve on the board.
H.Ambika,AP/CSE,VRS college of Engg & Tech,Arasur
CS2202 Datastructures
Website Links:
1. tcs.snu.ac.kr/DS10-slides/DS10-lec15.ppt
2. en.wikipedia.org/wiki/Tree_traversal
3. www.math.ucla.edu/~wittman/10b.1.10w/Lectures/Lec18.pdf
4. nova.umuc.edu/~jarc/idsv/lesson1.html
Session 6:
Time :10 minutes
Topic: Introduction
Activity: Board activity
Description:Binary Search Trees concept was highlighted on the board
The point were
1. Binary tree
2. Left subtree values should be smaller than key value in root.
3. Right subtree value should be larger than key value in root.
Time: 30 minutes
Topic: Binary search trees
Activity: Presentation videos
Description: video was shown to the learners
http://www.youtube.com/watch?v=l0Z3E1n8kmk
Time: 10 minutes
Topic: Conclusion
Activity: Learner led activity
Insertion into binary tree was trained for the students with various examples.
H.Ambika,AP/CSE,VRS college of Engg & Tech,Arasur
CS2202 Datastructures
Website Links:
1. en.wikipedia.org/wiki/Binary_search_tree
2. www.cs.princeton.edu/~rs/AlgsDS07/08BinarySearchTrees.pdf
3. www.cs.colorado.edu/~main/supplements/chapt10b.ppt
Session 7:
Time: 20 minutes
Topic: recap: Binary search tree
Activity: Presentation and Board activity
Description: Trees concept was highlighted on the board
The points were
12. Binary tree with node on LST lesser than root and node on RST greater than root.
13. Operation on Binary Search tree
Time: 30 minutes
Topic: Operation on Binary search ADT
Activity: Presentation and Board activity
Description: The slides were presented and points are
5.
6.
7.
8.
Insert
Delete
Find Min
Find max
Time: 10 minutes
Topic: Conclusion
Activity: Group Discussion
Students were Splitted into 2 groups. And they were asked to discuss on difference between
Binary tree and Binary Search tree.The points were
Binary tree has only two nodes. And no constraint on value of each node.
Binary Search tree is also Binary tree with node on LST lesser than root and node on RST
greater than root.
Binary tree cannot be Binary search tree but BST can be Binary tree.
H.Ambika,AP/CSE,VRS college of Engg & Tech,Arasur
CS2202 Datastructures
Website Links:
1. en.wikipedia.org/wiki/Binary_search_tree
2. www.cs.nthu.edu.tw/~wkhon/algo08-tutorials/tutorial-bst.pdf
3. www.eshikshak.co.in › Data Structure › TREE
4. www.cs.cmu.edu/~clo/www/CMU/DataStructures/...//lesson4_2.htm
Session 8:
Time :20 minutes
Topic: Binary tree operations
Activity: Presentation and Unspoken words
Description: Trees concept was highlighted on the board
The points were



Binary search tree definition
Insert algorithm
Deletion algorithm
Time: 20 minutes
Topic: Insert,Delete and Average Case Analysis
Activity: Learner Led presentation
Description: The slides were presented and points are
9. Insertion algorithm
10. Deletion algorithm
11. Average case Analysis
Time: 10 minutes
Topic: Conclusion
Activity: Show and tell. Students were asked to delete 6,13,14 from below binary search tree.
And output was drawn on the board.
H.Ambika,AP/CSE,VRS college of Engg & Tech,Arasur
CS2202 Datastructures
Website Links:
1. lcm.csa.iisc.ernet.in/dsa/node92.html
www.cpsc.ucalgary.ca/~jacobs/Courses/.../W12/.../lecture14-example.ht...
2. alg12.wikischolars.columbia.edu/file/view/BST.pdf
3. www.cse.unt.edu/~rada/CSCE3110/Lectures/BinarySearchTrees.ppt
Session 9:
Time :20 minutes
Topic: Introduction
Activity: Writing Board
Description: Trees concept was highlighted on the board
The points were
Threaded Binary tree is binary tree in which each node is threaded towards either the
inorder predecessor or successor.
Time: 20 minutes
Topic: Threaded Binary trees
Activity: Writing Board
Description: The slides were presented and points are
Single Threaded: each node is threaded towards either the inorder
predecessor or successor.
Time: 10 minutes
Topic: Conclusion
Activity: Recall the keywords
1. Binary tree
2. Binary search tree
3. Single Threaded: each node is threaded towards either the inorder
predecessor or successor.
Website Links:
H.Ambika,AP/CSE,VRS college of Engg & Tech,Arasur
CS2202 Datastructures
1. en.wikipedia.org/wiki/Threaded_binary_tree
2. www.mec.ac.in/resources/notes/notes/ds/thread.htm
www.cs.berkeley.edu/~kamil/teaching/su02/080802.ppt
3. techforum4u.com › Forum › Software Development › Data Structure
H.Ambika,AP/CSE,VRS college of Engg & Tech,Arasur
CS2202 Datastructures
Download