CS301 Assignment 3 ...

Share:
Clear all

# [Solved] CS301 Assignment 3 Spring 2020

(@talhaofficial0)
Moderator
Joined: 1 year ago
Posts: 25
30/07/2020 5:20 am

Assignment No. 03
Semester Spring 2020

CS301- Data Structures

Total Marks: 20

Due Date: August 7, 2020

Instructions

It should be clear that your assignment will not get any credit (zero marks) if:

o        The assignment is submitted after due date or via email.

o        The submitted assignment is other than .doc or .docx file.

o        The submitted assignment does NOT open or file is corrupted.

o        The assignment is copied (from other student or ditto copy from handouts or internet).

For clarity and simplicity, You are required to Upload/Submit only ONE .doc or .docx file.

Objective

The objective of this assignment is

o   To make you familiar with the concept of Complete binary tree and Heap Data structure.

For any query about the assignment, contact at [email protected]

GOOD LUCK

Problem Statement:

Heap is a complete binary tree that conforms to the heap order. The heap order is a property that states that in a (min) heap for every node X, the key in the parent is smaller than (or equal to) the key in X and in a (max) heap for every node X, the key in the parent is greater than (or equal to) the key in X.

Given below is an array representing complete Binary tree.

 2 3 4 6 16 19 24 8 11 20 23 30

Data

Array index    0        1         2        3        4        5    6         7        8        9       10       11      12      13

Note: The data elements in the array have been stored, starting from the index 1.

a)      You are required to draw a complete binary tree from the above given array. After drawing a tree, identify which type of heap data structure is it showing either min heap or max heap?

b)      Let’s suppose, we insert a new value at an array index 13 then draw a heap tree after inserting a new node. Also show the changes done in array.

 2 3 4 6 16 19 24 8 11 20 23 30 1

Data

Array index   0        1         2        3        4        5     6         7        8        9       10       11      12      13

Lectures Covered:  This assignment covers up to Lecture # 30

This topic was modified 1 week ago by admin

Topic Tags
Joined: 2 years ago
Posts: 3608
06/08/2020 8:35 pm

CS301 Assignment 3 Solution idea: