by Editorial | Nov 11, 2024 | Grade 12 - PAT, Grade 12 - Search and Sort
Java has an “array” class that offers many useful methods that you can use in your grade 12 PAT. First you will need to import the Array class import java.util.Arrays; All the methods are static i.e. “Array.nameOfTheMethod”. Here is a list of...
by Editorial | Jun 13, 2021 | Grade 11, Grade 11 - OOP, Grade 12, Grade 12 - OOP, Grade 12 - Search and Sort
Searching an array in Java Searching for a value in an unsorted array is a standard algorithm that loops from the first element and moves to the last element. These are all two-class programs using an OOP approach where arrays are passed as parameters. Here the...
by Editorial | May 28, 2021 | Grade 12, Grade 12 - Search and Sort
You have watched the video and you now understand how the bubblesort algorithm works. You understand why sorting integers is straightforward and why we need to use “compareTo” when sorting String. Now you just want the code . . . Click here for bubble...
by Editorial | Feb 28, 2021 | Grade 12, Grade 12 - OOP, Grade 12 - Search and Sort
Inheritance is an important element of OOP programming. Using Carol Lewis’ Inheritance workshop we will re-create her example of an array of Dogs. This array will be a mixed array because some of the elements will be of the class “Dogs” while others...
by Editorial | Feb 28, 2021 | Grade 11, Grade 12, Grade 12 - Search and Sort
SORT ARRAY OF OBJECTS – by name – by date The bubble sort can sort numbers, Strings and arrays of objects. For an animation on how the bubble sort algorithm works click here. You may need to revise how the String method “compareTo” works. To...
by Editorial | Feb 27, 2021 | Grade 11, Grade 12, Grade 12 - Search and Sort, PWC grade 12 - All
The bubble sort algorithm offers a simple solution to sorting items in an array; the array can be of a primitive data type e.g. int or it can be an array of objects. The bubble sort works for both numerical values as well as for String and char. SORT NUMBERS On...