24 Aug Instructions 1) You can use any coding language of your choice.
Instructions
1) You can use any coding language of your choice.
2) Please write appropriate test cases for your code.
3) Please share the code and paste screenshots of your output(if available)
4) The code need not be complete. Feel free to inundate them with comments. We are trying to test only your thought process and algorithmic thinking
QUESTIONS
1. Sort a linked list using insertion sort.
Algorithm of Insertion Sort:
1. Insertion sort iterates, consuming one input element each repetition, and growing a sorted output list.
2. At each iteration, insertion sort removes one element from the input data, finds the location it belongs within the sorted list, and inserts it there.
3. It repeats until no input elements remain.
Example 1:
Input: 4->2->1->3
Output: 1->2->3->4
2. A subarray A[i], A[i+1], …, A[m] of A is said to be composite if and only if:
- For i<= m<m, A[m] > A[m+1] when m is odd, and A[m] < A[m+1] when m is even;
- OR, for i<= m<m, A[m] > A[m+1] when m is even, and A[m] < A[m+1] when m is odd.
That is, the subarray is composite if the comparison sign flips between each adjacent pair of elements in the subarray.
Return the length of a maximum size composite subarray of A.
Example 1:
Input: [9,4,2,10,7,8,8,1,9]
Output: 5
Explanation: (A[1] > A[2] < A[3] > A[4] < A[5])
Example 2:
Input: [4,8,12,16]
Output: 2
Example 3:
Input: [100]
Output: 1
Note:
1. 1 <= LENGTH(A)<= 40000
2. 0 <= A[i] <= 10^9
Our website has a team of professional writers who can help you write any of your homework. They will write your papers from scratch. We also have a team of editors just to make sure all papers are of HIGH QUALITY & PLAGIARISM FREE. To make an Order you only need to click Ask A Question and we will direct you to our Order Page at WriteDemy. Then fill Our Order Form with all your assignment instructions. Select your deadline and pay for your paper. You will get it few hours before your set deadline.
Fill in all the assignment paper details that are required in the order form with the standard information being the page count, deadline, academic level and type of paper. It is advisable to have this information at hand so that you can quickly fill in the necessary information needed in the form for the essay writer to be immediately assigned to your writing project. Make payment for the custom essay order to enable us to assign a suitable writer to your order. Payments are made through Paypal on a secured billing page. Finally, sit back and relax.
About Writedemy
We are a professional paper writing website. If you have searched a question and bumped into our website just know you are in the right place to get help in your coursework. We offer HIGH QUALITY & PLAGIARISM FREE Papers.
How It Works
To make an Order you only need to click on “Order Now” and we will direct you to our Order Page. Fill Our Order Form with all your assignment instructions. Select your deadline and pay for your paper. You will get it few hours before your set deadline.
Are there Discounts?
All new clients are eligible for 20% off in their first Order. Our payment method is safe and secure.
