Answer:
Explanation:
The following code is written in Java and uses a for loop with a series of IF ELSE statements to check the next and previous characters in a string. Checking to make sure that there are no asterix. If so it adds that character to the String variable output. Which is returned to the user at the end of the method. Two test cases have been created and the output can be seen in the attached image below.
class Brainly {
public static void main(String[] args) {
System.out.println(starOut("sm*eilly"));
System.out.println(starOut("ab**cd"));
}
public static String starOut(String str) {
String output = "";
for (int i = 0; i < str.length(); i++) {
if ((i != 0) && (i != str.length()-1)) {
if ((str.charAt(i-1) != '*') && (str.charAt(i+1) != '*') && (str.charAt(i) != '*')) {
output += str.charAt(i);
}
} else {
if ((i == 0) && (str.charAt(i) != '*') && (str.charAt(i+1) != '*')) {
output += str.charAt(i);
} else if ((i == str.length()-1) && (str.charAt(i) != '*') && (str.charAt(i-1) != '*')) {
output += str.charAt(i);
}
}
}
return output;
}
}
Answer:
Explanation:
The following code is written in Java it goes through the queue that was passed as an argument, loops through it and removes all the odd numbers, leaving only the even numbers in the queue. It does not add any more data structures and finally returns the modified queue when its done.
public static Queue<Integer> evens(Queue<Integer> queue) {
int size = queue.size();
for(int x = 1; x < size+1; x++) {
if ((queue.peek() % 2) == 0) {
queue.add(queue.peek());
queue.remove();
} else queue.remove();
}
return queue;
}
Answer:
In ADT graph the efficiency of addVertex has efficiency O(logn).
Explanation:
The time complexity of the method addvertex in ADT graph is O(logn). addVertex method has time complexity of O(logn) because it has to divide the list in half and add the vertex according to the place where the needs to be added.
hence we conclude that the answer is O(logn).
Answer:
All these can be done using PKI.
Explanation:
PKI or the private key infrastructure is a new way to encrypt the data transfer or the retrieval along with the network among various terminals. The communication can be single node, hierarchical, bridge, mesh and hybrid. In the case of mesh, the connection can be established between each terminal. However, the connection can be established in between each pair via a network which can be a private network or it can be via the internet. However, the channel is required to be encrypted, or else the data can be hacked and attacks like a man in the middle attacks are quite on cards certainly. And this can be done using the PKI, which can be installed using the Certificate Authority and Public-private key pair generator. Suppose a connection is to be established between each node. And for this, you need to generate the certificate, which is generated by the Certificate Authority. And this is generally a third party like Godaddy, Verisign, etc. You can make use of the CSFFL as well. The free certificate authority Let’s Encrypt makes use of the CSFFL. And you must be using a web server as well like Apache that comes with services like OpenSSL that can be used to generate the certificate, and you can have your root Certificate Authority. That issues the certificate to the issuing certificate authority and the issuing certificate authority after registration confirmation by a person or a Robot, issues the certificate to the node which is requesting access to another node. And this certificate has the personal details of the requesting node and information about the webserver or node to which the requesting node is opting for a secure connection. The Certificate, when received by the webserver, is then matched with the certificate copy kept at the Root Certificate Authority. These days we also have the certificate revocation authority and Google has come up with Certificate transparency. So we can build our certificate authority, or we can have online certificate authority. These certificates also have the digital signature, which can be decrypted via the private key that is kept with the sender. The public key is sent to the certificate authority, and it decrypts it with the public key. And certificates are distributed among various types of trusts, which can be single, hierarchical, bridge, mesh and hybrid. And for each application, we have different certificates. Thus issues like non-repudiation, check over unauthorized access, restrict access to the resources, etc, can be ensured with the help of the PKI. And thus, we can secure the whole network at various levels like application level, transport-level, etc. Also, the company network can be bridged with the client or the business partner company if required using bridge level trust. However, we can also have a hierarchical level of trust. And thus we can secure the network using PKI and also confirm all the issues mentioned in the question are resolved. However, certificates are also being generated by Windows server 2012, and we can make use of it as well.