TORONTO KIDS COMPUTER CLUB | Markham Saturday 14:00 Java Homework 21.05.08.
19411
post-template-default,single,single-post,postid-19411,single-format-standard,ajax_fade,page_not_loaded,,qode-theme-ver-7.6.2,wpb-js-composer js-comp-ver-6.10.0,vc_responsive

Markham Saturday 14:00 Java Homework 21.05.08.

13 May Markham Saturday 14:00 Java Homework 21.05.08.

Question:
Use either Bubble Sort, Selection Sort or Insertion sort to sort the array in ascending order by using the absolute value.  Please refer to this link https://en.wikipedia.org/wiki/Absolute_value if you don’t know what absolute value is

Also, If the array has a specific number which contains both its negative form and the positive form, the sorting algorithm should put the number with the negative form of the number before the positive form

Input
[1,2,3 -2, 0 , -1, -2,  4]
 
Output
[ 0, -1, 1, -2, -2, 2, 3, 4]
No Comments

Sorry, the comment form is closed at this time.