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
Josephine is in the process of creating ads within her Standard Display campaign. She finds that there are two main ad formats t
Dennis_Churaev [7]

Answer:

d.Responsive Display ads

e.Uploaded ads (Image & AMPHTML)

Explanation:

The two main ad formats used in a Standard Display campaign are;

1. Responsive Display ads: they are Google's new default ad format and are automatically created by Google using assets provided by users in a square and landscape format.

2. Uploaded ads (Image & AMPHTML): they are created using a tool like Google Web Designer to create adverts outside of Google Ads.

They can be uploaded as a jpeg, gif, zip file and png extension into Google Ads.

3 0
2 years ago
Windows _____ is a system notification utility and gives quick access to settings for items like screen brightness and network c
jasenka [17]

Answer:

Windows notification and action settings

Explanation:

Notification and action settings is a system settings as well as a notification utility that enables quick or easy access to settings for a number of items or features.

The items include network, tablet mode, mobile hotpot, night light, brightness, Bluetooth, airplane mode, all settings, VPN, focus assist, location, project and connect. It is important to note that all the listed items can be found in the notification and action settings of a windows 10 computer.

4 0
3 years ago
I need help with this chart !
Alex17521 [72]

Not in high school but i tried my best to help

(Sorry that its blurry )

3 0
3 years ago
What type of activities are performed with the help of the software used in hospitals?
faust18 [17]

Answer:

Xrays, Ultrasounds, managing patient records, communicating with colleagues, etc.

7 0
2 years ago
Read 2 more answers
The option to add the date and time to a document is located in the
Tomtit [17]

Answer:

The option to add the date and time to a document is located in the

text grouping on the Insert tab.

Explanation:

8 0
3 years ago
Read 2 more answers
Other questions:
  • In what stage of writing does publishing occur
    14·1 answer
  • Attacker player X is standing still on a corner kick, as the ball is played, he jumps up with his arms flailing above his should
    8·1 answer
  • What is computer engineering?
    11·1 answer
  • Write the definition of a method printarray, which has one parameter , an array of int s. the method does not return a value . t
    10·1 answer
  • To access WordPad, Jill will click on Start, All Programs, Accessories, and WordPad. To access Notepad, Karl will click on Start
    5·1 answer
  • After reviewing the various types of network connections available, a client chooses a network connection that is considered to
    13·1 answer
  • which of the following is a component of a rope-rewind starter system? a. a recoil spring c. an air vane governor b. a wrist pin
    5·1 answer
  • COMO HA SIDO LA INNOVACION DE ESTE OBJETO TECNOLOGICO DURANTE SU EVOLUCIÓN
    8·1 answer
  • Justice wrote a program and forgot to put the steps in the correct order. Which step does she need to review?
    5·2 answers
  • Select the correct answer from each drop-down menu
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!