An array with an odd number of elements is said to be balanced if all elements (except the middle one) are strictly greater than the value of the middle element. Note that only arrays with an odd number of elements have a middle element.
Write a C++ function that accepts an integer array and returns 1 or “Balanced” if it is a balanced array, otherwise it returns 0 or “Not Balanced”.
1: Try your best to solve your problem on your own before posting; no one appreciates people dumping their homework assignments without even trying to do them first.
2:Explain your problem or assignment very clearly (or just post the assignment itself).
3:Post whatever code you have already written, so we can see that you've actually made some effort on it, as well as any compiler errors, warnings, etc that you are having trouble with. This is linked to 1 above.
1. If the size is even then the array isn't balanced.
2. Go through the array comparing items to the middle one. If any item is less than or equal to the middle item then the array is unbalanced.
3. Otherwise the array is balanced.
It's not like there's an actual elbow grease people apply to their joints.
Actually...
My dad uses some kind of liniment on his elbows because they "feel creaky." Some kind of old people thing (hope he doesn't read this). It's some kind of weird greasy stuff he gets at the hardware store. He claims it works.
Ironically, the name of this stuff is actually "Elbow Grease."