I've got 5 arrays each with one number in them, but in order to sort them using the insertion method, I need to combine them into a single array. How do I do this? This is the last part of my program and can't figure it out!

Recommended Answers

All 4 Replies

I've got 5 arrays each with one number in them, but in order to sort them using the insertion method, I need to combine them into a single array. How do I do this? This is the last part of my program and can't figure it out!

More details please. You want to concatenate five arrays into one? So you have an array a = {1} and an array b = {6}, you want to make an array c = {1, 6}, except there are five arrays, not two? All this prior to the sort?

I've got a big array of numbers called LBS[x]. It is broken up into columns like so -->

1112 10 11 12
2222 13 14 15
3332 16 17 18

starting from the top left, my array goes as so.


group# BM Shear Torsion
LBS[0] LBS[1] LBS[2] LBS3]
LBS[4] LBS[5] LBS[6] LBS[7]
LBS[8] LBS[9] LBS[10] LBS[11]

Ultimately I need to use insertion sort, to sort the group by BM, Shear, and Torsion. Example would be we are sorting by BM, so it would look like this. LBS[5] to LBS[1] is the order.

group# BM Shear Torsion
LBS[4] LBS[5] LBS[6] LBS[7]
LBS[8] LBS[9] LBS[10] LBS[11]
LBS[0] LBS[1] LBS[2] LBS3]

starting from the top left, my array goes as so.


group# BM Shear Torsion
LBS[0] LBS[1] LBS[2] LBS3]
LBS[4] LBS[5] LBS[6] LBS[7]
LBS[8] LBS[9] LBS[10] LBS[11]

Ultimately I need to use insertion sort, to sort the group by BM, Shear, and Torsion. Example would be we are sorting by BM, so it would look like this. LBS[5] to LBS[1] is the order.

group# BM Shear Torsion
LBS[4] LBS[5] LBS[6] LBS[7]
LBS[8] LBS[9] LBS[10] LBS[11]
LBS[0] LBS[1] LBS[2] LBS3]

You said you had five arrays, each with one number in it. I see one array with twelve numbers in it. Where are the five arrays?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.