Answer:
Answer explained below
Explanation:
void bubbleSort(int X[], int Y[], int n)
{
int i, j;
for (i = 0; i < n-1; i++)
// Last i elements are already in place
for (j = 0; j < n-i-1; j++)
if (X[j] > X[j+1])
{
swap(X[j],X[j+1])
swap(Y[j],Y[j+1]);
}
if (X[j] == X[j+1]&&Y[j]<Y[j+1])
{
swap(X[j],X[j+1])
swap(Y[j],Y[j+1]);
}
}
Since the above algorithm contains 2 nested loops over n.
So, it is O(n^2)
Answer:
# user is prompted to enter the value of n
n = int(input("Enter your number: "))
# if statement to check if n > 0
if (n > 0):
# for-loop to loop through the value of n
for digit in range(1, (n+1)):
# if digit is odd, print 1
if((digit % 2) == 1):
print("1", end=" ")
# else if digit is even print 0
else:
print("0", end=" ")
Explanation:
The code is written in Python and is well commented.
A sample output of the code execution is attached.
Answer:
It will use the text in the ALT tag.
by the IP address of the computer
a computer is located by the IP address
Option D is the correct answer
nmap -O
Explanation:
- DMZ means a demilitarized zone it will have more than 1 firewall to protect the server.
- Nmap is the 1st step of ethical hacking in penetration testing for detecting the required detail from the server.
- Nmap is used to scan the network and detect the host.
- Nmap scanning can also be used to receive packets from the server without the trace of the client.
- Nmap -O is used to detect the OS of the server and its version also.