Question

This assignment will test your algorithm/logic development in which you will perform the sort function with some different characteristics.

This assignment will test your algorithm/logic development in which you will perform the sort function with some different characteristics.


You will be required to ensure that your program meets the following requirements:


i.    Existence of an array which can accept an unknown number of positive integers

ii.    ExistenceofafunctionwhichcanperformadifferentsortwheretheEvennumberswillappear first before the Odd numbers. In this sorted sequence, all the even numbers will appear first in descending order followed by the odd numbers (in the same order). You are only allowed to use one array to perform this and NOT allowed to create another temporary array. You may however expand or reduce the size of your dynamic array in any way you wish to perform this sort operation. 


iii.    Perform Best and Worst case analysis of your algorithm. With Complete steps of maths.


Guidelines:

It is better to implement your algorithm in any programing language of your choice


0 0
Add a comment Improve this question Transcribed image text
Request Professional Answer

Request Answer!

We need at least 9 more requests to produce the answer.

1 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the answer will be notified once they are available.
Know the answer?
Add Answer to:
This assignment will test your algorithm/logic development in which you will perform the sort function with some different characteristics.
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Similar Homework Help Questions
  • Implement in C SharpCreate a new algorithm based on the algorithm, selection sort. The new algorithm...

    Implement in C SharpCreate a new algorithm based on the algorithm, selection sort. The new algorithm should be able to sort an array like this: Input: an array that has n elements, and the values of its elements are assigned randomly, for example: Index 0 1 2 3 4 5 value 7 3 6 2 1 5 Output: an array - its first n/2 elements are sorted in ascending order and its second n/2 elements sorted in descending order. That...

  • Sorting Sort the following array using the quick sort algorithm: (4 Marks) a. 12 26 8...

    Sorting Sort the following array using the quick sort algorithm: (4 Marks) a. 12 26 8 9 7 0 4 Pivot selection is defined to be the first element of each sub-list. Show the array before and after each quicksort round (when the array is partitioned after placing the pivot at its correct position). Also, clearly highlight the pivot in each partition b. Consider an unsorted array of integers of size n. Write a Java program to arrange the array...

  • In this assignment you will implement merge-sort algorithm by creating 2 threads instead of 2 pro...

    In this assignment you will implement merge-sort algorithm by creating 2 threads instead of 2 processes. First half of the array will be sorted by thread 1 and the second half by thread 2. When the threads complete their tasks, the main program will merge the half arrays. You should not waste your time on merge-sort algorithm. Use the merge sort algorithm given below Languaga is C platform Ubuntu

  • Bubble Sort Bubble Sort is the simplest sorting algorithm that works by repeatedly swapping the adjacent...

    Bubble Sort Bubble Sort is the simplest sorting algorithm that works by repeatedly swapping the adjacent elements if they are in wrong order. Example: First Pass: ( 5 1 4 2 8 ) –> ( 1 5 4 2 8 ), Here, algorithm compares the first two elements, and swaps since 5 > 1. ( 1 5 4 2 8 ) –> ( 1 4 5 2 8 ), Swap since 5 > 4 ( 1 4 5 2 8...

  • 4) [15 points total (5 points each)] Assume you are given a sorted array A of n numbers, where A is indexed from 1 up t...

    4) [15 points total (5 points each)] Assume you are given a sorted array A of n numbers, where A is indexed from 1 up to n, anda number num which we wish to insert into A, in the proper sorted position. The function Search finds the minimum index i such that num should be inserted into Ali]. It searches the array sequentially until it finds the location i. Another function MakeRoom moves A[i], .., AIn] to Ali+1]...AIn+1] same sort...

  • In this assignment, you sort a list of strings using mergesort and the compareToIgnoreCase method of...

    In this assignment, you sort a list of strings using mergesort and the compareToIgnoreCase method of the String class. The strings are provided as arguments to your main method. In case you haven't yet learned to configure command-line arguments to main in your IDE, now is a good time to learn. Your program should sort the array of strings using mergesort, then print the strings one per line, in order from smallest ("a") to largest ("z"). The name of your...

  • problem 2 can use Det-Selection(A, p, q, r) as a sub-routine (i.e, you don't need to...

    problem 2 can use Det-Selection(A, p, q, r) as a sub-routine (i.e, you don't need to write its pseudo-code). To sort an array A, you will then call Det-QuickSort(A, 1, n). You also need to provide the worst case time complexity analysis of your algorithm. 2. (20 points) Given a set of n distinct numbers, we wish to find the k largest in sorted order using a comparison-based algorithm. Give an algorithm that implements each of the following methods, and...

  • 1. Consider an array of n distinct values in which the first n − 1 values are sorted, and the las...

    1. Consider an array of n distinct values in which the first n − 1 values are sorted, and the last element is not. (It could be smaller than the first element, larger than element n − 1, or anywhere in between.) Give the worst-case number of comparisons that Insertion Sort will perform in this scenario. You can give your answer in terms of big-Theta if you wish to ignore low-order terms and constants.

  • In this assignment you will implement merge-sort algorithm by creating 2 threads instead of 2 pro...

    In this assignment you will implement merge-sort algorithm by creating 2 threads instead of 2 processes. First half of the array will be sorted by thread 1 and the second half by thread 2. When the threads complete their tasks, the main program will merge the half arrays. You should not waste your time on merge-sort algorithm. Use the merge sort algorithm given below void mergesort(int a[],int i,int j) { int mid; if(i<j) { mid=(i+j)/2; mergesort(a,i,mid); //left recursion mergesort(a,mid+1,j); //right...

  • You are going to implement Treesort algorithm in C++ to sort string data. Here are the...

    You are going to implement Treesort algorithm in C++ to sort string data. Here are the steps to complete the homework 1) Use the following class definition for binary search tree nodes. Its constructor is incomplete you should first complete the constructor. class TreeNode t public: string data; / this is the string stored in the node TreeNode left: TreeNode right; TreeNode (string element, TreeNode 1t, TreeNode rt //your code here 2) Write a function that will insert a string...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT