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
masya89 [10]
3 years ago
10

The list method reverse reverses the elements in the list. Define a function named reverse that reverses the elements in its lis

t argument (without using the method reverse!).
Computers and Technology
1 answer:
Alisiya [41]3 years ago
7 0

Answer:

public class Reverse {

  1.    public static void reverseList(int list [], int n)
  2.    {
  3.        int[] reversedList = new int[n];
  4.        int k = n;
  5.        for (int i = 0; i < n; i++) {
  6.            reversedList[k - 1] = list[i];
  7.            k = k - 1;
  8.        }
  9.        //printing the reversed list
  10.        System.out.println("The Reversed list \n");
  11.        for (int j = 0; j < n; j++) {
  12.            System.out.println(reversedList[j]);
  13.        }
  14.    }

Explanation:

Using Java, An array is implemented to hold a list of items

A method reverseList() is created to accept an array as parameter and using a for statement reverses the elements of the array and prints each element of the list

See below a complete code with a main method that calls this method

<em>public class Reverse {</em>

<em>    public static void main(String[] args) {</em>

<em>        int [] arr = {10, 20, 30, 40, 50};</em>

<em>        reverseList(arr, arr.length);</em>

<em>    }</em>

<em>    public static void reverseList(int list [], int n)</em>

<em>    {</em>

<em>        int[] reversedList = new int[n];</em>

<em>        int k = n;</em>

<em>        for (int i = 0; i < n; i++) {</em>

<em>            reversedList[k - 1] = list[i];</em>

<em>            k = k - 1;</em>

<em>        }</em>

<em>        //printing the reversed list</em>

<em>        System.out.println("The Reversed list \n");</em>

<em>        for (int j = 0; j < n; j++) {</em>

<em>            System.out.println(reversedList[j]);</em>

<em>        }</em>

<em>    }</em>

<em>}</em>

You might be interested in
Suppose I define some structure type ( studentInfo), then I declare an instance of it and I decide to also create a pointer to t
Nookie1986 [14]

Answer:

a. (p*Main).age = 20;

Explanation:

Pointers use ->

where as normal variable use . to access its members

pMain is the pointer.

*pMain is the value inside pMain.

pMain->age = 20;

This statement equals to

(*pMain).age = 20;

Answer is option a.

8 0
3 years ago
As an interviewer, it is not necessary to be at eye level with interviewee<br><br> True<br> False
Tamiku [17]

Answer:

True

Explanation:

Have a great day

3 0
3 years ago
Read 2 more answers
Drag the tiles to the correct boxes to complete the pairs.
jek_recluse [69]

Answer:

1. Multistage database.

2. Stationary database.

3. Virtual database.

4. Distributed database.

Explanation:

A database management system (DBMS) can be defined as a collection of software applications that typically enables computer users to create, store, modify, retrieve and manage data or informations in a database. Generally, it allows computer users to efficiently retrieve and manage their data with an appropriate level of security.

There are four (4) major types of database in a data warehouse and these are;

1. <u>Multistage database</u>: used for concise as well as detailed historical data. It provides summarized data which can be used by an employee for short-term decision making.

2. <u>Stationary database</u>: used where access to data is rare i.e business firms who do not access data frequently. In order to use this database, the users must have an access to metadata store and thus, directly having access to the data on a source system.

3. <u>Virtual database</u>: used for accessing data in diverse applications using middleware. This type of database is dependent on having access to information on various databases.

4. <u>Distributed database</u>: used by an organization that runs several businesses. Therefore, this type of database are usually located or situated in various geographical regions.

5 0
2 years ago
What is output by the following code?
Katarina [22]
The output is 2. The stuff() function receives a copy of n, changes it but the result is never used.
5 0
3 years ago
What are real online jobs any one of any age can get pays weekly by Pay<br> Pal
ASHA 777 [7]

Answer:

An online lesson will be good.

8 0
2 years ago
Other questions:
  • What is the Multiple Source Test
    15·2 answers
  • You have been asked to delete some data from medisoft but find that there is no delete button. what is another method you can us
    10·1 answer
  • What is a new ransomware program that encrypts your personal files and demands payment for the files' decryption keys? Multiple
    10·1 answer
  • I just got my driver's permit!!! However, it says I have 2 restrictions. What are the restrictions? Is it the not being allowed
    13·1 answer
  • What is the decrypted binary
    9·1 answer
  • When using the Internet, it is important to know the validity of web page you are using. How can you know if the information is
    5·1 answer
  • What is the main difference between a search engine and a web browser?
    6·2 answers
  • domain controllers store local user accounts within a sam database and domain user accounts within active directory. true or fal
    10·1 answer
  • Why backup system of data and software is necessary. ​
    12·1 answer
  • System development life cycle
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!