1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
abruzzese [7]
3 years ago
11

We informally define the term corresponding element as follows: The first element in an array and the last element of the array

are corresponding elements. Similarly, the second element and the element just before the last element are corresponding elements. The third element and the element just before the element just before the last element are corresponding elements -- and so on. Given an array a, write an expression for the corresponding element of a[i].
Computers and Technology
1 answer:
yanalaym [24]3 years ago
7 0

The corresponding element in an array can be written as follows.

The given array is arr[len] whose size is given by integer variable len. We take another integer variable k.

Corresponding element for arr[k] = arr[len-1-k]

This applies for all expressions of k beginning from 0 upto half the size of len, i.e., len/2.

For element, arr[0], the corresponding element is arr[10-1-0] = arr[9].

The above expression is valid if the sum of index of both element and its corresponding element adds upto the index of the last element of the array.

Example: k + (len – 1 - k)  

= k + len – 1 - k

= len – 1

= index of the last element of the array

The number of elements that an array can hold is one more than the index of the last element of the array.

Suppose an array of 10 elements is given. The above expression holds true since first element of the array is always written as arr[0] and last element will be written as arr[9] for an array of 10 elements.

This is illustrated below.

The c++ program to display the element and its corresponding element along with their index is shown below.

#include <iostream>

using namespace std;

int main() {    

   int len=10, arr[len],k;    

   for(k=0; k<len; k++)

   {

       // elements are initialized to twice their index

       arr[k] = k*2;

   }

   cout<<"Element "<<" Index "<<"\t"<<" Corresponding "<<" Index"<<endl;

   for(k=0; k<len/2; k++)

   {

       cout<<arr[k]<<"\t"<<"\t"<<"\t"<<k<<"\t"<<"\t"<<"\t"<<arr[len-1-k]<<"\t"<<"\t"<<len-1-k<<endl;

   }

}

OUTPUT

Element Index    Corresponding   Index

0  0   18  9

2  1   16  8

4  2   14  7

6  3   12  6

8  4   10  5

 

The above program initializes all the elements of the array to twice the value of their corresponding index. Following this, the element, its index, the corresponding element and its index is displayed.

All the above is achieved using for loop. The size of the array and its elements can be changed.

The expression for the corresponding element is thus explained.

You might be interested in
The web development team is having difficulty connecting by ssh to your local web server, and you notice the proper rule is miss
joja [24]

Answer:

Option b (Port 22) seems to the appropriate choice.

Explanation:

<u>Below seem to be some measure you should take to correct this mistake.</u>

  • Verify whether Droplet's host IP address seems to be right.  
  • Verify existing connection supports communication over all the utilized SSH port. Any access points can be able to block port 22 and sometimes customized SSH. For illustration, you could do this by checking different hosts who used the same port, using only a recognized working SSH connection. These could help you identify unless the current problem is not particular to clients' Droplet.
  • Authenticate the Droplet configuration settings. Verify that they're not being configured to DROP 's preferred policy, and do not apply the port to require connectivity.

The SSH server also operates on port 22, by default.  

Other choices don't apply to the specified scenario. So that the argument presented above will be appropriate.

7 0
3 years ago
Consider the method below, which prints the digits of an arbitrary positive integer in reverse order, one digit per line. The me
topjm [15]

Answer:

System.out.println(value % 10);

printReverse(value / 10);

Explanation:

System.out.println(value % 10);

To print the last digit, we print the value modulo 10 as the result of the value modulo 10 gives us the last digit.

printReverse(value / 10);

To call the recursive method again without the last digit, we now pass the result of dividing the value with 10 inside the printReverse method as parameter. The division by 10 will remove the last digit from the value and result will be the remaining digits.

7 0
3 years ago
Ummm, I hate to interrupt your day, but does anyone know where Mitch72 is????? Because he hasn't talked in a week, and he hasn't
Anettt [7]

Answer:

sorry but no

Explanation:

4 0
3 years ago
A corporation needs an operating system that allows the various teams in its office to network and collaborate on projects. Whic
Nikolay [14]
This totally depends on what they need and what they are willing to spend. If they just need access to google docs/ sheets etc for example (so just the web with a web browser), either Linux / Un*x or Windows will do and linux is the free choice. If they want to be part of the microsoft ecosystem or use some windows specific software they will need to use Windows or an emulator in Linux.

I would not recommend MSDOS in this day and age.
7 0
3 years ago
Read 2 more answers
You can use a(n) ____ to visually separate related controls from other controls on the form.
maksim [4K]

Answer:

The correct answer to the following question will be Group Box.

Explanation:

Group Box:

  • A type container that contains many types of controls that are usually related to each other in the form.
  • It usually provides the identified grouping for other controls.
  • used for the subdivision of the forms.
  • Separation of the controls can be done with the help of grouping by group box.

5 0
3 years ago
Other questions:
  • ____ was the first-generation cellular telephone system.​ a. ​Advanced Mobile Phone Service (AMPS) b. ​Global System for Mobile
    12·2 answers
  • describe briefly one scenario where records stored in a computer frequently need to be searched. state why the searches may be c
    9·2 answers
  • list the network characteristics of the wireless network(s) in the decode -- SSIDs, channels used, AP names, presence of Bluetoo
    6·1 answer
  • Standards for all managers ethical responsibilities are covered in a company's
    7·2 answers
  • ________ to a base class may be assigned the address of a derived class object.
    8·2 answers
  • Which of the following is an example of indirect perception checking?
    7·2 answers
  • "Most of us know that when we come into a college classroom, we will see desks and chairs, a computer station and a projector. A
    6·1 answer
  • Technologies have advanced to allow computer chips to be placed in almost anything and to be connected to a network almost anywh
    8·1 answer
  • PLEASE FASTTTTT
    8·2 answers
  • Abby has received a request for a data set of actual data for testing a new app that is being developed. She does not want the s
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!