Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Find the time complexity of the below functions in O form. Write NA if the function does not apply to any case. a) T(n)=3T(n/2)+n b)

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

Find the time complexity of the below functions in O form. Write NA if the function does not apply to any case. a) T(n)=3T(n/2)+n b) T(n)=64T(n/8)n2(logn) c) T(n)=2nT(n/2)+nn d) T(n)=3T(n/3)+n/2 e) T(n)=7T(n/3)+n2 PART 2 PROBLEM STATEMENT You are working as a software engineer in a Financial Company, Stockers. Stockers is a leading MNC that specializes in analyzing a company's shares and consulting investors/traders. Till today the company is working manually and wants to be digital. As a Software Engineer, you are required to code user stories and create the first version of the application. The Application will accept the no of companies N, that the user wants to store records of. a) Users will enter the share price(double format) of N companies. b) Users will enter a boolean value(TRUE, FALSE) of each company, to keep track of the company's share price compared to yesterday. The user will enter value through the console. Insight: If today the share price of the company is greater than that of yesterday then the user will input TRUE, else the user will input FALSE. In the given test cases true, false values are entered randomly. You can also input values TRUE/FALSE on your own. USER can perform the following operations in the application: 1. Display the companies stock prices in ascending order 2. Display the companies stock prices in descending order 3. Display the total no of companies for which stock prices rose today 4. Display the total no of companies for which stock prices declined today 5. Search a specific stock price /lit will only display whether the stock price is present or not. Practice Assessment - Algorithms Note: The time complexity(average, best, worst) of the sorting function used should not be more than O(nlogn). Consider the following test cases/ sample output TESTCASE 1 enter the no of companies 1 Enter current stock price of the company 1 112.02 Whether the company's stock price rose today compared to yesterday? Enter the operation that you want to perform 1. Display the companies stock prices in ascending order 2. Display the companies stock prices in descending order 3. Display the total no of companies for which stock prices rose today 4. Display the total no of companies for which stock prices declined today 5. Search a specific stock price 6. press 0 to exit 1 Stock prices in ascending order are : 112.02 Enter the operation that you want to perform 1. Display the companies stock prices in ascending order 2. Display the companies stock prices in descending order 3. Display the total no of companies for which stock prices rose today 4. Display the total no of companies for which stock prices declined today 5. Search a specific stock price 6. press 0 to exit Enter the operation that you want to perform 1. Display the companies stock prices in ascending order 2. Display the companies stock prices in descending order 3. Display the total no of companies for which stock prices rose today 4. Display the total no of companies for which stock prices declined today 5. Search a specific stock price 6. press 0 to exit 3 Total no of companies whose stock price rose today : 1 Enter the operation that you want to perform 1. Display the companies stock prices in ascending order 2. Display the companies stock prices in descending order 3. Display the total no of companies for which stock prices rose today 4. Display the total no of companies for which stock prices declined today 5. Search a specific stock price 6. press 0 to exit 4 Total no of companies whose stock price declined today : 0 Enter the operation that you want to perform 1. Display the companies stock prices in ascending order 2. Display the companies stock prices in descending order 3. Display the total no of companies for which stock prices rose today 4. Display the total no of companies for which stock prices declined today 5. Search a specific stock price 6. press 0 to exit Stock of value 112.02 is present Enter the operation that you want to perform 1. Display the companies stock prices in ascending order 2. Display the companies stock prices in descending order Practice Assessment - Algorithms 3. Display the total no of companies for which stock prices rose today 4. Display the total no of companies for which stock prices declined today 5. Search a specific stock price 6. press 0 to exit 0 Exited successfully Explanation: User has given input of only 1 company and its share rose today compared yesterday as the user has given input true. Hence, Total no of companies whose stock price rose today : 1 Total no of companies whose stock price declined today : 0 TESTCASE 2 enter the no of companies Enter current stock price of the company 1 10.25 Whether company's stock price rose today compare to yesterday? false Enter current stock price of the company 2 200.02 Whether company's stock price rose today compare to yesterday? true Enter the operation that you want to perform 1. Display the companies stock prices in ascending order 2. Display the companies stock prices in descending order 3. Display the total no of companies for which stock prices rose today 4. Display the total no of companies for which stock prices declined today 5. Search a specific stock price 6. press 0 to exit 3 Total no of companies whose stock price rose today : 1 Enter the operation that you want to perform 1. Display the companies stock prices in ascending order 2. Display the companies stock prices in descending order 3. Display the total no of companies for which stock prices rose today 4. Display the total no of companies for which stock prices declined today 5. Search a specific stock price 6. press 0 to exit 0 Exited successfully Explanation : there is only 1 company among two companies whose stock today (i.e company's 2 input was true) Hence, Total no of companies whose stock price rose today : 1 TESTCASE 3 enter the no of companies 3 Enter current tock price of the company 1 10.25 Whether company's stock price rose today compare to yesterday? false Enter current stock price of the company 2 85.25 Whether company's stock price rose today compare to yesterday? true Enter current stock price of the company 3 52.25 Whether company's stock price rose today compare to yesterday? true Enter the operation that you want to perform 1. Display the companies stock prices in ascending order 2. Display the companies stock prices in descending order 3. Display the total no of companies for which stock prices rose today 4. Display the total no of companies for which stock prices declined today Enter the operation that you want to perform 1. Display the companies stock prices in ascending order 2. Display the companies stock prices in descending order 3. Display the total no of companies for which stock prices rose today 4. Display the total no of companies for which stock prices declined today 5. Search a specific stock price 6. press 0 to exit 2 Stock prices in descending order are : 85.2552.2510.25 Enter the operation that you want to perform 1. Display the companies stock prices in ascending order 2. Display the companies stock prices in descending order 3. Display the total no of companies for which stock prices rose today 4. Display the total no of companies for which stock prices declined today 5. Search a specific stock price 6. press 0 to exit 2 Stock prices in descending order are : 85.2552.2510.25 Enter the operation that you want to perform 1. Display the companies stock prices in ascending order 2. Display the companies stock prices in descending order 3. Display the total no of companies for which stock prices rose today 4. Display the total no of companies for which stock prices declined today 5. Search a specific stock price 6. press 0 to exit 3 Total no of companies whose stock price rose today : 2 Enter the operation that you want to perform 1. Display the companies stock prices in ascending order 2. Display the companies stock prices in descending order 3. Display the total no of companies for which stock prices rose today 4. Display the total no of companies for which stock prices declined today 5. Search a specific stock price 6. press 0 to exit 4 Total no of companies whose stock price declined today : 1 Enter the operation that you want to perform 1. Display the companies stock prices in ascending order Total no of companies whose stock price declined today : 1 Entor the oporation that you want to porform 1. Display the companies stock prices in ascending order 2. Display the companies stock prices in descending order 3. Display the total no of companies for which stock prices rose today 4. Display the total no of companies for which stock prices declined today 5. Search a specific stock price Practice Assessment - Algorithms 6. press 0 to exit 5 enter the key value 10.25 Stock of value 10.25 is present Enter the operation that you want to perform 1. Display the companies stock prices in ascending order 2. Display the companies stock prices in descending order 3. Display the total no of companies for which stock prices rose today 4. Display the total no of companies for which stock prices declined today 5 Search a snecific stock nrice 6. press 0 to exit 0 Exited successfully TESTCASE 4 enter the no of companies 1 Enter current stock price of the company 1 10.25 Whether company's stock price rose today compare to yesterday? false Enter the operation that you want to perform 1. Display the companies stock prices in ascending order 2. Display the companies stock prices in descending order 3. Display the total no of companies for which stock prices rose today 4. Display the total no of companies for which stock prices declined today 5. Search a specific stock price 6. press 0 to exit 4 Total no of companies whose stock price declined today : 1 Enter the operation that you want to perform 1. Display the companies stock prices in ascending order Enter the operation that you want to perform 1. Display the companies stock prices in ascending order Practice Assessment - Algorithm 2. Display the companies stock prices in descending order 3. Display the total no of companies for which stock prices rose today 4. Display the total no of companies for which stock prices declined today 5. Search a specific stock price 6. press 0 to exit 5 enter the key value 10 Value not found Enter the operation that you want to perform 1. Display the companies stock prices in ascending order 2. Display the companies stock prices in descending order 3. Display the total no of companies for which stock prices rose today 4. Display the total no of companies for which stock prices declined today 5. Search a specific stock price 6. press 0 to exit

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions