Algorithmic Performance as you are aware, consists (mainly) of 2 dimensions: Time and Space. From a technical perspective, discuss the following: Regarding runtime, discuss algorithmic performance with respect to its runtime performance. As you develop an algorithm, what must you also consider in terms of some of the trade-offs? How would you go about estimating the time required for an algorithm’s efficiency (i.e. time to complete in terms of its potential complexity)? What techniques can you use? Give an example of how to measure it.
In: Computer Science
In: Computer Science
List three possible defensive methods for password security.
In: Computer Science
What are the two modes of encryption that allow random access to the ciphertext blocks. Specifically, if a hacker has the information about i-th cyphertext block Ci and it can find the plaintext Pi without having any other cyphertext blocks.
In: Computer Science
Create a MIPS program that will "hard code an integer" (meaning declared in .data) and read in another integer, multiply them together, and print out the results.
In: Computer Science
Briefly argue why it is untrue to say that public-key encryption is more secure than conventional encryption.
In: Computer Science
C++ please
6.32 LAB: Exact change - functions
Write a program with total change amount as an integer input that outputs the change using the fewest coins, one coin type per line. The coin types are dollars, quarters, dimes, nickels, and pennies. Use singular and plural coin names as appropriate, like 1 penny vs. 2 pennies.
Ex: If the input is:
0
or less, the output is:
no change
Ex: If the input is:
45
the output is:
1 quarter 2 dimes
Your program must define and call the following function.
Positions 0-4 of coinVals should contain the number of dollars,
quarters, dimes, nickels, and pennies, respectively.
void ExactChange(int userTotal, vector<int>&
coinVals)
In: Computer Science
A subject is a resource to which access is controlled.
True
False
In: Computer Science
Discuss three challenges faced when auditing a cloud environment. (200-300 words)
In: Computer Science
Can you solve and send me the original code which I can copy and paste plz. Thank you.
Kahn's Algorithm
Implement Kahn's Algorithm for giving a topological ordering of a graph as discussed in class. The input graph will be in adjacency list format.
1. Count the in-degree (number of edges ending at) each vertex.
2. Create a queue of nodes with in-degree 0.
3. While the queue is not empty:
a. Add the first element in the queue to the ordering.
b. Decrement the in-degree of each of the first element’s neighbors.
c. Add any neighbors that now have in-degree 0 to the queue.
d. Remove the first element from the queue.
4. If the ordering doesn't contain all nodes then the graph had a cycle and we return None
5. Else we return the ordering
graph = [
[1, 3],
[],
[3, 6, 7],
[6],
[],
[],
[],
[5, 4],
]
order = topological(graph)
print(order)
[0, 2, 1, 3, 7, 6, 4, 5] # one POSSIBLE ordering
order.index(0) < order.index(3)
order.index(0) < order.index(1)
order.index(2) < order.index(3)
order.index(2) < order.index(6)
order.index(2) < order.index(5)
order.index(3) < order.index(6)
order.index(7) < order.index(5)
from collections import deque
#complete following code
def topological(graph):
in_deg = [0 for _ in range(len(graph))]
for node1 in range(len(graph)):
for node2 in graph[node1]:
in_deg[node2] += 1
queue = deque()
"""
Iterate over all the nodes and append the nodes with in-degree 0 to
the queue
"""
# your code here
ordereing = []
while len(queue) > 0:
current_node = queue.popleft()
ordereing.append(current_node)
for neighbor in graph[current_node]:
in_deg[neighbor] -= 1
"""
If this neighbor in-degree now becomes 0, we need to append it to
the queue
"""
# your code here
"""
If we couldn't process all nodes, this means there was a cycle in
the graph
and the graph wasn't a DAG.
"""
if len(ordereing) != len(graph):
return None
return ordereing
order.index(7) < order.index(4)
In: Computer Science
Write the following Python script:
Imagine you live in a world without modules in Python! No numpy! No scipy! Write a Python script that defines a function called mat_mult() that takes two lists of lists as parameters and, when possible, returns a list of lists representing the matrix product of the two inputs. Your function should make sure the lists are of the appropriate size first - if not, your program should print “Invalid sizes” and return None. Note: it is actually tricky to make a useful list of zeros. For instance, if you need to start with a 5 row, 6 column double list of 0, you might be tempted to try:
'''
thing = [ [ 0 ] ∗ 6 ] ∗ 5
'''
and if you look at it in the console window, it would appear to be a 5 by 6 list of lists containing all zeros! However - try the following and see what happens:
'''
thing [ 2 ] [ 5 ]
thing
'''
Notice that the item in index 5 of every row has changed, not just the row with index 2! Given the difficulty, I will give you the line of code that will create a list of lists that is num_rows by num_cols:
'''
ans = [ [ 0 for col in range ( num_cols ) ] for row in range ( num_rows ) ]
'''
In: Computer Science
(JAVA): The Collection ADT
1. We have a Circle class that includes radius attribute of type int, set by the constructor. Write a compareTo method for this class so that circle objects are ordered on the basis of their circumference (? = 2??).
2. We have a Person class that includes name and age attributes of type String and int respectively, both set by the constructor. Write a compareTo method for this class so that person objects are ordered on the basis of their name.
In: Computer Science
How many cost units are spent in the entire process of performing 40 consecutive append operations on an empty array which starts out at capacity 4, assuming that the array will double in capacity each time a new item is added to an already full dynamic array? As N (i.e., the number of appends) grows large, under this strategy for resizing, what is the average big-O complexity for an append?
How many cost units are spent in the entire process of performing 40 consecutive append operations on an empty array which starts out at capacity 4, assuming that the array will grow by a constant 2 spaces each time a new item is added to an already full dynamic array? As N (i.e., the number of appends) grows large, under this strategy for resizing, what is the average complexity for an append?
In: Computer Science
In this scenario, we have a poorly performing PC, and we suspect it might be a process that is causing issues. In our process of troubleshooting, we want to:
1, to view a list of all running processes to examine which ones are using the most RAM (Memory).
2, to view the list of all non-running processes (e.g. the status is suspended, not responding, or unknown).
3, to view all running processes under the user account, System. Not processes with the word, System, in the process name.
4, to stop all processes begin with the letter S.
In: Computer Science
Part 2- - Create and display a singly Linked List with 5 elements (see below)
Node* head
Node*second
Node*third
Node*forth
Node*fifth
2-Assign the data 5, 6, 8, 10, 12 to each node 3-Display the output
GIVEN CODE:
#include <studio.h>
struct Array { int A[10]; int size; int length; };
void Display(struct Array arr)
{
int i; printf("\nElements are\n");
for(i=0;ilengthsize) arr->A[arr->length++]=x;
}
void Insert(struct Array *arr,int index,int x)
{
int i;
if(index>=0 && index <=arr->length)
{
for(i=arr->length;i>index;i--)
arr->A[i]=arr->A[i-1]; arr->A[index]=x; arr->length++;
}
}
int main()
{
struct Array arr1={{2,3,4,5,6},10,5};
Append(&arr1,10);
Insert(&arr1,0,12);
Display(arr1);
return 0;
}
In: Computer Science