Posts

Showing posts with the label Computer Science

Tree Data Structure and its Applications

Image
What is Tree Data Structure? A tree is a non-linear data structure as it stores data in a hierarchical manner that consists of nodes connected through edges. It is the best alternative for the linear data structure like arrays, stacks, queues, etc as these linear data structures have high time and space complexity. The data stored in nodes of the tree are easier to access thus reducing the time complexity. Terms related to tree data structure 1. Node A node is an entity that stores a data element and links to its child and parent nodes. 2. Edge  The link between any two nodes is called the edge. 3. Root The root is the transparent node in a tree that is a root node doesn't have any parent node. Here no. 1 is the Root node. 4. Parent and Child Node The node which contains sub-nodes is called the parent node. Here 1 is the parent node for 2 and 3 and 2 is the parent node for 4 and 5. The node which is a descendant of any node is called a child node. Here 2 and 3 are child nod...

Binary Tree Data Structure and Its Types

Image
What is Binary Tree Data Structure? A binary tree is a type of tree in which each parent node have at most two child nodes. Each node of a binary tree has three items. 1. Data item 2. Address if a left child 3. Address of the right child Types of Binary tree 1. Full Binary tree A full binary tree is a type of binary tree in which each parent node have either two or no child nodes. Here 1 has 2 and 3 child nodes. 3 don't have any child nodes. 2. Perfect Binary Tree A perfect Binary tree is a type of binary tree in which each parent node have exactly two child nodes and all leaf nodes are present at some level. Here 1 has 2 and 3 child nodes and 4,5,6,7 leaf nodes are present at some level. 3. Complete Binary tree In a complete binary tree, all the levels are filled. All leaf elements must lean towards the left in a tree structure. The last leaf element might not have the right sibling. 4. Balanced Binary Tree A balanced binary tree is a type of binary tree in which the ...

Relation between Module, Package, Library, Framework in Python

Image
1. Module A module in Python is a collection of functions and global variables having a .py extension. Eg: Date time, Regex, Random, etc. 2. Package A package in Python is a collection of various modules. The package also contains sub-packages inside it. Eg: NumPy, Pandas, etc. 3. Library A library in Python is a collection of various packages which help to perform tasks without writing the code. It can be re-used and can be used just by importing it into the program. Eg: Matplotlib, Seaburn, etc. 4. Framework A Python framework is a comprehensive collection of modules and packages designed to accelerate the development process. Unlike libraries, frameworks are more intricate and provide a structured foundation and architectural guidelines for building applications.