Hello, this task requires me to do a few things.
1) Fills two integer arrays of size 10 with unique random numbers in the range of 0 – 50.
2) Sorts each array using the Bubble Sort algorithm (ascending order)
3) Displays sorted arrays
4) Displays the union of the two arrays (in ascending order)
5) Displays the intersection of the two arrays (in ascending order)
And I'm looking for some pointers on how to begin, or how the general structure should look and be set up.
Because the arrays are sorted from the previous steps, the union and intersection are a bit easier.
For the union, you want to display every element of both arrays except that you need to omit repetition. To do this you can just loop through the arrays at the same time, keeping a separate index counter for each array. At each step through the loop, compare the elements at the given indexes. Think about the different cases you could have, and determine when you should print an element, and when you should increase the index counters of one or both of the arrays.
The intersection will require a similar approach, except you will treat the cases differently.