1. Sorting
Sorting is the process of placing elements from a collection in some kind of Order.
2. Types of sorts :
4. heap in computer science?:Assume that data is in the form of group like heap(In “tree
Data structure” data is in the form of heap)
5.tree
non-premitive DS
non-linear DS
Tree
data is in the form of hierarchy(like Parent, Child relations), explain parent and child with
example..
Attributes of Tree
Types of tree:
many types tree, but we are implementing heap sort using BINARY TREE
Why Tree:
Binary Tree:
A tree whose elements have at most 2 children is called a binary tree. Since each element in a
binary tree can have only 2 children, we typically name them the left and right child.
Tree node have three part(data, pointer to left child, pointer to right child)
(Give explanation with diagram)
A complete binary tree is just like a full binary tree, but with two major differences
Heap Sort: Heap sort is a comparison based sorting technique based on Binary Heap
data structure.
A Binary Heap is a Complete Binary Tree where items are stored in a special order
such that value in a parent node is greater than the values in its two children nodes.
Representation
Binary Tree, it can be easily represented as array and array based representation is space
efficient. If the parent node is stored at index i, the left child can be calculated by 2 * i + 1 and
right child by 2 * i + 2 (assuming the indexing starts at 0).
Start
Stop