Questions
Assuming standard 1500 byte Ethernet max payloads: how many IPv4 fragments will be needed to transfer...

  1. Assuming standard 1500 byte Ethernet max payloads: how many IPv4 fragments will be needed to transfer 2000 bytes of user data with a single UDP send? And, how do the 2000 bytes get split over the frags?
  2. Despite its conceptual elegance, RPC (Remote Procedure Call) has a few problems. Discuss any 3 of those in brief.
  3. Why is timestamping needed in real-time applications? This is in the context of Real-time Transport Protocol (RTP).
  4. Why does UDP exist? Would it not have been enough to just let user processes send raw IP packets?
  5. Explain how QUIC eliminates a couple of RTTs usually needed at the start of a secure web connection.

In: Computer Science

I'm looking for a program, written in vPython, that simulates the movement of a spherical mass,...

I'm looking for a program, written in vPython, that simulates the movement of a spherical mass, suspended from a ceiling, tied to a spring. We are supposed to take the gravitaional force into account but are allowed to ignore the effects of air-resistance (for now).

I am a newbie at vPython so comments within the program to explain what certain parts of the code do would be appreciated!

In: Computer Science

An increasing-order integer array may contain duplicate elements. Write a Java method that does a binary...

An increasing-order integer array may contain duplicate elements. Write a Java method that does a binary search through the array for finding a specific target and return an array of two integer indices that specifies the close interval of indices at which the target is found or null if the target is not present. Use this test driver to test

public class MultBS

{

int [] multBinarySearch(int [] x, int target)

{

// your codes go here

}

public static void main(String [] args)

{ int [] x = new int[]{2,3,3,4,4,4,5,6,7,7,7};

int [] range = multBinarySearch(x, 3);

System.out.println("Target was found from position " + range[0] + " to " + range[1]);

}

}

test your program to make sure you see

the printout is

"Target was found from position 1 to 2"

In: Computer Science

I have the following code: //Set.java import java.util.ArrayList; public class Set<T> { //data fields private ArrayList<T>...

I have the following code:

//Set.java

import java.util.ArrayList;

public class Set<T> {
    //data fields
    private ArrayList<T> myList;
    // constructors
    Set(){
        myList = new ArrayList<T>();
    }
    // other methods
    public void add(T item){
        if(!membership(item))
            myList.add(item);
    }

    public void remove(T item){
        if(membership(item))
            myList.remove(item);
    }

    public Boolean membership(T item){
        for (T t : myList)
            if (t.equals(item))
                return true;
        return false;
    }

    public String toString(){
        StringBuilder str = new StringBuilder("[ ");

        for(int i = 0; i < myList.size() - 1; i++)
            str.append(myList.get(i).toString()).append(", ");

        if(myList.size() > 0)
            str.append(myList.get(myList.size() - 1).toString());

        str.append(" ]");

        return str.toString();
    }

}

(20 points) Fill the following table with the big-O running times of each of the methods implemented, as well as the running times for the same methods if they were implemented with LinkedList instead. (No need to explain here, only the big-O expression.)

Array List Linked List
add
remove
membership
toString

(20 points) Explain each of the eight running times in the table applying the rules of counting seen in class, and for the method calls, if 4 we have covered them already, directly refer to the running times of those methods. (Partial credit if you do not explain all eight. No points for ambiguous explanations. For instance, if you implement add in the class Set using addFirst in the class ArrayList, then you should say something like the following. “The add method of Set is implemented with just one method call to addFirst of ArrayList. addFirst of ArrayList is in O(n) in the worst case. Hence, the same bound on the running time applies to add”. )

In: Computer Science

Suppose a function receives a pointer as an argument. Explain how this function is declared within...

Suppose a function receives a pointer as an argument. Explain how this function is declared within its calling function. In particular, explain how the data type of the pointer argument is represented. C++

In: Computer Science

What are the application and uses of Telemedicine?

What are the application and uses of Telemedicine?

In: Computer Science

please give complete code in python using def function thank you! Validate Credit Card Numbers Credit...

please give complete code in python using def function thank you!

Validate Credit Card Numbers

Credit card numbers can be quickly validated by the Luhn checksum algorithm.

  1. Start at the rightmost digit save one (the last being the checksum digit). Moving left, double the value of every second digit. If the doubled value is greater than nine, then subtract 9 from the doubled value to renormalize within the range 0–9.
  2. Sum all the digits including the checksum digit.
  3. If this total modulo 10 is zero, the number is valid.

For instance, Ned Flander's credit card number is 8525.4941.2525.4158.

  1. Here are the digits with checksum underlined:

    8525494125254158_

  2. Here are the digits doubled back:

    16 5 4 5 8 9 8 1 4 5 4 5 8 1 10 8_

    Here are the two-digit results subtracted nine:

    7 5 4 5 8 9 8 1 4 5 4 5 8 1 1 8_

  3. Here is the sum:

    7+5+4+5+8+9+8+1+4+5+4+5+8+1+1+8=83

  4. Here is the modulo 10 result: 83%10=3 and this is not a valid credit card number.

Compose a function luhn which correctly validates a given candidate 16-digit credit-card number (as a numeric input in int).

In: Computer Science

hi! I have this code. when I run it, it works but in the print(the number...

hi! I have this code. when I run it, it works but in the print(the number we are searching for is ) it prints the number twice. ex. for 5 it prints 55 etc. apart from this, it works

#include <stdio.h>
#include <stdlib.h>
#include <time.h>

int main(){
int n,i;
printf("Give me the size of the table : \n");
scanf("%d", &n);
int A[n],x,y;

for (i=0;i<n;i++)
A[i]=rand() % n;

for (i=0;i<n;i++)
printf("%d\n", A[i]);

srand(time(NULL));
y=rand()% n ;

printf("The number we are searching for is %d", y);

for (i=0;i<n;i++)
{
    if (A[i]==y)
    {
      printf("%d is present at location %d.\n", y,i+1);
      break;
    }
}
if (i == n)
    printf("%d isn't present in the array.\n", y);

return 0;
}

In: Computer Science

Consider the following variable declarations hours = 40; status= True; overtime = False What is the...

  1. Consider the following variable declarations

hours = 40;

status= True;

overtime = False

What is the value of each of the following Boolean expressions?       [4 marks]

  1. status and !status
  2. status or  !status
  3. overtime == (hours >= 40)
  4. False == hours > 40

In: Computer Science

Rewrite the following Matlab code so it does the same thing but with complete new variable...

Rewrite the following Matlab code so it does the same thing but with complete new variable names and structure.


function stump = stumpGenerator(dataX, dataY, Dt)
intervals = 100;

rangex1 = max(dataX(:,1)) - min(dataX(:,1));
rangex2 = max(dataX(:,2)) - min(dataX(:,2));

width = (rangex1/intervals);
height = (rangex2/intervals);

starterx1 = min(dataX(:,1)) - (width/2);
starterx2 = min(dataX(:,2)) - (height/2);

currepsilon = inf;

stump = [0,0,0,1,0,0];

for i = 1:(intervals + 1)
  
horzRightError = sum(Dt(find(((dataX(:,1) - starterx1) .* dataY) < 0)));
horzLeftError = sum(Dt(find(((dataX(:,1) - starterx1) .* dataY) > 0)));
vertUpError = sum(Dt(find(((dataX(:,2) - starterx2) .* dataY) < 0)));
vertDownError = sum(Dt(find(((dataX(:,2) - starterx2) .* dataY) > 0)));
  
if (horzRightError <= horzLeftError)
horzError = horzRightError;
else
horzError = -horzLeftError;
end
  
if (vertUpError <= vertDownError)
vertError = vertUpError;
else
vertError = -vertDownError;
end
  
  
if (abs(horzError) <= abs(vertError))
if (currepsilon > abs(horzError))
currepsilon = abs(horzError);
stump(1) = 1;
stump(2) = 0;
stump(3) = starterx1;
stump(4) = horzError/(abs(horzError));
stump(5) = (log((1 - currepsilon)/currepsilon))/2;
stump(6) = currepsilon;
else
% do nothing, we already have the best stump
end
  
else
if (currepsilon > abs(vertError))
currepsilon = abs(vertError);
stump(1) = 0;
stump(2) = 1;
stump(3) = starterx2;
stump(4) = vertError/(abs(vertError));
stump(5) = (log((1/currepsilon) - 1))/2;
stump(6) = currepsilon;
else
% do nothing, we already have the best stump
end
end

starterx1 = starterx1 + width;
starterx2 = starterx2 + height;
end

end

In: Computer Science

Are the following languages regular languages or not ? Justify your answer with a proof. ?...

Are the following languages regular languages or not ? Justify your answer with a proof.

  1. ? = {? | ? represents an integer strictly greater than 2020}, on alphabet Σ = {0,…,9}.
  2. ? = {? | |?|a > |?|b} on alphabet Σ = {a,b}
  3. ? = {? | ? is the code of a LOOP program syntactically correct }
  4. ? = {02?| ? ∈ ℕ} sur alphabet Σ = {0}.

In: Computer Science

Write a C program that has a local and a global variable. The program uses a...

Write a C program that has a local and a global variable. The program uses a fork to create a child process. The parent process modifies both variables to be 10 and 20 and prints out the values. Then the child process modifies both variables to be 100 and 200 and prints out the values?
Explain the program output?

In: Computer Science

Discuss cabling and what you would use for a smaller Mom and Pop type business. Define...

Discuss cabling and what you would use for a smaller Mom and Pop type business. Define the business and how you would set up a network and what hardware and connection mechanisms need to be in place. How many computers would be needed? What other information do you need? (employees, locations, size, etc.)

In: Computer Science

What are the benefits and disadvantages of each of the following? Consider both the system level...

What are the benefits and disadvantages of each of the following? Consider both the system level and programmer level.

  1. Blocking send and non-blocking send in IPC
  2. Blocking receive and non-blocking receive in IPC
  3. zero-capacity and bounded capacity in IPC buffers

In: Computer Science

Write a python source code for a Unit class corresponding to the UML model of a...

Write a python source code for a Unit class corresponding to the UML model of a Unit shown. The description method should return a string value corresponding to the attributes of a Movie.

Unit

-code: String

-name: String

-credit points: int

+ __init__ (self, code, name, credit_points)

+ description (): String

In: Computer Science