Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
36 views3 pages

Brief Graph and Tree Notes

The document outlines key concepts in graph theory and tree data structures, including BFS traversal, topological sort, and various types of trees such as AVL and Red-Black trees. It also discusses hashing techniques for efficient data retrieval and the properties of different tree traversal methods. Additionally, it covers the degree of vertices and trees, as well as the concept of multigraphs and acyclic graphs.

Uploaded by

krishnajagave
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
36 views3 pages

Brief Graph and Tree Notes

The document outlines key concepts in graph theory and tree data structures, including BFS traversal, topological sort, and various types of trees such as AVL and Red-Black trees. It also discusses hashing techniques for efficient data retrieval and the properties of different tree traversal methods. Additionally, it covers the degree of vertices and trees, as well as the concept of multigraphs and acyclic graphs.

Uploaded by

krishnajagave
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

1.

Algorithm for BFS Traversal of a Graph

BFS explores a graph level by level using a queue.

Steps:

- Enqueue starting node, mark visited.

- Dequeue node, process it, enqueue unvisited neighbors.

2. Applications of Graph

- Social Networks: Represent relationships.

- Network Routing: Find shortest paths.

3. Topological Sort

Ordering vertices such that for every directed edge u -> v, u appears before v.

4. Degree of Vertex

Number of edges connected to a vertex; can be indegree or outdegree.

5. Topological Sort

(Already discussed.)

6. Acyclic Graph

Graph with no cycles, meaning no path starts and ends at same vertex.

7. Multigraph

Graph allowing multiple edges between the same pair of nodes.

8. Hashing vs Rehashing

Hashing: Maps data to table for fast access.


Rehashing: Recomputes hashes when table is resized or too full.

9. Hashing

Hashing maps data via hash function for fast access.

Need: Fast retrieval.

Advantages: Fast access, reduces search time, easy insertion.

10. C Function to Insert in BST

Function recursively inserts data maintaining BST properties.

11. Steps for Creating BST (15, 11, 13, 8, 9, 18, 16)

Insert 15 -> root. 11 left, 13 right of 11, 8 left of 11, 9 right of 8, 18 right of 15, 16 left of 18.

12. Types of Trees

- Binary Tree: Max two children.

- BST: Left child < Node < Right child.

- AVL Tree: Balanced BST.

- B-Tree: Disk storage optimization.

- Heap: Complete binary tree.

13. Tree Traversal Methods

- Inorder: Left, Root, Right.

- Preorder: Root, Left, Right.

- Postorder: Left, Right, Root.

- Level Order: Level by Level.

14. AVL Tree for Mon, Wed, Tue, Sat, Sun, Thur
Balanced using rotations after insertion when imbalance is detected.

15. AVL Tree Concept

AVL Tree maintains balance factor (-1,0,1) after every insertion/deletion.

16. Splay Tree

BST that brings accessed node to the root using rotations to optimize access.

17. Red-Black Tree

Self-balancing BST maintaining color rules: red/black properties.

18. Balance Factor

Difference between height of left and right subtree.

19. Siblings

Nodes sharing same parent in a tree.

20. Degree of Tree

Maximum number of children among all nodes.

You might also like