You are on page 1of 1

ASSIGNMENT 04

CS14950 AK TM: 35
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]** 0 for no output
0 for >O(n)
Given a list of numbers, find the smallest number.
1 --> N=10 0-->TLE
Constraints: O(n) time. N = len(input) 1 --> N=50 0-->TLE
Input: [2,5,4,8,6,1,4,2,9,0,5,3,5] 1 --> N=100 0.5-->TLE
Output: 0 1 --> N=1000 0.5-->TLE
Question 02[15] 0 for no output
Given a list of length N turn the list into heap and print the heap. -5 from Total if no null printed
Input: [1,2,3,4,7,9,10,8,16,14] -10 if inconsistent spacing
Output: 5 --> N=10 0--> TLE
1 10-->N=100 2-->TLE
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
0 for no output
N is the len(input)

1-->N=5 0-->TLE
2-->N=10 0-->TLE
2-->N=50 0-->TLE
2-->N=100 0-->TLE
3-->N=1000 0.5-->TLE
5-->N=5000 1-->TLE

**Bonus
5-->N=10**5 0-->TLE

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

You might also like