Answer:
Explanation:
A)
10 10 10 1 1
/ / \ --> / \ / \
12 12 1 12 10 12 10
/
14
1 1 1 1
/ \ / \ / \ / \
12 10 --> 6 10 6 10 --> 6 5
/ \ / \ / \ / / \ /
14 6 14 12 14 12 5 14 12 10
1 1 1 1
/ \ / \ / \ / \
6 5 6 5 6 5 --> 3 5
/ \ / \ / \ / \ / \ / \ / \ / \
14 12 10 8 14 12 10 8 14 12 10 8 6 12 10 8
/ / \ / \
15 15 3 15 14
After inserting all 1
/ \
3 2
/ \ / \
6 7 5 4
/ \ / \ / \ / \
15 14 12 9 10 11 13 8
b)
First level build : 10
/ \
12 1
/ \ / \
14 6 5 8
/ \ / \ / \ / \
15 3 9 7 4 11 13 2
Heap bottom level: 10
/ \
12 1
/ \ / \
3 6 4 2
/ \ / \ / \ / \
15 14 9 7 5 11 13 8
Heap next level up: 10
/ \
3 1
/ \ / \
12 6 4 2
/ \ / \ / \ / \
15 14 9 7 5 11 13 8
Final heap: 1
/ \
3 2
/ \ / \
12 6 4 8
/ \ / \ / \ / \
15 14 9 7 5 11 13 10
c)
Duing the first time,
First, assume the last element, the 8, is at the root and bubble down.
Then, assume the last element, the 13, is at the root and bubble down.
Then, assume the last element, the 11, is at the root and bubble down.
Final heap:
4
/ \
6 5
/ \ / \
13 7 10 8
/ \ / \ /
15 14 12 9 11
In the next iteration,
First, assume the last element, the 10, is at the root and bubble down.
Then, assume the last element, the 13, is at the root and bubble down.
Then, asssume the last element, the 11, is at the root and bubble down.
So, after performing all operations, the heap looks like below:
4
/ \
6 5
/ \ / \
12 7 10 8
/ \ / \ /
15 14 9 13 11
A technician is configuring the static TCP/IP settings on a client computer.
Which of the following configurations are needed for internet communications?
a. DHCP server address
b. DNS server address
c. Default gateway address
d. WINS address
e. APIPA address
f. Alternate IP address
g. IP address including a subnet mask (IPv4) or subnet prefix length (IPv6)
Answer:
The answer is below
Explanation:
Considering the situation and the available options above, the following configurations are needed for internet communications:
B. DNS server address: this matches the domain name to the IP address of a website such that browsers can bring internet resources.
C. Default gateway address: this uses the internet protocol suites and serves as a router to other networks in the absence of other route specifications that could match the destination IP address of a packet.
G. IP address including a subnet mask (IPv4) or subnet prefix length (IPv6): this is used by the internet-connected device to receive messages.
Draw a Card. Write a program to simulate drawing a card. Your program will randomly select one card from a deck of 52 playing cards. Your program should display the rank (Ace, 2, 3, 4, 5, 6, 7, 8, 9, 10, Jack, Queen, King) and suit (Clubs, Diamonds, Hearts, Spades) of the card. Here is a sample run of the program: in The card you picked is Jack of Heart The program should use at a minimum: sequence, selection, arrays, and random numbers.
Answer:
Explanation:
The following code is written in Java. It is a function that creates a Random object to generate random values, then uses those values to choose a random rank and suit using switch statements. It then saves the rank and suit into a String variable in the correct format and finally prints the card that was picked to the screen. The function was called 4 times in the main method and the output can be seen in the attached image below.
public static void randomCardGenerator() {
Random rand = new Random();
int rank = rand.nextInt(14)+1;
int suit = rand.nextInt(4)+1;
String chosenCard = "";
switch (rank) {
case 1: chosenCard += "Ace"; break;
case 2: chosenCard += "1"; break;
case 3: chosenCard += "2"; break;
case 4: chosenCard += "3"; break;
case 5: chosenCard += "4"; break;
case 6: chosenCard += "5"; break;
case 7: chosenCard += "6"; break;
case 8: chosenCard += "7"; break;
case 9: chosenCard += "8"; break;
case 10: chosenCard += "9"; break;
case 11: chosenCard += "10"; break;
case 12: chosenCard += "Jack"; break;
case 13: chosenCard += "Queen"; break;
case 14: chosenCard += "Kind"; break;
default: System.out.println("Wrong Value");
}
chosenCard += " of ";
switch (suit) {
case 1: chosenCard += "Clubs"; break;
case 2: chosenCard += "Diamonds"; break;
case 3: chosenCard += "Hearts"; break;
case 4: chosenCard += "Spades"; break;
default: System.out.println("Invalid Suit");
}
System.out.println(chosenCard);
}
How can I pass the variable argument list passed to one function to another function.
Answer:
Explanation:
#include <stdarg.h>
main()
{
display("Hello", 4, 12, 13, 14, 44);
}
display(char *s,...)
{
va_list ptr;
va_start(ptr, s);
show(s,ptr);
}
show(char *t, va_list ptr1)
{
int a, n, i;
a=va_arg(ptr1, int);
for(i=0; i<a; i++)
{
n=va_arg(ptr1, int);
printf("\n%d", n);
}
}
Write a program that uses a stack to test input strings to determine whether they are palindromes. A palindrome is a sequence of characters that reads the same as the sequence in reverse; for example, noon.
Answer:
Here the code is given as follows,
Explanation:
def isPalindrome(x):
stack = []
#for strings with even length
if len(x)%2==0:
for i in range(0,len(x)):
if i<int(len(x)/2):
stack.append(x[i])
elif stack.pop()!=x[i]:
return False
if len(stack)>0:
return false
return True
#for strings with odd length
else:
for i in range(0,len(x)):
if i==int(len(x)/2):
continue
elif i<int(len(x)/2):
stack.append(x[i])
elif stack.pop()!=x[i]:
return False
if len(stack)>0:
return false
return True
def main():
while True:
string = input("Enter a string or Return to quit: ")
if string == "":
break
elif isPalindrome(string):
print("It's a palindrome")
else:
print("It's not a palindrome")
if __name__ == '__main__':
main()
___________ colors come forward and command attention. ______________ colors recede away from our eyes and tend to fall into the background of a design.
Answer:
"Warm; Cool/receding" is the correct answer.
Explanation:
The color temperature would be referred to as summer and winter upon that color wheel, the hottest becoming red/orange as well as the most cooler always being bluish or greenish.A terminology to define the warmth of the color is termed as Warm colors. Warm hues are prominent as well as lively just like reds, oranges, etc.Thus the above is the right answer.
what is the meaning of compiler
Answer:
in computing it means a program that converts instructions into a machine-code or lower-level form so that they can be read and executed by a computer.
Resize vector countDown to have newSize elements. Populate the vector with integers {newSize, newSize - 1, ..., 1}. Ex: If newSize = 3, then countDown = {3, 2, 1}, and the sample program outputs:
#include
#include
using namespace std;
int main() {
vector countDown(0);
int newSize = 0;
int i = 0;
newSize = 3;
STUDENT CODE
for (i = 0; i < newSize; ++i) {
cout << countDown.at(i) << " ";
}
cout << "Go!" << endl;
return 0;
}
Answer:
Following are the code to the given question:
#include <iostream>//defining header file
#include <vector>//defining header file
#include <numeric>//defining header file
using namespace std;
int main()//main method
{
vector<int> countDown(0);//defing an integer array variable countDown
int newSize = 0;//defing an integer variable newSize that holds a value 0
int i = 0;//defing an integer variable i that initialize with 0
newSize = 3;// //use newSize to hold a value
countDown.resize(newSize,0);// calling the resize method that accepts two parameters
for (i = 0; i < newSize; ++i)//defining a loop that reverse the integer value
{
countDown[i] = newSize -i;//reverse the value and store it into countDown array
cout << countDown.at(i) << " ";//print reverse array value
}
cout << "Go!" << endl;//print message
return 0;
}
Output:
3 2 1 Go!
Explanation:
In the given code inside the main method an integer array "countDown" and two integer variables "newSize and i" is declared that initializes a value that is 0.
In the next step, an array is used that calls the resize method that accepts two parameters, and define a for a loop.
In this loop, the array is used to reverse the value and print its value with the message.
The computer that is used in scientific research is ........
Answer:
supercomputers are the computer that is used in scientific research.
Answer:
super computer is the right answer
In this technique, each attribute is associated with a specific feature of a face, and the attribute value is used to determinethe way a facial feature is expressed. This technique is called._______________
Answer:
Chernoff faces.
Explanation:
Chernoff faces is a data visualization technique that was developed by a statistician named Herman Chernoff. He introduced this data visualization technique to the world in 1973 to represent multivariate or multidimensional data containing at least eighteen (18) variables.
In Chernoff faces, each attribute is associated with a specific feature of a face (nose, eyes, ears, hair, mouth, and eyebrows), and the attribute value with respect to size, shape, orientation, colour and placement is used to determine the way a facial feature is expressed.
The Chernoff face is a technique designed and developed to help detect similarities between different items and discern subtle changes in facial expressions from the perspective of an observer.
Given the code as follows: main() { int i = 3, n; float x; x = i; n = 8 % x; } What problem will occur? Group of answer choices A compilation error will occur. A run time error will occur. An inheritance error will occur. No problem will occur at all.
Answer:
A compilation error will occur.
Explanation:
The % operator does not accept a float as its right-hand operand.
Computer data that is suitable for text
Answer:
Answer:Data Types. Computer systems work with different types of digital data. In the early days of computing, data consisted primarily of text and ...
How did the military in the early 1900s move resources?
engines.
In the early 1900s, military moved their resources to distant locations with the help of
Answer:
In the early 1900s, military moved their resources to distant locations with the help of trains, ships, and, to a lesser extent, horse-drawn wagons. This was so because at that time airplanes did not yet exist, capable of transporting inputs to any part of the world in a very short period of time. Therefore, inputs and resources were brought by sea and, if impossible, through land, using railways or highways.
Type the correct answer in the box. Use numerals instead of words. If necessary, use / for the fraction bar.
PH
var num2 = 32;
var num1 = 12;
var rem=num2 % numi;
while(rem > 0)
{
num2 = num1;
num1 = rem;
rem = num2 % num1;
}
document.write(num1);
The output of the document.write statement at the end of this block is
Answer:
4
Explanation:
Given
The attached code segment
Required
The output
The first and second lines initialize num2 to 32 and num1 to 12, respectively.
Next, the remainder is calculated on line 3
[tex]rem = 32\%12[/tex]
[tex]rem = 8[/tex]
Then the while loop is repeated as long as rem > 0.
At first, we have:
[tex]num2 = 32[/tex]
[tex]num1 = 12[/tex]
[tex]rem = 8[/tex]
The first iteration gives:
[tex]num2 = 12[/tex]
[tex]num1 = 8[/tex]
[tex]rem = 12\%8 = 4[/tex]
Is 4 > 0? Yes; The loop is executed again.
This gives:
[tex]num2 = 8[/tex]
[tex]num1 = 4[/tex]
[tex]rem = 8\%4=0[/tex]
Is 0 > 0? No; The loop is executed
The last statement prints the last value of num1;
In the last loop, we have:
[tex]num1 = 4[/tex]
Hence, the output is 4
Answer:
Below is correct, the answer is 4.
Explanation:
PLATO
Difference between analog and hybrid computer in tabular form
Answer:
Analog computers are faster than digital. Analog computers lack memory whereas digital computers store information. ... It has the speed of analog computer and the memory and accuracy of digital computer. Hybrid computers are used mainly in specialized applications where both kinds of data need to be process.
hope it is helpful for you
Please use thread to complete the following program: one process opens a file data.txt, then creates a thread my_thread. The job of the thread my_thread is to count how many lines exist in the file data.txt, and return the number of lines to the calling process. The process then prints this number to the screen.
Basically, you need to implement main_process.c and thread_function.c.
Basic structure of main_process.c:
int main ()
{
Open the file data.txt and obtain the file handler fh;
Create a thread my_thread using pthread_create; pass fh to my_thread;
Wait until my_thread terminates, using pthread_join;
Print out how many lines exist in data.txt.}
Basic structure of thread_function.c:
void *count_lines(void *arg)
{
Obtain fh from arg;
Count how many lines num_lines exist in fh;
Close fh;
Return num_lines
}
Answer:
Here is the code:-
//include the required header files
#include<stdio.h>
#include<pthread.h>
// method protocol definition
void *count_lines(void *arg);
int main()
{
// Create a thread handler
pthread_t my_thread;
// Create a file handler
FILE *fh;
// declare the variable
int *linecnt;
// open the data file
fh=fopen("data.txt","r");
// Create a thread using pthread_create; pass fh to my_thread;
pthread_create(&my_thread, NULL, count_lines, (void*)fh);
//Use pthread_join to terminate the thread my_thread
pthread_join( my_thread, (void**)&linecnt );
// print the number of lines
printf("\nNumber of lines in the given file: %d \n\n", linecnt);
return (0);
}
// Method to count the number of lines
void *count_lines(void *arg)
{
// variable declaration and initialization
int linecnt=-1;
char TTline[1600];
//code to count the number of lines
while(!feof(arg))
{
fgets(TTline,1600,arg);
linecnt++;
}
pthread_exit((void *)linecnt);
// close the file handler
fclose(arg);
}
Explanation:
Program:-
The valid call to the function installApplication is
void main( )
{
// call the function installApplication
}
void installApplication(char appInitial, int appVersion)
{
// rest of function not important
}
Answer:
B. installApplication(‘A’, 1);
Explanation:
Given
The above code segment
Required
The correct call to installApplication
The function installApplication is declared as void, meaning that it is not expected to return anything.
Also, it receives a character and an integer argument.
So, the call to this function must include a character and an integer argument, in that order.
Option D is incorrect because both arguments are integer
Option C is incorrect because it passes no argument to the function.
Option A is incorrect because it receives an integer value from the function (and the function is not meant not to have a return value).
Option B is correct
Write a recursive function that calculates the sum 11 22 33 ... nn, given an integer value of nin between 1 and 9. You can write a separate power function in this process and call that power function as needed:
Answer:
The function in Python is as follows:
def sumDig(n):
if n == 1:
return 11
else:
return n*11 + sumDig(n - 1)
Explanation:
This defines the function
def sumDig(n):
This represents the base case (where n = 1)
if n == 1:
The function returns 11, when it gets to the base case
return 11
For every other value of n (n > 1)
else:
This calculates the required sum recursively
return n*11 + sumDig(n - 1)
Explain why interrupt times and dispatch delays must be limited to a hard real-time system?
Answer:
The important problem is explained in the next section of clarification.
Explanation:
The longer it is required for a computing device interrupt to have been performed when it is created, is determined as Interrupt latency.
The accompanying duties include interrupt transmission delay or latency are provided below:
Store the instructions now being executed.Detect the kind of interruption.Just save the present process status as well as activate an appropriate keep interrupting qualitative functions.How would you type the word floor
Answer:
f l o o r
Explanation:
Which statement describes data-sharing in a blockchain?
Answer:
wheres the statement
Explanation:
Create a function called GetColors that will accept two parameters. These parameters can only be red, blue or yellow. Your function needs to analyze these two colors and determine the color mix. Make sure your function returns the color mix back to where it was called.
Answer:
Explanation:
The following code is written in Java. It creates a GetColors method that takes in the two parameter colors of either red, blue or yellow. It combines those colors and returns the mix of the two colors back to the user. A test case has been used in the main method and the output can be seen in the attached image below.
import java.util.Scanner;
class Brainly {
public static void main(String[] args) {
System.out.println(GetColors("yellow", "red"));
}
public static String GetColors(String color1, String color2) {
if (color1 == "red") {
if (color2 == "blue") {return "purple";}
else if (color2 == "yellow") {return "orange";}
else {return "red";}
} else if (color1 == "blue") {
if (color2 == "red") {return "purple";}
else if (color2 == "yellow") {return "green";}
else {return "blue";}
} else if (color1 == "yellow") {
if (color2 == "red") {return "orange";}
else if (color2 == "blue") {return "green";}
else {return "yellow";}
} else {
return "Wrong Parameters";
}
}
}
What does 32mb SVGA do
Answer:
hope it helps PLZ MARK ME BRAINLIEST,,!
Explanation:
They stabilize your grpahic image.
What are the LinkedIn automation tools you are using?
Answer:
Well, for me I personally use LinkedCamap to drive more LinkedIn connections, hundreds of leads, sales, and conversions automatically.
Some other LinkedIn automation tools are;
ExpandiMeet AlfredPhantombusterWeConnectLinkedIn HelperHope this helps!
9.18 LAB: Exact change - methods 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:
Answer:
Explanation:
The following code is written in Java. It asks the user to enter the amount of change needed. This is done as a double since we are dealing with coins and not full dollar values alone. It then makes the necessary calculations to calculate the number of each coin needed and outputs it back to the user. A test case has been provided in the picture below with a sample output.
import java.util.Scanner;
class Brainly {
public static void main(String[] args) {
int dollars = 1;
double quarters = 0.25;
double dimes = 0.10;
double nickels = 0.05;
double pennies = 0.01;
Scanner in = new Scanner(System.in);
System.out.println("Enter Change Value: ");
double change = in.nextDouble();
int numDollars, numQuarters, numDimes, numNickels, numPennies;
double newChange;
numDollars = (int) (change / dollars);
newChange = change % dollars;
numQuarters = (int) (newChange / quarters);
newChange = newChange % quarters;
numDimes = (int) (newChange / dimes);
newChange = newChange % dimes;
numNickels = (int) (newChange / nickels);
newChange = newChange % nickels + 0.001;
numPennies = (int) (newChange / pennies);
newChange = newChange % pennies;
System.out.println("Minimum Num of Coins needed: ");
if (numDollars != 1) {
System.out.println(numDollars + " Dollars");
} else {
System.out.println(numDollars + " Dollar");
}
if (numQuarters != 1) {
System.out.println(numQuarters + " Quarters");
} else {
System.out.println(numQuarters + " Quarter");
}
if (numDimes != 1) {
System.out.println(numDimes + " Dimes");
} else {
System.out.println(numDimes + " Dime");
}
if (numNickels != 1) {
System.out.println(numNickels + " Nickels");
} else {
System.out.println(numNickels + " Nickel");
}
if (numPennies != 1) {
System.out.println(numPennies + " Pennies");
} else {
System.out.println(numPennies + " Penny");
}
}
}
The program is an illustration of conditional statements
Conditional statements are used to make decisions
The program in C++ where comments are used to explain each line is as follows
#include<iostream>
using namespace std;
int main() {
// This line declare all the variables
int amount, dollar, quarter, dime, nickel, penny;
// This prompts the user for input (i.e. the amount)
cout<<"Amount: ";
//This gets the amount from the user
cin>>amount;
// This checks if the amount is 0 or less
if(amount<=0) {
//This prints "No Change"
cout<<"No Change";
}
//If the amount is greater than 0
else {
// These convert the amount to various coins
dollar = amount/100;
amount = amount%100;
quarter = amount/25;
amount = amount%25;
dime = amount/10;
amount = amount%10;
nickel = amount/5;
penny = amount%5;
// The next lines print the coins
if(dollar>=1) {
if(dollar == 1) {
cout<<dollar<<" dollar\n"; }
else {
cout<<dollar<<" dollars\n"; }
}
if(quarter>=1) {
if(quarter== 1) {
cout<<quarter<<" quarter\n";
}
else {
cout<<quarter<<" quarters\n";
}
}
if(dime>=1) {
if(dime == 1) {
cout<<dime<<" dime\n";
}
else {
cout<<dime<<" dimes\n";
}
}
if(nickel>=1) {
if(nickel == 1) {
cout<<nickel<<" nickel\n";
}
else {
cout<<nickel<<" nickels\n";
}
}
if(penny>=1) {
if(penny == 1) {
cout<<penny<<" penny\n";
}
else {
cout<<penny<<" pennies\n";
}
}
}
return 0;
}
Read more about conditions at:
https://brainly.com/question/15683939
We have removed
A
balls from a box that contained
N
balls and then put
B
new balls into that box. How many balls does the box contain now?
Constraints
All values in input are integers.
Input
Input is given from Standard Input in the following format: n a b
Output
Print the answer as an integer.
There were [tex]N[/tex] balls but we took [tex]A[/tex] balls out, so there are now [tex]N-A[/tex] balls. We add [tex]B[/tex] balls and now we have [tex]N-A+B[/tex] balls.
The program that computes this (I will use python as language has not been specified is the following):
n, a, b = int(input()), int(input()), int(input())
print(f"There are {n-a+b} balls in the box")
# Hope this helps
This standard library function returns a random floating-point number in the range of 0.0 up to 1.0 (but not including 1.0).
a. random.b. randint.c. random_integer.d. uniform.
Answer:
The answer would be A: Random
Explanation:
The random() function returns a generated random number (a pseudorandom number)
how many copies of each static variable and each class variable are created when 10 instances of the same class are created
Answer:
Static variables are initialized only once
Explanation:
Only one copy of static variables are created when 10 objects are created of a class
A static variable is common to all instances of a class because it is a class level variable
Fill in multiple blanks for [x], [y], [z]. Consider a given TCP connection between host A and host B. Host B has received all from A all bytes up to and including byte number 2000. Suppose host A then sends three segments to host B back-to-back. The first, second and third segments contain 50, 600 and 100 bytes of user data respectively. In the first segment, the sequence number is 2001, the source port number is 80, and the destination port number is 12000. If the first segment, then third segment, then second segment arrive at host B in that order, consider the acknowledgment sent by B in response to receiving the third segment. What is the acknowledgement number [x], source port number [y] and destination port number [z] of that acknowledgement
Write a class called Student that has two private data members - the student's name and grade. It should have an init method that takes two values and uses them to initialize the data members. It should have a get_grade method.
Answer:
Explanation:
The following class is written in Python as it is the language that uses the init method. The class contains all of the data members as requested as well as the init and get_grade method. It also contains a setter method for both data variables and a get_name method as well. The code can also be seen in the attached image below.
class Student:
_name = ""
_grade = ""
def __init__(self, name, grade):
self._name = name
self._grade = grade
def set_name(self, name):
self._name = name
def set_grade(self, grade):
self._grade = grade
def get_name(self):
return self._name
def get_grade(self):
return self._grade
Your organization has started receiving phishing emails. You suspect that an attacker is attempting to find an employee workstation they can compromise. You know that a workstation can be used as a pivot point to gain access to more sensitive systems. Which of the following is the most important aspect of maintaining network security against this type of attack?
A. Network segmentation.B. Identifying a network baseline.C. Documenting all network assets in your organization.D. Identifying inherent vulnerabilities.E. User education and training.
Answer:
E). User education and training.
Explanation:
In the context of network security, the most significant aspect of ensuring security from workstation cyberattacks would be 'education, as well as, training of the users.' If the employee users are educated well regarding the probable threats and attacks along with the necessary safety measures to be adopted and trained adequately to use the system appropriately so that the sensitive information cannot be leaked while working on the workstation and no networks could be compromised. Thus, option E is the correct answer.