You are on page 1of 1

ASSIGNMENT 04

CS14950
Instructions:
1. This paper has 4 questions. Attempt all.
2. You must submit individual code files for every question. Your files should be
named as follow:
<Your_Roll_No.>_CS14950_<AsgnNo>_<Question_Number>.py
For example: 21PY124_CS14950_Asgn03_Q2a.py
3. You must submit the code file in the following link:
www.CS14950_A1.com
Topic: Heap
Question 01[5]**
Given a list of numbers, find the smallest number.
Constraints: O(n) time.
Input: [2,5,4,8,6,1,4,2,9,0,5,3,5]
Output: 0
Question 02[15]
Given a list of length N turn the list into heap and print the heap.
Input: [1,2,3,4,7,9,10,8,16,14]
Output:
1
2 3
4 7 9 10
8 16 14 null null null null null
Constraint:
1<N<100
Question 03[15]**
Given a list print the kth largest number in the list.
Input: [1,2,3,4,7,9,10,8,16,14], 5
Output: 7

** You are not allowed to use library functions in this question.

You might also like