Recall the problem of finding the number of inversions. As in the text, we are given a sequence of numbers a1, . . . , an, which we assume are all distinct, and we define an inversion to be a pair i < j such that aj < ai . We motivated the problem of counting inversions as a good measure of how different two orderings are. However, one might feel that this measure is too sensitive. Lets call a pair a significant inversion if i < j and 2aj < ai .

(a) Describe a O(n log n) algorithm to count the number of significant inversions between two orderings. Make clear how is it that your algorithm would achieve the given O(n log n) execution time bound.

Answers

Answer 1

Answer:

The algorithm is very similar to that of counting inversions. The only change is that here we separate the counting of significant inversions from the merge-sort process.

Explanation:

Algorithm:

Let A = (a1, a2, . . . , an).

Function CountSigInv(A[1...n])

if n = 1 return 0; //base case

Let L := A[1...floor(n/2)]; // Get the first half of A

Let R := A[floor(n/2)+1...n]; // Get the second half of A

//Recurse on L. Return B, the sorted L,

//and x, the number of significant inversions in $L$

Let B, x := CountSigInv(L);

Let C, y := CountSigInv(R); //Do the counting of significant split inversions

Let i := 1;

Let j := 1;

Let z := 0;

// to count the number of significant split inversions while(i <= length(B) and j <= length(C)) if(B[i] > 2*C[j]) z += length(B)-i+1; j += 1; else i += 1;

//the normal merge-sort process i := 1; j := 1;

//the sorted A to be output Let D[1...n] be an array of length n, and every entry is initialized with 0; for k = 1 to n if B[i] < C[j] D[k] = B[i]; i += 1; else D[k] = C[j]; j += 1; return D, (x + y + z);

Runtime Analysis: At each level, both the counting of significant split inversions and the normal merge-sort process take O(n) time, because we take a linear scan in both cases. Also, at each level, we break the problem into two subproblems and the size of each subproblem is n/2. Hence, the recurrence relation is T(n) = 2T(n/2) + O(n). So in total, the time complexity is O(n log n).

Correctness Proof: We will prove a stronger statement that on any input A our algorithm produces correctly the sorted version of A and the number of significant inversions in A. And, we will prove it by induction. Base Case: When n = 1, the algorithm returns 0, which is obviously correct.

Inductive Case: Suppose that the algorithm works correctly for 1, 2, . . . , n − 1. We have to show that the algorithm also works for n. By the induction hypothesis, B, x, C, y are correct. We need to show that the counting of significant split inversions and the normal merge-sort process are both correct. In other words, we are to show that z is the correct number of significant split inversions, and that D is correctly sorted.

First, we prove that z is correct. Due to the fact that B and C are both sorted by the induction hypothesis, for every C[j], where j = 1, . . . , length(C), we can always find the smallest i such that B[i] > 2C[j]. Therefore, B[1], B[2], . . . , B[i − 1] are all smaller than or equal to 2C[j], and B[i], B[i + 1], . . . , B[length(B)] are all greater than 2C[j]. Thus, length(B) − i + 1 is the correct significant split inversion count for pairs involving C[j]. After counting the number of correct significant split inversions for all C[j], where j = 1, . . . , length(C), z is the correct number of significant split inversions. Second, we show that D is the sorted version of A.

This is actually the proof of merge-sort. Each time, we append one element from B or C to D. At each iteration k, since B and C are both sorted by the induction hypothesis, min(B[i], C[j]), the one to be appended to D, is also the smallest number among all the numbers that have not been added to D yet.

As a result, every time we append the smallest remaining element (of B and C) to D, which makes D a sorted array


Related Questions

P6. In step 4 of the CSMA/CA protocol, a station that successfully transmits a frame begins the CSMA/CA protocol for a second frame at step 2, rather than at step 1. What rationale might the designers of CSMA/CA have had in mind by having such a station not transmit the second frame immediately (if the channel is sensed idle)?

Answers

Answer:

To avoid collision of transmitting frames.

Explanation:

CSMA/CA, carrier sense multiple access is a media access control protocol of wireless networks that allows for exclusive transmission of frames and avoidance of collision in the network. When a frame is not being sent, nodes listening for an idle channel gets their chance. It sends a request to send (RTS) message to the access point. If the request is granted, the access point sends a clear to send (CTS) message to the node, then the node can transmit its frame.

Many nodes on a wireless network are listening to transmit frames, when a frame is transmitting, the node has to wait for the access point to finish transmitting, so it sends a RTS message again to exclusively transmit a second frame.

A file concordance tracks the unique words in a file and their frequencies. Write a program that displays a concordance for a file. The program should output the unique words and their frequencies in alphabetical order. Variations are to track sequences of two words and their frequencies, or n words and their frequencies. Below is an example file along with the program input and output: example.txt

Answers

Answer:

Python file with appropriate comments given below

Explanation:

#Take the input file name

filename=input('Enter the input file name: ')

#Open the input file

inputFile = open(filename,"r+")

#Define the dictionary.

list={}

#Read and split the file using for loop

for word in inputFile.read().split():

  #Check the word to be or not in file.

  if word not in list:

     list[word] = 1

  #increment by 1

  else:

     list[word] += 1

#Close the file.

inputFile.close();

#print a line

print();

#The word are sorted as per their ASCII value.

fori in sorted(list):

  #print the unique words and their

  #frequencies in alphabetical order.

  print("{0} {1} ".format(i, list[i]));

The program which produces a sorted output of words and frequency based on a read on text file is written in python 3 thus :

filename = input('Enter the your file name : ')

#accepts user input for name of file

input_file = open(filename,"r+")

#open input file in read mode

list= dict()

#initialize an empty dictionary

for word in input_file.read().split():

#Read each line and split the file using for loop

if word not in list:

list[word] = 1

#increment by 1

else:

list[word] += 1

#if word already exists in dictionary increase frequency by 1, if not assign a frequency of 1

input_file.close();

#close the file

for i in sorted(list):

print("{0} {1} ".format(i, list[i]));

#loop through and display the word and its corresponding frequency

Learn more : https://brainly.com/question/19114739

A data is a ____ large scale collection of data that contains and organizes all of an organizations data in one place.

Answers

Answer:

"Warehouse" is the correct answer for the given question.

Explanation:

The warehouse is the process that organized the data of the organizations or large data in one place. In the Data Warehouse, it organized and integrated the data from an organization or other sources in the one placed.

The main aim of Warehouse is to organized the data in one place which is used for the process of decision-making activity. The following are the function of the warehouse which is given below.

Extraction of data. Cleaning of data. Transformation of the data. Loading the data. Updating the data.

Give pseudocode for an algorithm that removes all negative values from an array, preserving the order of the remaining elements.

Answers

Answer:

Begin.

WRITE  ''enter test array''

READ test array

test [ ] = new_int [ ] { enter test array here, separated by comma}

int [ ] positives = Arrays.stream(test). filter(x -> x >= 0).toArray();

System. out. println( " Positive array");

for (int i : positives) {

      System.out.print(i+ "\t");  }

WRITE  positive array

End

Explanation

The pseudocode for the  alogirithm has been simplified above, it is implemented in Java 8

Assume all memory accesses are cache hit. 20% of the Load instructions are followed by a dependent computational instruction, and 30% of the computational instructions are also followed by a dependent computational instruction. 20% of the branch instructions are unconditional, while 80% are conditional. 40% of the conditional branches are taken, 60% are not taken. The penalty for taking the branch is one cycle. If data forwarding is allowed, what is the instruction throughput for pipelined execution?

Answers

Answer:

i hope it will help you!

Explanation:

Using Structured Query Language (SQL), create a query that gets the following data from the sakila database:

Actor Last Name, Actor First Name, Film Title
For all actors with a last name that begins with M
In alphabetical order by Actor's Last Name

Answers

Queries to get data from sakila database using Structured Query Languange (SQL):

Assuming that you have created a Database already, with tables in it, containing at least 50 records and these fields:

ACTOR_LASTNAME, ACTOR_FIRSTNAME, FILM_TITLE

Take note that the database and table name is both "sakila".

1. We can fetch, display or get data using SELECT command or query. Let's type the command like this:

SELECT ACTOR_LASTNAME, ACTOR_FIRSTNAME, FILM_TITLE FROM sakila  

The command above is called SELECT command that would allow you to display records inside your table. Normally SQL programmers would execute SELECT * command, but since we are just required to display three (3) columns only, then we could just select the column names for our data display. Your columns are: SELECT ACTOR_LASTNAME, ACTOR_FIRSTNAME and FILM_TITLE.

2. For the second command or query, we can execute this:

SELECT ACTOR_LASTNAME FROM sakila WHERE ACTOR_LASTNAME 'M%' ORDER BY ACTOR_LASTNAME .

The select where command is like a conditional statement (IF). Where is the statement used to display ACTOR_LASTNAME field starting with letter M. The ORDER BY command is the arrangement of the names in alphabetical order.  

(1) Create three files to submit:
ItemToPurchase.h - Class declaration
ItemToPurchase.cpp - Class definition
main.cpp - main() function
Build the ItemToPurchase class with the following specifications:
Default constructorPublic class functions (mutators & accessors)
SetName() & GetName() (2 pts)
SetPrice() & GetPrice() (2 pts)
SetQuantity() & GetQuantity() (2 pts)
Private data members
string itemName - Initialized in default constructor to "none"
int itemPrice - Initialized in default constructor to 0
int itemQuantity - Initialized in default constructor to 0

Answers

Answer:

We have the files and codes below with appropriate comments

Explanation:

ItemToPurchase.h:

#pragma once

#ifndef ITEMTOPURCHASE_H_INCLUDED

#define ITEMTOPURCHASE_H_INCLUDED

#include<string>

#include <iostream>

using namespace std;

class ItemToPurchase

{

public:

    //Declaration of default constructor

    ItemToPurchase();

    //Declaration of SetName function

    void SetName(string ItemName);

    //Declaration of SetPrice function

    void SetPrice(int itemPrice);

    //Declaration of SetQuantity function

    void SetQuantity(int itemQuantity);

    //Declaration of GetName function

    string GetName();

    //Declaration of GetPrice function

    int GetPrice();

    //Declaration of GetQuantity function

    int GetQuantity();

private:

    //Declaration of itemName as

    //type of string

    string itemName;

    //Declaration of itemPrice as

    //type of integer

    int itemPrice;

    //Declaration of itemQuantity as

    //type of integer

    int itemQuantity;

};

#endif

ItemToPurchase.cpp:

#include <iostream>

#include <string>

#include "ItemToPurchase.h"

using namespace std;

//Implementation of default constructor

ItemToPurchase::ItemToPurchase()

{

    itemName = "none";

    itemPrice = 0;

    itemQuantity = 0;

}

//Implementation of SetName function

void ItemToPurchase::SetName(string name)

{

    itemName = name;

}

//Implementation of SetPrice function

void ItemToPurchase::SetPrice(int itemPrice)

{

    this->itemPrice = itemPrice;

}

//Implementation of SetQuantity function

void ItemToPurchase::SetQuantity(int itemQuantity)

{

    this->itemQuantity = itemQuantity;

}

//Implementation of GetName function

string ItemToPurchase::GetName()

{

    return itemName;

}

//Implementation of GetPrice function

int ItemToPurchase::GetPrice()

{

    return itemPrice;

}

//Implementation of GetQuantity function

int ItemToPurchase::GetQuantity()

{

    return itemQuantity;

}

main.cpp:

#include<iostream>

#include<string>

#include "ItemToPurchase.h"

using namespace std;

int main()

{

    //Declaration of ItemToPurchase class objects

    ItemToPurchase item1Cart, item2Cart;

    string itemName;

    //create a variable names like itemPrice

    //itemQuantity,totalCost as type of integer

    int itemPrice;

    int itemQuantity;

    int totalCost = 0;

    //Display statement for Item1

    cout << "Item 1:" << endl;

    cout << "Enter the item name : " << endl;

    //call the getline function

    getline(cin, itemName);

    //Display statememt

    cout << "Enter the item price : " << endl;

    cin >> itemPrice;

    cout << "Enter the item quantity : " << endl;

    cin >> itemQuantity;

    item1Cart.SetName(itemName);

    item1Cart.SetPrice(itemPrice);

    item1Cart.SetQuantity(itemQuantity);

    //call cin.ignore() function

    cin.ignore();

    //Display statement for Item 2

    cout << endl;

    cout << "Item 2:" << endl;

    cout << "Enter the item name : " << endl;

    getline(cin, itemName);

    cout << "Enter the item price : " << endl;

    cin >> itemPrice;

    cout << "Enter the item quantity : " << endl;

    cin >> itemQuantity;

    item2Cart.SetName(itemName);

    item2Cart.SetPrice(itemPrice);

    item2Cart.SetQuantity(itemQuantity);

    //Display statement

    cout << "TOTAL COST : " << endl;

    cout << item1Cart.GetName() << " " << item1Cart.GetQuantity() << " @ $" << item1Cart.GetPrice() << " = " << (item1Cart.GetQuantity()*item1Cart.GetPrice()) << endl;

    cout << item2Cart.GetName() << " " << item2Cart.GetQuantity() << " @ $" << item2Cart.GetPrice() << " = " << (item2Cart.GetQuantity()*item2Cart.GetPrice()) << endl;

    totalCost = (item1Cart.GetQuantity()*item1Cart.GetPrice()) + (item2Cart.GetQuantity()*item2Cart.GetPrice());

    cout << endl;

    cout << "Total : $" << totalCost << endl;

    return 0;

}

Suppose that infile is an ifstream variable and it is associated with the file that contains the following data: 27306 savings 7503.35. Write the C11 statement(s) that reads and stores the first input in the int variable acctNumber, the second input in the string variable accountType, and the third input in the double variable balance.

Answers

Answer:

The C++ code is given below. The highlighted code is essential for reading the file. Appropriate comments given guide for better understanding

Explanation:

// reading a text file

#include <iostream>

#include <fstream>

#include <string>

using namespace std;

int main ()

{

int acctNumber;

string accountType;

double balance;

// openfile

ifstream infile ("inputfile.txt");

 

if (infile.is_open())

{

while (true)

{

 

// reading from file

infile >> accountType;

infile >> accountType;

infile >> balance;

// break loop when end of file reached

if( infile.eof() )

break;

}

// close file

infile.close();

}

else

cout << "Unable to open file";

return 0;

}

To print the number of elements in the array named ar, you can write :

A.System.out.println(length);

B.System.out.println(ar.length());

C.System.out.println(ar.length);

D.System.out.println(ar.length-1);

Answers

Answer:

Option c is correct.

Example :

public class Subject

{

public static void main(String [] args)

{

int ar[]={5,4,6,7,8};

System.out.println("the number of array elements are: ",ar.length);

}

}

Explanation:

The above program is created in java language in which Subject is a class name.Inside Subject class , there is main method.

Inside the main method, there is An array named 'ar' which data type is an integer and we have assigned the value to this array.

in the next line, we are printing the total no. of the element in the array with the length function which displays the length of an array or variable.

Write a program that takes a date as input and outputs the date's season. The input is a string to represent the month and an int to represent the day.

Answers

Answer:

void season(char * month, int day){

if(strcpy(month, "January") == 0 || strcpy(month, "February") == 0)

printf("Winter\n");

else if(strcpy(month, "March") == 0){

if(day < 20)

printf("Winter\n");

else

printf("Spring\n");

}

else if(strcpy(month, "April") == 0 || strcpy(month, "May") == 0)

printf("Spring\n");

else if(strcpy(month, "June") == 0){

if(day < 20)

printf("Spring\n");

else

printf("Summer\n");

}

else if(strcpy(month, "July") == 0 || strcpy(month, "August") == 0)

printf("Summer\n");

else if(strcpy(month, "September") == 0){

if(day < 20)

printf("Summer\n");

else

printf("Autumn\n");

}

else if(strcpy(month, "October") == 0 || strcpy(month, "November") == 0)

printf("Autumn\n");

else if(strcpy(month, "December") == 0){

if(day < 20)

printf("Autumn\n");

else

printf("Winter\n");

}

}

Explanation:

I am going to write a C program for this.

I am going to use the function strcpy, from the library string.h, to compare strings. It returns 0 when strings are equal.

I am going to say that the season change happens at day 20, in March, June, September and December

void season(char * month, int day){

if(strcpy(month, "January") == 0 || strcpy(month, "February") == 0)

printf("Winter\n");

else if(strcpy(month, "March") == 0){

if(day < 20)

printf("Winter\n");

else

printf("Spring\n");

}

else if(strcpy(month, "April") == 0 || strcpy(month, "May") == 0)

printf("Spring\n");

else if(strcpy(month, "June") == 0){

if(day < 20)

printf("Spring\n");

else

printf("Summer\n");

}

else if(strcpy(month, "July") == 0 || strcpy(month, "August") == 0)

printf("Summer\n");

else if(strcpy(month, "September") == 0){

if(day < 20)

printf("Summer\n");

else

printf("Autumn\n");

}

else if(strcpy(month, "October") == 0 || strcpy(month, "November") == 0)

printf("Autumn\n");

else if(strcpy(month, "December") == 0){

if(day < 20)

printf("Autumn\n");

else

printf("Winter\n");

}

}

ted must send highly sensitive data over his pptp connection. what feature of pptp will give him the confidence that his data wont be stolen in route

Answers

Answer:

Encryption

Explanation:

PPTP (Point to Point Tunneling Protocol) is an old way of implementing networks, PPTP uses Generic routing encapsulation tunnel to encapsulate data sent on the network and Microsoft Point to Point Encryption (MPPE) those encryption mechanism ensures that data/packets sent through the network are encrypted.

Consider the following class definition.public class Rectangle{private double length;private double width;public Rectangle(double l, double w){length = l;width = w;}public void set(double l, double w){length = l;width = w;}public void print(){System.out.println(length + " " + width);}public double area(){return length * width;}public double perimeter(){return 2 length + 2 width;}}Which of the following statements correctly instantiate the Rectangle object myRectangle?(i) myRectangle Rectangle = new Rectangle(10, 12);(ii) class Rectangle myRectangle = new Rectangle(10, 12);(iii) Rectangle myRectangle = new Rectangle(10, 12);

Answers

Answer:

The answer is "option (iii)".

Explanation:

Instantiation stands for a specific instance creation of model or abstraction. It is also known as object code. In the given question the correct code for instantiating a class in java is option iii because it is the correct format.  In this option, we create a class object that is "myRectangle" and call the parameterized constructor by passing value in parameter this process is known as instantiation. In instantiation first, we write a class name that is "Rectangle" then create an object that is "myRectangle" and use a new keyword for instantiating an object. In option (i) we use the object name first and in option (ii) we use class keyword that's why both options are incorrect.  

Which one of the following is not possible to view in the debug logs?

A. Workflow formula evaluation results
B. Assignment rules
C. Formula field calculations
D. Validation rules
E. Resources used by Apex Script

Answers

Answer:

Formula field calculations

Explanation:

We can use debug logs to track events in our company, these events are generated if active users have trace indicators.

A debug log can register information about database operations, system processes and errors, in addition, we can see Resources used by Apex, Workflow Rules, Assignment Rule, HTTP calls, and Apex errors, validation rules. The only one we cannot see is Formula field calculations.

What kind of app or technology would you like to create?  Why ?


Answers

Answer:

i would like to create an app that reminds old people or people with cancer to take their medications....

Explanation:

why: i would like to make this because my friends sister was 7 and had died from cancer due to not taking her medication...also i would like to because older people tend to forget or the have Alzheimer Disease and/or dementia and they cant remember to take their pills.

To use an ArrayList in your program, you must import:1. the java.collections package2. the java.awt package3. Nothing; the class is automatically available, just like regular arrays.4. the java.util package5. the java.lang package

Answers

Answer:

Option 4: the java.util package

Explanation:

Java Array List is not imported by default and therefore we need to import java.util package. Array List is one of the Java predefined collections used to store a group of entities.

One advantage offered by Array List compared with a normal array is that an item can be dynamically added into the list without recreating a new list. Besides, array list also offered some built in methods to manipulate the elements within the list that can save a project development time.

The largest signed integer number, base 16, that can be store in a variable of type BYTE is___________.

Answers

Answer:

7F is largest signed integer number, base 16, that can be store in a variable of type BYTE.

Explanation:

A BYTE has 8bits and it signed value ranges from -128 to 127. thus the largest maximum signed integer number, that can be store in a variable of type BYTE is 127.

Base 16 value for the decimal value of 127 is 7F.

Therefore 7F is largest signed integer number, base 16, that can be store in a variable of type BYTE.

Display flight number, origin, destination, fl_orig_time as --"Departure Time", fl_dest_time as "Arrival Time". Format times in Miltary time (24 hour format) with minutes. Order results by flight number. Hint the format should be in 'hh24:mi'format.

Answers

Answer:

Select "flight number", origin, destination, format(fl_orig_time, 'HH:mm' ) as "Departure Time", format(fl_dest_time, 'HH:mm') as "Arrival Time" from table_name order by flight_number

Explanation:

The script is used to select records from the table named 'table_name' and formatted to 24hr time format with the hour in capital letters (signifying 24 hrs). Then the inverted comma used for flight number is due to the space character ebtween the two words. In a select statement, order by comes after the table name. While as is used as an alias for a column in a table.

A rectangular range of cells with headings to describe the cells' contents is referred to as a?

A. bar chart.
B. complex formula.
C. table.
D. sparkline.

Answers

Answer:

Table

Explanation:

A table of information is a set of rows and columns. It is a way of displaying information.

For example if we want to organize the information in the rows and columns then we should make the table. These rows and columns are formed cells and cells gathers to make a table.

A rectangular range of cells with headings to describe the cells' contents is referred to as a Table.

If you pass the array ar to the method m() like this, m(ar); the element ar[0] :
A. will be changed by the method m()
B. cannot be changed by the method m()
C. may be changed by the method m(), but not necessarily
D. None of these

Answers

Answer: (B)

Explanation:

Any changes on array made inside the function m() will only affect the ar[] present inside the function that means its scope is only within the function. The original array ar[] outside the fuction's scope won't change.

A rootkit uses a directed broadcast to create a flood of network traffic for the victim computer.a. Trueb. False

Answers

Answer:

The following statement is False.

Explanation:

The following statement is not true because the rootkit is an application that provides unauthorized access to the computer or any program and it is the software that is intended to harm the computer system. So, that's why the rootkit is not used to create a flood of the network traffic in the user's system.

_____ allow you to logically separate ports in switches to create subdomains without wiring your network as physical subdomains. This is particularly helpful in office situations where seating does not determine the role of the user.

Answers

Answer:

The correct answer for the following question is VLAN.

Explanation:

It stands for Virtue Logical Area Network which allows you to group port on a switch logically. VLANs can be extend across (a period of time) multiple switches means you used to express on port that you're in that VLAN by changing the VLAN number.

We have the ability to improve our security with VLANs by controlling what VLAN is accessing with the other network of VLANs. So that this network is particularly helpful in office situation to create subdomain without wiring physical domain as your network.

Algonac Systems, a software start-up company, uses a technology in which the employees have to key in certain names and their respective codes to access information from different departments. Given this information, it can be concluded that Algonac Systems uses _____ to access information from different departments.

Answers

Answer:

ADD ME ON TIK TOK @ madison.beautiful.dancer

Explanation:

Algonac Systems uses a Logical Access Control system for accessing departmental information, which includes identification through specific names and codes, enhancing security and efficiency.

Algonac Systems, a software start-up company, uses a Logical Access Control system to access information from different departments. This system requires employees to input specific names and their respective codes to gain entry to various areas of data. This method falls under the identification component of access control systems, where technological restrictions such as usernames and passwords are employed to control access to computers and networks.

The logical access control method at Algonac Systems is designed to enhance security by ensuring that only authorized personnel have access to sensitive information and department-specific data. By incorporating unique identifiers for each department, Algonac Systems maintains organized and secure databases, streamlining the process for employees to reach relevant data. This efficiency is crucial for the company's operations, as it allows employees to report and retrieve data through user-friendly interfaces regardless of their location.

Access Control Systems consist of several parts including identification, authentication, authorization, and audit. In the case of Algonac Systems, they rely heavily on the component of identification where employees use assigned names and codes, which correlates to the database system where information is organized and accessed through unique identifiers, ensuring secure and efficient retrieval of data.

If a voice call has missing data it makes it hard to understand the speaker. Therefore, we commonly allow time for a limited number of retransmissions before playing the sound to the listener. If the network path (in each direction) has total packetization delay of 15ms, total propagation delay of 25ms, and queuing delay varying between 0ms and 10ms, how large (in milliseconds) does the playback buffer need to be if we want to allow for one retransmission?

Answers

Answer:

There will be a playback buffer of 100ms due to re-transmission.

Explanation:

Video and audio packets needs to be reliable in a network, so a connection oriented protocol like TCP (transmission control protocol) is always configured for this case.

Delays in the transmission of packets can be noticeable with regards to videos and audios and they can be calculated and configured when necessary.

In this scenario, there is a re-transmission of a dropped packet, so it is not acknowledged by the receiver. An ICMP message is sent to the source with a delay of;

total delay to source: packetization delay + propagation delay + queuing delay

                                =   15ms +  25ms  +  10ms      = 50ms

Re-transmitting to the receiver, in equal condition, takes the same amount of time

        Total delay after re-transmission = 2 × 50   = 100ms.

So the maximum delay is 100ms

Write a function which sorts the queue in order from the smallest value to the largest value. This should be a modified version of bubble sort.

Answers

Answer:

#include <iostream>

using namespace std;

void swap(int *a,int *b){    //function to interchange values of 2 variables

   int temp=*a;

   *a=*b;

   *b=temp;

}

void sort(int queue[],int n)

{

   int i,j;

   for(i=0;i<n;i++)      //to implement bubble sort

   {

       for(j=0;j<n-i-1;j++)

       {

           if(queue[j]>queue[j+1])

               swap(queue[j],queue[j+1]);    //to swap values of these 2 variables

       }

   }

}

int main()

{

   int queue[]={6,4,2,9,5,1};

   int n=sizeof(queue)/4;  //to find length of array

   sort(queue,n);

   for(int i=0;i<n;i++)

       cout<<queue[i]<<" ";

   return 0;

}

OUTPUT :

1 2 4 5 6 9

Explanation:

In the above code, Queue is implemented using an array and then passed to a function sort, so that the queue can be sorted in ascending order. In the sort function, in each pass 2 adjacent values are compared and if lower index value is greater than the higher one they are swapped using a swap function that is created to interchange the values of 2 variables.

Which of the following processes should Angel use to merge cells A1:D4 to create a title?
A. Highlight cells A1:D4, right-click and select Format Cells, click Number, and choose the Merge cells option.
B. Highlight cells A1:D4, click on the Home tab, and click on the Merge cells icon in the Styles group.
C. Highlight cells A1:D4, click on the Home tab, and click on the Wrap text icon in the Alignment group.
D. Highlight cells A1:D4, right-click and select Format Cells, click Alignment, and choose the Merge cells option.

Answers

Answer:

Highlight cells A1:D4, right-click and select Format Cells, click Alignment, and choose the Merge cells option.

Explanation:

We merge cells with the help of following methods.

Method 1  

Highlight cells A1:D4click on the Home tabclick on the Merge and Center icon in the Alignment group

1st method is not given in options of question.

Method 2

Highlight cells A1:D4 right-click and select Format Cells click Alignmentchoose the Merge cells option

2nd method is matching with option D. So, Option D is the answer.

Describe how tuples can be useful with loops over lists and dictionaries, and give Python code examples. Create your own code examples.

Answers

Answer:

The explained gives the merits of tuples over the lists and dictionaries.

Explanation:

Tuples can be used to store the related attributes in a single object without creating a custom class, or without creating parallel lists..

For example, if we want to store the name and marks of a student together, We can store it in a list of tuples simply:

data = [('Jack', 90), ('Rochell', 56), ('Amy', 75)]

# to print each person's info:

for (name, marks) in data:

       print(name, 'has', marks, 'marks')

# the zip function is used to zip 2 lists together..

Suppose the above data was in 2 parallel lists:

names = ['Jack', 'Rochell', 'Amy']

marks = [90, 56, 75]

# then we can print same output using below syntax:

for (name, marks) in zip(names, marks):

       print(name, 'has', marks, 'marks')

# The enumerate function assigns the indices to individual elements of list..

# If we wanted to give a index to each student, we could do below:

for (index, name) in enumerate(names):

       print(index, ':', name)

       

# The items method is used in dictionary, Where it returns the key value pair of

# the dictionary in tuple format

# If the above tuple list was in dictionary format like below:

marksDict = {'Jack': 90, 'Rochell': 56, 'Amy': 75}

# Then using the dictionary, we can print same output with below code:

for (name, marks) in marksDict.items():

       print(name, 'has', marks, 'marks')

Tuples are useful for looping over lists and dictionaries because of their immutability and hashable properties. They help maintain data integrity and efficiency.

Tuples are immutable sequences in Python, and they are often used when looping over lists and dictionaries to maintain data integrity and utilize their hashable properties in dictionaries.
Here are some examples,

Looping with Tuples Over Lists

When looping over a list of tuples, you can easily unpack the elements for use within the loop.
Here's a simple example,

students = [("John", 85), ("Jane", 92), ("Dave", 78)]

for name, score in students:
   print(f"Student: {name}, Score: {score}")

This code will output:

Student: John, Score: 85
Student: Jane, Score: 92
Student: Dave, Score: 78

Looping with Tuples Over Dictionaries

In dictionaries, tuples can be useful as keys because they are immutable and hashable. You can also convert dictionary items into tuples to easily iterate over them.
Here's an example,

grades = {"John": 85, "Jane": 92, "Dave": 78}

for name, score in grades.items():
   print(f"Student: {name}, Score: {score}")

This code will produce the same output as the previous example. Using tuples in this way helps preserve data integrity and allows for efficient key-value pair iteration.

True or False? Lobbying is a type of innovation where bankers and other financiers try to change regulations

a. True
b. False

Answers

Answer:

The answer is "Option a".

Explanation:

Lobbying is a kind of creativity in which the restrictions are changed by financiers and other industrialists. It is a good deflation often induced financiers to just use legal tax drilling.  

It is too expensive, financiers petitioned to modify the legislative system in order it a little less stringent in general. It is used to convey the desires of a group with the legislation, that is usually formed by-elections, which brings citizens with certain viewpoints to political roles, that's why the given statement is true.

Consider the following base and derived class declarations: class BaseClass { public: void BaseAlpha(); private: void BaseBeta(); float baseField; }; class DerivedClass : public BaseClass { public: void DerivedAlpha(); void DerivedBeta(); private: int derivedField; }; For each class, do the following:

a) List all private data members.
b) List all private data members that the class's member functions can reference directly.
c) List all functions that the class's member functions can invoke.
d) List all member functions that a client of the class may invoke.

Answers

Final answer:

The private data members of BaseClass and DerivedClass are baseField and derivedField, respectively. Member functions of BaseClass can directly reference baseField and call BaseAlpha(), while DerivedClass member functions can access derivedField and can invoke DerivedAlpha(), DerivedBeta(), and the inherited BaseAlpha(). Clients may call BaseAlpha() for BaseClass and DerivedAlpha(), DerivedBeta(), and the inherited BaseAlpha() for DerivedClass.

Explanation:

Private Data Members and Member Functions in C++ Classes

In the given C++ classes, the private data members and member functions that can be accessed are:

BaseClass

a) Private data members: float baseField

b) Can reference directly: float baseField

c) Member functions can invoke: void BaseAlpha()

d) Client may invoke: void BaseAlpha()

DerivedClass

a) Private data members: int derivedField

b) Can reference directly: int derivedField

c) Member functions can invoke: void DerivedAlpha(), void DerivedBeta(), and inherited void BaseAlpha()

d) Client may invoke: void DerivedAlpha(), void DerivedBeta(), and inherited void BaseAlpha()

Note that private member functions are not listed as they cannot be accessed outside of the class definition. Also, the derived class has access to all of its own members as well as the public and protected members of its base class.

What does the following loop do?int[] a = {6, 1, 9, 5, 12, 3};int len = a.length;int x = 0;for (int i = 0; i < len; i++)if (a[i] % 2 == 0) x++;System.out.println(x);1. Sums the even elements in a.2. Finds the largest value in a.3. Counts the even elements in a.4. Finds the smallest value in a.

Answers

Answer:  

The answer is "Option 3"  

Explanation:  

The description of the above java code can be given as:  

In the given code an array initialized elements in the next line an integer variable that is "len" is define this variable holds a length of the array and another variable "x" is defined that holds value 0.  Then we use loop in loop a conditional statement is used that checks in array if any number is even. If this condition is true so the value of x variable increases by 1 and prints its value.  

How does the practice of storing personal genetic data in privately owned computer databases raise issues affecting information ownership and property-rights?

Answers

Answer:company privacy policy change, third party access, non-effective laws, database hacking

Explanation:

Company privacy policy:company privacy policy protecting consumer information may not be strong enough, and may also change unfavourably in the future depending on certain factors.

Third party access: company may be pressurized by law enforcement/government to release genetic data for state purposes.

Non-effective laws: state laws guarding genetic information of individuals might not be broad enough as to be effective.

Database hacking: company/private database might be a victim of computer hacking.

Other Questions
Which of the following is an example of a cultural change that occurred due to interaction between the Europeans and the NativeAmericans?OA. Native American architectural styles became quite popular in Europe.OB. European missionaries introduced Christianity to the Native Americans.OC. European schools started teaching Native American languages.OD. People in Europe began dressing like Native Americans. What kind of criminal case is a county court most likely to hear? a) misdemeanor b) appeal c) felony Consider the following situations for Shocker:a. On November 28, 2018, Shocker receives a $4,500 payment from a customer for services to be rendered evenly overthe next three months. Deferred Revenue is credited.b. On December 1, 2018, the company pays a local radio station $2,700 for 30 radio ads that were to be aired, 10 per month, throughout December, January, and February. Prepaid Advertising is debited.c. Employee salaries for the month of December totaling $8,000 will be paid on January 7, 2019.d. On August 31, 2018, Shocker borrows $70,000 from a local bank. A note is signed with principal and 9% interest to bepaid on August 31, 2019.Required:Record the necessary adjusting entries for Shocker at December 31, 2018. No adjusting entries were made during the year Suppose a perfectly competitive firm, which is initially in long-run equilibrium experiences a decrease in the wages it must pay its employees. In the short run, which of the following will occur? Which of these is not a benefit for businesses using fully integrated e-commerce platforms? The lowest monthly commission that a salesman earned was only 1/5 more than 1/4 as high as the highest commision he earned. The highest and lowest comissions when added together equal $819. What was the lowest comission? Which system of equations can be used to find the roots of the equation 4x5-12x4+6x=5x3-2x? After spending two hours trying to solve an engineering problem, Amira finally gave up. As she was trying to fall asleep that night, a solution to the problem popped into her head. Amira's experience best illustrates:a. belief perseveranceb. the availability heuristicc. insightd. a fixation A beam of electrons, each with the same kinetic energy, illuminates a pair of slits separated by a distance of 51 nm. The beam forms bright and dark fringes on a screen located a distance 2.6 m beyond the two slits. The arrangement is otherwise identical to that used in the optical two-slit interference experiment. The bright fringes are found to be separated by a distance of 0.4 mm. What is the kinetic energy of the electrons in the beam? Plancks constant is 6.63 1034 J s. Answer in units of keV. Write a function which sorts the queue in order from the smallest value to the largest value. This should be a modified version of bubble sort. The volume of a sphere is increasing at a rate of 6 cubic centimeters per hour. At what rate, in centimeters per hour, is its diameter increasing with respect to time at the instant the radius of the sphere is 3 centimeters.A: 1/3B: 1C: 6D: 6 One of the sentences in the story is "They leaped like deer on the moon." This hyperbole, is also an example of_________.A. understatement B. dialogue C.simile D. metaphor Your company does not want its employees to use the Internet to exchange personal e-mail during work hours. What is the best tool to use to ensure the company does not violate an employees right to privacy? Question 1 with 1 blank prevenir las caries (cavities) Question 2 with 1 blankcepillarse los dientes despus de cada comida Question 3 with 1 blankno comer dulces Question 4 with 1 blankponer poco azcar en el caf o el t Question 5 with 1 blankcomer o beber alimentos que tengan calcio Question 6 with 1 blankconsultar al dentista peridicamente A mixture contains only NaCl and Al2(SO4)3. A 1.45-g sample of the mixture is dissolved in water, and an ex- cess of NaOH is added, producing a precipitate of Al(OH)3. The precipitate is filtered, dried, and weighed. The mass of the precipitate is 0.107 g. What is the mass percent of Al2(SO4)3 in the sample? INCREASING the number of warehouses will __________ the warehousing and inventory costs, but may __________ transportation a. costs. b. lscm Area addition and subtraction Rewrite 27+36 using GCF and the Distributive property When a primary drive impels someone toward a behavior and a secondary drives impels the person away from that same behavior, __________ develops.A) an avoidance-frustration conflictB) an approach-approach conflictC) an approach-avoidance conflictD) an avoidance-aggression conflictE) an avoidance-avoidance conflict In North Carolina demand for fresh water has increased dramatically. One of the main reasons for this is increased water use for agriculture. Steam Workshop Downloader