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
Artemon [7]
3 years ago
12

Write a pseudocode method swap(aList, i, j) that interchanges the items currently in positions i and j of a list. Define the met

hod in terms of the operations of the ADT list, so that it is independent of any particular implementation of the list. Assume that the list, in fact, has items at positions i and j. What impact does this assumption have on your solution
Computers and Technology
1 answer:
serious [3.7K]3 years ago
6 0

Answer:

Explanation:

The following pseudocode for this method using operations of the ADT list would be the following

swap(aList, indexI, indexJ) {

    initialize temp_variable = Retrieve(indexI, aList)

    Insert(Retrieve(indexJ, aList), indexI, aList)

    Insert(Retrieve(indexI, aList), temp_variable, aList)

}

This code basically saves the aList index of i , into a temporary Variable. Then it sets the aList index of i to the value of the element in index of j. Then it does the same for the index of j with the tem_variable. If we assume that the indexes of i and j exist, then it can crash our entire program if those indexes are missing from the list when we try to access them.

You might be interested in
I need help with Python. The first image is the code and the 2nd is the output.
Gekata [30.6K]
The issue arises because the string you are trying to print is not a string, rather a float value. Item1, item2 and item3 are strong values (if you type some alphabets in it and not just numbers), but itemonecost, itemtwocost, and itemthreecost are explicitly type casted to float. In line 22, 23, and 24 you’re trying to print a float, by adding it with the string. One cannot add numbers to string. Rather you can type cast the itemcost to string while printing.

Add str(itemonecost) instead of itemonecost in print statement. Do this for other float variables too.

However do note that there are multiple ways to correct this issue, and I’ve just pointed one out.
4 0
3 years ago
Suppose you have a class called Child with an instance data value called weight and height. Then it has a method called doubleWe
alexira [117]

Answer:

Explanation:

The following code is written in Java. I recreated the entire Child class as described with the instance variables and the doubleWeight method. Then created the getter and setter methods for both the weight and height variables.

class Child {

   double weight, height;

   public double doubleWeight() {

       double superWeight = weight * height;

       return superWeight;

   }

   public double getWeight() {

       return weight;

   }

   public void setWeight(double weight) {

       this.weight = weight;

   }

   public double getHeight() {

       return height;

   }

   public void setHeight(double height) {

       this.height = height;

   }

}

7 0
3 years ago
Lindsay owns a candy store that typically makes all of its sales to tourists visiting a nearby zoo. Why might she decide to set
umka2103 [35]
Social media is so powerful in this generation because it is able to reach many different corners of the world. It is not only used merely for communication but also sometimes or most of the times for business. For Lindsay, the use of social media will allow her to increase the size of the customer base. The answer is letter A. 
4 0
3 years ago
Read 2 more answers
_____ consists of computer equipment used to perform input, processing, and output activities.
goldfiish [28.3K]
<span> (keyboards, mice, scanning, computer chips)</span>
6 0
3 years ago
20 points
ozzi

Answer:

92

Explanation:

int index = 1 + 6 % 3;

Modulo is calculated before adding, so as first you need to calc 6 % 3, result is 0.

int index = 1 + 0 = 1;

Indexes in arrays starts from 0, ends in length - 1. So first element in the array has 0 as index, second element has 1 as idnex, etc. Your index = 1, so value of the second element in the grades will be your result. Finally, the answer is 92.

4 0
3 years ago
Other questions:
  • How does technology helps save the environment?​
    6·1 answer
  • Which of the following is not a concern that has come out of the widespread adoption of the Internet?
    7·1 answer
  • For her homework, Annie has added the picture of a fruit in a document. She wants to enhance it to give a cut-out look. Which fe
    5·2 answers
  • Write a regular expression that selects lines containing any of the following words: linux windows solaris macos. For this exerc
    13·1 answer
  • What is ‘Software Testing’?
    13·1 answer
  • Create a database with information about products in a catalog. As you plan, keep in mind that later you will want to sort this
    10·2 answers
  • Find the equation of a line which has 10 points the following two coordinates: (4, 0) and (3, 4)​
    13·1 answer
  • Hey! PLEASE HELP!!!
    12·1 answer
  • Which technology do online storesusually use to present customized content?
    10·1 answer
  • How many bytes/second is a 16Mbps cable modem connection?
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!