Given an integer array a[o..n-1], please design an algorithm to output all the a[i] which satisfy…

III. Program Complexity and Design Technique (1) Given an integer array alo..n-1], please design an algorithm to output all the ali] which satisfy: all the elements from a[0] to ali] are larger than or equal to ali], and all the elements from ali to aIn-1] are less than or equal to alid then output: 32, 22, 19 For example a 0.4] 132, 22, 19, 6, 10 Assuming there are n elements in the integer array. Now the time complexity and space complexity of your algorithm are both restricted to o(m). Please design and implement an algorithm to solve this problem. Explain your idea first, and implement it using pseudocode (2) Now we will see how prior knowledge about data distribution can allow us to achieve a faster sorting algorithm. Assume for the given integer array alo..n-1], all the integers ali], 0 S i S n-1, are in the range [0..99]. Please design and implement a sorting algorithm to sort the integer array, whose time complexity is restricted to 0 Cn) Explain your idea first, and implement it either using Java, C/C++ code or pseudocode.

Given an integer array a[o..n-1], please design an algorithm to output all the a[i] which satisfy: all the elements from a[0] to a[i] are larger than or equal to a[i], and all the elements from a[i] to a[n-1] are less than or equal to a[i] For example: a [0.4] = {32, 22, 19, 6, 10}; then output: 32, 22, 19 Assuming there are n elements in the integer array. Now the time complexity and space complexity of your algorithm are both restricted to o(n). Please design and implement an algorithm to solve this problem. Explain your idea first, and implement it using pseudocode Now we will see how prior knowledge about data distribution can allow us to achieve a faster sorting algorithm. Assume for the given integer array a[o..n-1], all the integers a[i], 0 lessthanorequalto I lessthanorequalto n-1, are in the range [0..99]. Please design and implement a sorting algorithm to sort the integer array, whose time complexity is restricted to 0(n) Explain your idea first, and implement it either using Java, C/C++ code or pseudocode.

Found something interesting ?

• On-time delivery guarantee
• PhD-level professional writers
• Free Plagiarism Report

• 100% money-back guarantee
• Absolute Privacy & Confidentiality
• High Quality custom-written papers

Related Model Questions

Feel free to peruse our college and university model questions. If any our our assignment tasks interests you, click to place your order. Every paper is written by our professional essay writers from scratch to avoid plagiarism. We guarantee highest quality of work besides delivering your paper on time.

Grab your Discount!

25% Coupon Code: SAVE25
get 25% !!