Question
What is the complexity of the following tasks? Give a rationale for your answer (20 marks: 1 mark for the complexity and 1 mark for
What is the complexity of the following tasks? Give a rationale for your answer
(20 marks: 1 mark for the complexity and 1 mark for the rationale, each)
1)Using Heap-sort to find the largest number in a given list of size n.
2)Sorting a list of n elements using Quick-Sort algorithm.
3)Finding the largest two elements in a descending ordered queue of size n.
4)Finding the second smallest element in a linked-list of size n.
5)Remove an item from a random stack data-structure of size n.
6)Inserting an item to a queue data-structure, which has already n element.
7)Finding the median of a list of sorted items in a queue of size n.
8)Sorting a sorted list of n elements using Merge-Sort algorithm.
9)Finding the mathematical average for a given list of items stored in a stack of size n.
10)Computing factorial n in a recursive approach.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started