Write a pseudocode method swap(aList, i, j) that interchanges the items currently in positions i and j of a list. Define the method 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

Answers

Answer 1

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.


Related Questions

Which one is the result of the output given by a computer
I​

Answers

Explanation:

Instruction , data and information all of these.

An error due to wrong input by the user

Answers

Answer:

when did it take place..

Write a function named square_list that takes as a parameter a list of numbers and replaces each value with the square of that value. It should not return anything - it should mutate the original list.

Answers

Answer:

The function is as follows:

def square_list(myList):

   for i in range(len(myList)):

       myList[i] = myList[i]**2

   print(myList)

Explanation:

This defines the function

def square_list(myList):

This iterates through the list elements

   for i in range(len(myList)):

This squares each list element

       myList[i] = myList[i]**2

This prints the mutated list

   print(myList)

write a java program that prompts the user to enter scores (each number an integer from 0 to 10) and prints the following output: how many scores entered the highest score the lowest score the average of all the scores the average with the highest and lowest score not counted if the user enters less than 3 scores print an error message instead of the output above

Answers

Answer:

Explanation:

The following is written in Java. It continues asking the user for inputs until they enter a -1. Then it saves all the values into an array and calculates the number of values entered, the highest, and lowest, and prints all the variables to the screen. The code was tested and the output can be seen in the attached image below.

import java.util.ArrayList;

import java.util.Arrays;

import java.util.Scanner;

class Brainly {

   public static void main(String[] args) {

       Scanner in = new Scanner(System.in);

       int count = 0;

       int highest, lowest;

       ArrayList<Integer> myArr = new ArrayList<>();

       while (true) {

           System.out.println("Enter a number [0-10] or -1 to exit");

           int num = in.nextInt();

           if (num != -1) {

               if ((num >= 0) && (num <= 10)) {

                   count+= 1;

                   myArr.add(num);

               } else {

                   System.out.println("Wrong Value");

               }

           } else {

               break;

           }

       }

       if (myArr.size() > 3) {

           highest = myArr.get(0);

           lowest = myArr.get(0);

           for (int x: myArr) {

               if (x > highest) {

                   highest = x;

               }

               if (x < lowest) {

                   lowest = x;

               }

           }

           System.out.println("Number of Elements: " + count);

           System.out.println("Highest: " + highest);

           System.out.println("Lowest : " + lowest);

       } else {

           System.out.println("Number of Elements: " + count);

           System.out.println("No Highest or Lowest Elements");

       }

   }

}

Sydnee would like a chart to appear once in her report, but she is having wouble making this occur She does not understand why the chart is showing multiple times in the report. What is most likely causing the problem?

O The chart is placed in the header and footer of a database
O The chart is placed in the field of a database.
O The chart is placed in a database with one group
O The chart is placed in a database with five groups​

Answers

AnswerSydnee would like a chart to appear once in her report, but she is having wouble making this occur She does not understand why the chart is showing multiple times in the report. What is most likely causing the problem? a chart to appear once in her report, but she is having wouble making this occur She does not understand why the chart is showing multiple times in the report. What is most likely causing the problem?

a chart to appear once in her report, but she is having wouble making this occur She does not understand why the chart is showing multiple times in the report. What is most likely causing the problem?

O The chart is placed in the header and footer of a database

O The chart is placed in th a chart to appear once in her report, but she is having wouble making this occur She does not understand why the chart is showing multiple times in the report. What is most likely causing the problem? a chart to appear once in her report, but she is having wouble making this occur She does not understand why the chart is showing multiple times in the report. What is most likely causing the problem?

O The chart is placed in the header and footer of a database

O The chart is placed in the field of a database.

O The chart is placed in a database with one group

O The chart is placed

O The chart is placed in the header and footer of a database

O The chart is placed in the field of a database.

O The chart is placed in a database with one group

O The chart is placede field of a database.

O The chart is placed in a database with one group

O The chart is placed

O The chart is placed in the header and footer of a database

O The chart is placed in the field of a database.

O The chart is placed in a database with one group

O The chart is placed

O The chart is placed in the header and footer of a database

O The chart is placed in the field of a database.

O The chart is placed in a database with one group

O The chart is placed in a database with five groups​ :nce in her report, but she is having wouble making this occur She does not understand why the chart is showing multiple times in the report. What is most likely causing the problem?

O The chart is placed in the header and footer of a database

O The chart is placed in the field of a database.

O The chart is placed in a database with one group

O The chart is placed in a database with five groups​

Hold on, our servers are swamped. Wait for your answer to fully load.

Explanation:

Sydnee would like a chart to appear once in her report, but she is having wouble making this occur She does not understand why the chart is showing multiple times in the report. What is most likely causing the problem?

O The chart is placed in the header and footer of a database

O The chart is placed in the field of a database.

O The chart is placed in a database with one group a chart to appear once in her report, but she is having wouble making this occur She does not understand why the chart is showing multiple times in the report. What is most likely causing the problem?

a chart to appear once in her report, but she is having wouble making this occur She does not understand why the chart is showing multiple times in the report. What is most likely causing the problem? a chart to appear once in her report, but she is having wouble making this occur She does not understand why the chart is showing multiple times in the report. What is most likely causing the problem?

a chart to appear once in her report, but she is having wouble making this occur She does not understand why the chart is showing multiple times in the report. What is most likely causing the problem?

O The chart is placed in the header and footer of a database

O The chart is placed in the field of a database.

O The chart is placed in a database with one group

O The chart is placed

O The chart is placed in the header and footer of a database

O The chart is placed in the field of a database.

O The chart is placed in a database with one group

O The chart is placed

O The chart is placed in the header and footer of a database

O The chart is placed in the field of a database.

O The chart is placed in a database with one group

O The chart is placed

O The chart is placed in the header and footer of a database

O The chart is placed in the field of a database.

O The chart is placed in a database with one group

O The chart is placed

O The chart is placed in a database with five groups​

Write a program named lastname_firstname_cities.py that works with information about large cities. Your program will open the cities.txt downloadfile. Each line in the file has the name of a city, its country, and its population. The first few lines of the file look like this:

Answers

Answer and Explanation:

Open your text editor and open new file. Save new file file as lastname_firstname_cities.py. The program will open the file cities.txt downloadfile hence :

dfile= open(cities.txt, "r")

If we write this into our lastname_firstname_cities.py file it will open our cities.txt downloadfile in read mode and text mode(by default unless we specify binary mode which is for images)

. Write programming code in C++ for school-based grading system

Answers

Explanation:

The grade must be calculated based on following pattern:

Average Mark RangeGrade91-100A181-90A271-80B161-70B251-60C141-50C233-40D21-32E10-20E2

Calculate Grade of Student in C++

To calculate grade of a student on the basis of total marks in C++ programming, you have to ask from user to enter marks obtained in 5 subjects. Now add marks of all the 5 subjects and divide it by 5 to get average mark. And based on this average mark, find grade as per the table given above:

// C++ Program to Find Grade of Student // -------codescracker.com------- #include<iostream> using namespace std; int main() { int i; float mark, sum=0, avg; cout<<"Enter Marks obtained in 5 Subjects: "; for(i=0; i<5; i++)

Differentiate between TCP Reno and TCP Tahoe.

Answers

Answer:

They have different words

Explanation:

I hope it helps choose me the brainest

What is indirect program memory addressing? Explain the working of the following instructions?

a) JMP AX
b) JMP LIST[DX]
c) JMP NEAR PTR[DI+3]

Answers

Indirect main memory addressing is described as the method in which the variable's address is stored in a mind register and also a command is utilized to point towards the memory registers which hold the register. Instruction is used to direct towards a register that displays the results of the variables. The register, in turn, refers to that variable's address in simplistic words. As just a result, it is indeed considered a passive program, memory address.

The instructions operate as follows:

a)

JMP AX :

The JMP instruction is being used to execute an unconditional jump.AX is indeed the label's name. JMP AX codes are being used to transfer control of the flow program to the AX label.

b)

JMP LIST:

The JMP command can be used to execute an unconditional jump, JMP LIST[DX] is the label's name.  The JMP LIST[DX] program is being used to transfer control of its flow programs to the specified section. It is the segment to which the flow control is transmitted.

c)

JMP NEAR PTR[DI+3]: 

Unconditional jumps could be done with the JMP command as you'll see, the label is JMP NEAR PTR[DI+3]. It's being used to transmit flow control to a particular section, throughout this case [DI+3]. The close keyword indicates that perhaps the code segment would be in the line of code being nearby.

Learn more:

brainly.com/question/20320915

Kamal plans to offer new, more favorable contracts to business customers who are now receiving a discount and use wireless services. Determine whether each customer should receive a new contract as follows:
a. In cell 15, enter a formula using the AND function that tests whether the Wireless value is equal to "Y" and whether the Discount value is equal to "Y".
b. Fill the range 16:118 with the formula in cell 15.

Answers

Solution :

'AND" operation is a logical operation and is used in logical connective combining two statements and in truth tables.

Using AND operation verifies whether the outcome P and Q is true only when both the P as well as Q are true.  If one of the P or Q is not true, then outcome result will be false.

In the context, Kamal wishes to offer a new and more favorable contracts to the business customers who use a wireless services and receive a discount.

Therefore, using the AND operation of the customers as :

Customer     Wireless     Discount     Outcome

   A                   N                   N             FALSE

   B                   Y                   N             FALSE

  C                   N                   Y              FALSE

   D                   Y                   Y             TRUE

   

If you are to enhance the ICT used by your teachers, how will ypu do it? Will you use the same ICT or will you modify how it was integrated?​

Answers

To enhance the ICT (Information Communication Technology) used by teachers, I will modify how the ICT was integrated.

The modification of how ICT is integrated will change the culture that places teaching over technology.  Then, teachers will be taught how to use ICT to:

improve learning so that teachers become learning facilitatorsmotivate learners by fostering learning autonomy, making students less dependent on the teacherengage the learners by creating collaborative learningdiminish content learning so that students learn to think, create, and communicate effectivelymake learning a lifetime culture enhance the learning environment so that teachers become collaborators and co-learners with students.

Thus, I will enhance the ICT used by teachers by modifying its integration to achieve better results for both teachers and learners.

Learn more about the importance of ICT here: https://brainly.com/question/13724249

hi, please help me, please help me.​

Answers

my day has been good
hope this helps

In the home tab under the paragraph group of options what are you unable to do?

Answers

Im not sure what this is?? Maybe add a picture or more context! ❤️

Explain the purpose of the open() and close() operations.

Answers

Answer:

The open() operation notifies the system that the named file is about to become active. The close() operation notifies the system that the named file is no longer in active use by the user who issued the close operation.

Type the correct answer in the box. Spell all words correctly.
Which testing requires coding the test cases into a scripting language?
testing requires coding the test cases into a scripting language.

Answers

Answer:

sorry I forgot it

Explanation:

because I am now in a last position

Chất xơ có nhiều trong thực phẩm nào?

Answers

Answer: rau củ quả đều có lượng chất xơ nhiều hơn so với các loại thực phẩn khác

Explanation:

Why are data silos problematic?

Answers

Answer:

Hampers collaboration

Resource wastage

Lack of data integrity

Explanation:

Data silos comes into play When different departments of an orgainiziations independently collects data needed for its operations. The finance, HR, administrative departments and so on collects their data and keeps it to themselves. As a result there is a repetitive and needless gathering and storage of already existing data, that is the data required by one group will have to be gathered again while it currently exists with another group. This leads to inefficient resource management and wastage. This practice also leads to data integrity as data stored differently across departments becomes inconsistent and less accurate over time. Team work and collaboration is gradually eroded as each group continues to hold on to its resources which poses a problem towards organizational growth.

Select the correct statement(s) regarding IP addressing.
a. IPv4 and IPv6 addressing is fully compatible with one another.
b. CIDR address format represents a Class C network only used within an intranet.
c. Subnet masks are used with both class and classless IP addresses.
d. all statements are correct.

Answers

Yeah the answer is b

Subnet masks are used with both class and classless IP addresses is the correct statement. Therefore, the correct option is C.

What is an IP address?

A device on the internet or a local network may be identified by its IP address, which is a special address. The rules defining the format of data delivered over the internet or a local network are known as “Internet Protocol,” or IP.

Only C is correct, rest other statements are incorrect because:

a. IPv4 and IPv6 addressing is fully compatible with one another is incorrect. While IPv4 and IPv6 can coexist on the same network, they are not fully compatible with one another.

b. CIDR address format represents a Class C network only used within an intranet is incorrect. Classless Inter-Domain Routing (CIDR) is a technique used to allocate IP addresses more efficiently.

Therefore, subnet masks are used with both class and classless IP addresses is the correct statement. Therefore, the correct option is C.

Learn more about,  here

https://brainly.com/question/3805118

#SPJ6

hi, please help me.solution.​

Answers

Answer:

aahdbdnsjajaissjdjdhskakwjdhbebs

Code Example 9-1 struct Product { string name; double price; int quantity; }; (Refer to Code Example 9-1.) Given a Product object named product, which of the following statements would you use to display the value of the name data member on the console? a. cout << product::name; b. cout << product.name; c. cout << product("name"); d. cout << product[0];

Answers

Answer:

a. cout << Product ::name;

Explanation:

Computer software use different languages which helps user to initiate command. When a user initiates command the results are displayed according to input command. If product name is required as output then insert command should be product::name; this will display names of different products present in the system.

How to prepare and draw a corresponding flowchart to compute the sum and product of all prime numbers between 1 and 50

Answers

Answer:

Create boxes with the following content

Initialize sum to 0, product to 1 and number to 1Check if number is a prime. If yes, update sum += number and product *= numberIncrease number by 1If number is <= 50, go back to "check" block.

The check block has a diamond shape.

At the "yes" branch of the check block, you can create separate blocks for updating the sum and the product.

Connect the blocks using arrows.

Indicate the start and the end of the flow using the appropriate symbols.

The block to check if a number is a prime you could further decompose into the steps needed to do such a check.

Argue whether we can infer anything about a candidate’s ability to work in a professional environment based on his or her resume’s formatting.
Compare how you would address a resume with wacky fonts to how you would respond to grammatical errors in a resume.

Answers

Answer:

when dressing feaded back is postive and then list areas of inprovmenr to met the job requirements

Explanation:

I connected to an external hard drive to transfer some photos from my vacation. When I try to drag the photo, it bounces right back and does not transfer. What is the likely cause of this issue?

a. hard drive is full

b. photos were taken in a different country

c. USB port is broken

d. the file structure of the 2 hard drives are not compatible

Answers

Your answer is D.

Hope this helps and if you could answer the question I just uploaded titled giving brainliest that would be great. Basically, what you have to do is research why the book titled the list of things that will not change and explain why it’s your favorite book based on the message it tells you! Go to my profile and go to questions.

The answer is D, What is the likely cause of this issue is that the file structure of the two hard drives are not compatible.

The file structure or file system, of a hard drive, tells the disk how to read, write and store information on the drive. Some file systems do not allow the disk to store any files and often do not display error messages. If we try to drag a file onto a hard drive with this kind of file structure, the action would simply not be performed. This can be fixed by formatting the disk partition into a new file system.

Option B states that the issue may be that the photos were taken in a different country. This is not the cause of the problem because regardless of where the pictures are taken, they are all stored in common formats such as:

JPEGPNGJFIF

Any external hard drive capable of storing images will have the ability to receive files in these formats as well as many other image formats. For this reason, option B is False.

The question states that you were able to connect the external Hard drive and drag files onto it, though unsuccessfully. This tells us that the USB port is working as intended, if it were not working, it would not display the Hard drive onto the computer and we would not be able to drag files to it. Therefore, option C is false

Insufficient Hard drive storage space is a common issue in not being able to transfer files between hard drives. However, if this were the case, the user would be shown a message displaying the error. The message may look like:

"Insufficient space on the disk.""The Disk is full.""Not enough memory to complete this action"

The exact wording may vary depending on the operating system in use. Since the question states that the files simply "bounces back" without an error message displaying, we can infer that option A is false.

For more help with Hard drive issues see: https://brainly.com/question/14254444?referrer=searchResults

The program is the set of instructions a computer obeys

Answers

Answer:

True

Explanation:

a program is basicly just a list of commands you can run over and over again.

Khi thu nhập giảm, các yếu tố khác không đổi, giá cả và sản lượng cân bằng mới của hàng hóa thông thường sẽ:

Answers

Answer:

thấp hơn

Explanation:

Write a C program that will load entries from a file containing details of books and prints them.

Program Requirements:
a. Load file containing details of books
b. Print out all the books Required approach:

1. Design a struct/class that can hold the details of an individual book.
2. Dynamically allocate an array of these objects. The size should be the number of book entries from the input file given by the user.
3. Load all of the book entries into this array of objects before printing

Answers

Answer:

........

Explanation:

Fit a boosting model to the training set with Purchase as the response and the other variables as predictors. Use 1,000 trees, and a shrinkage value of 0.01. Which predictors appear to be the most important

Answers

Answer and Explanation:

For the training set consist of 1000 observations, let's have a set consist of the observations such as sets.seed train boost.caravan gbm(Purchase., data = Caravan.train , distribution = "gaussian" , n trees = 1000 summary(boost.caravan) The tree classification such as tree(formula = Purchase data - train where variable are used in tree construction and number of terminal nodes 0 and deviance is 0.7 and error is 0.165

who is considered as the father of computer science?​

Answers

Charles Babbage is known as father of computer science because he designed the original programmable computer .

I hope it helps and if you want to have good answer follow me, I will be your second sight on your any problems♥️♥️

DESCRIBE THE GENERAL STRATEGY BEHIND DEALOCK PREVENTION AND GIVE A PRATICAL EXAMPLE

Answers

Answer:

........

Explanation:..........

What Causes #### error?​

Answers

Answer:

The answer is below

Explanation:

Causes of ####error in Microsoft Excel can be traced to multiple sources. The major causes of #### error in Microsoft Excel, however, are the following:

1. When the column is not wide enough to show all values or figures of the cell contents.

2. When there are too many decimal places of the figure in a cell

3. When the date value in the cell is negative

4. When the time value in the cell is negative.

Other Questions
what is the solution for this equation? In(x+6)-in(2x-1)=0answers in the image! Are shape I and shape II similar? If so, give the dilation that proves they are similar. If not, explain why the shapes are not similar. Vit Nam c bao nhiu dn tc write the square root of 453/169 Select the correct answer.Consider the expression below.9+ 4(x + 2) - 3xSelect the term that best describes "3" in the given expression.exponentOB.constant.variableOD.coefficient On Tuesday at noon there were 4 inches of snow onthe ground. Then it snowed at a rate of i Inches perhour for 7 hours. By Tuesday at 7:00pm there were25 inches of snow on the ground. Which equationrepresents the situation? How many pounds of water must be evaporated from 50 pounds of a 3% salt solution so that the the remaining solution will be 5 % salt Find the remainder when f(x)=2x3+2x23x3 is divided by x2. Blood pressure of 132/78. What does the 78 indicate? A) Pressure when the left ventricle contractsB) Overall blood pressure readingC) The difference between Volume and PulseD) The pressure when the left ventricle relaxes A model of the Pythagorean Theorem is shown below.If a = 6 and c = 10 , which of the following could NOT be used to find the value of b?A. 102 = 62 + b2B. 102 + 62 = b2,C. 100 = 36 + b2,D. 10036=b2 Find question attached. What is the probability of the parents having a daughter? The population of a town is 24,000 and isincreasing at a rate of 6% per year for 3 years Which digit is in the thousandths place?98.327A. 7B. 2C. 3D. 9 Select the true statement about triangle ABC.A. cos A = cos CB. cos A = sin C C. cos A = sin BD. cos A = tan C What is the value of the expression below when w =9 and x = 2?w 4x Common stockholders' equity as of 1/1/2017 $7,031,250 Common stockholders' equity as of 12/31/2017 $8,593,750 Net sales for the year 2017 $3,906,250 Net income for the year 2017 $250,000 Common stock dividends paid during 2017 $10,000 Calculate the company's Payout Ratio. What are the x and y-intercepts of the line described by the equation?2x + 4y = 12.4Enter your answers, in decimal form, in the boxes.x=y= Work-Energy Theorem & PowerA 0.5 kg mass sitting on smooth ice is accelerated from rest by a force until isacquires a speed of 8 m/s. The force acts while the mass moves through adisplacement of 2 m.A. Calculate the kinetic energy of the mass after the force acts.B. Calculate the work done by the force.C. Calculate the magnitude of the force that accelerated the mass. A CD in the financial sense isA.a certificate of depositB.a record of your transactionsC.achecking accountD.a small savings account