HEAPS AND HEAPSORT

  HEAPS: The (binary) heap data structure is an array object that can be viewed as a nearly complete binary tree. Each node of the tree corresponds to an element of the array that stores the value in the node The tree is completely filled on all levels except possibly the lowest, which is filled … Continue reading HEAPS AND HEAPSORT

RECURRENCE RELATION

A recurrence relation is an equation that recursively defines a sequence where the next term is a function of the previous term.   TOWER OF HANOI To move n>1 disk from peg1 to peg3. We first move recursively n-1 disk from peg1 to peg2 using peg3 as an auxiliary. [Number of moves= M (n-1)] Move … Continue reading RECURRENCE RELATION