Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Suppose bot and top are positive integers with bot top. Consider the array a [ b o t ] , a [ b o t

Suppose bot and top are positive integers with bot top. Consider the array
a[bot],a[bot+1],dots,a[top].
(a) How many elements are in this array?
The array has elements.
(b) Show that if the number of elements in the array is odd, then the quantity bot + top is even.
Proof: Suppose the number of elements in the array is odd.
By definition of odd, there is an integer k such that the number of elements in the array =2k+1.
In addition, since top is the largest index in the array and bot is the smallest index in the array, then the number of elements in the array =
Equate the results of steps 1 and 2 and solve for top. After like terms are combined, the result is top =
Add bot to both sides to obtain bot + top ), which is even because it is two times an integer.
Hence, bot + top is an even integer [as was to be shown].
(c) Show that if the number of elements in the array is even, then the quantity bot + top is odd.
Proof: Suppose the number of elements in the array is even.
By definition of odd, there is an integer k such that the number of elements in the array =2k.
In addition, since top is the largest index in the array and bot is the smallest index in the array, then the number of elements in the array =
Equate the results of steps 1 and 2 and solve for top. After like terms are combined, the result is top =1
Add bot to both sides to obtain bot +top=2(,)+1, which is odd because it is two times an integer plus 1.
Hence, bot + top is an odd integer [as was to be shown].
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Learning MySQL Get A Handle On Your Data

Authors: Seyed M M Tahaghoghi

1st Edition

0596529465, 9780596529468

More Books

Students also viewed these Databases questions