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
5.
garri49 [273]

<em>The answer is : It highlights the contrast between the Dursley's excitement for the dinner and Harry's loneliness. </em>

<em> </em>

<em>Harry is a lonely boy as he must remain outcast and invisible to Dursley's visitors. During this time, Dursleys are expecting some visitors which has relation to Vernon's job. Harry must stay in the bedroom so the visitors won't see him and won't ask some things about him. Since they are having a visitor, a dinner must be served to make the visit worthwhile which is what the Dursleys are looking forward to. </em>

4 0
3 years ago
What tab appears that allows for charts to be formatted when a chart is selected?
djyliett [7]
in the Design section you can format your selected Chart
8 0
2 years ago
A security team has downloaded a public database of the largest collection of password dumps on the Internet. This collection co
Scorpion4ik [409]

Answer:

a. Password length, password encryption, password complexity

Explanation:

Under this scenario, the best combination would be Password length, password encryption, password complexity. This is because the main security problem is with the user's passwords. Increasing the password length and password complexity makes it nearly impossible for individuals to simply guess the password and gain access, while also making it extremely difficult and time consuming for hackers to use software to discover the password as well. Password excryption would be an extra layer of security as it encrypts the password before storing it into the database, therefore preventing eavesdroppers from seeing the password and leaked info from being used without decryption.

4 0
3 years ago
How might your use of computers and knowledge of technology systems affect your personal and professional success?
Xelga [282]
Amost all professions include theuse of computers. Knowing a lot about them and the way they work could help you use them when needed in a work environment. It would also make an employer more likely to hire you.
6 0
3 years ago
Read 2 more answers
Structure for forloop?
solong [7]

Answer:

for ( initialization; condition;increment)

{

code goes here;

}

in python:

for i in list/range:

code with proper indentation

By initialization above we mean, like int i=0; etc.

By condition like i<10;

and by increment it means like i++, ++i or i+=1; etc

And in python, i can be an integer value if the range is mentioned, and it can be an item of a list if the list is used. We can also use an array, string and various other data structures in python. like we can have characters in a string and so on.

Explanation:

Please check the answer section.

8 0
3 years ago
Other questions:
  • A file that contains program code is called a ____________.
    13·1 answer
  • We can see spreadsheet results graphically by creating:
    15·1 answer
  • What do you call the combination of title, description, tags, and thumbnail?
    6·1 answer
  • Maria is comparing her history project's second-place award to her classmate's first-place award. She starts planning how to win
    6·2 answers
  • In the early part of labor, contractions come every
    6·1 answer
  • (Please answer! Correct answer gets brainliest!)
    5·2 answers
  • The analogy of a computer system is often used to illustrate the different parts of memory. The keyboard is where we encode new
    8·1 answer
  • You are reviewing the output of the show interfaces command for the Gi0/1 interface on a switch. You notice a significant number
    12·1 answer
  • How can you relate the careers in Finance as BSIS students?
    15·1 answer
  • What are the significances of blogs?
    7·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!