Answer:
def insSort(arr):
ct=0;
for i in range(1, len(arr)):
key = arr[i]
j = i-1
while j >=0 and key < arr[j] :
arr[j+1] = arr[j]
j -= 1
ct=ct+1;
arr[j+1] = key
return arr,ct;
print(insSort([2,1]))
Output of the program is also attached.
You want to use proper etiquette and be polite, do not call them by their first name and always refer to them as Mr., or Mrs. Use an extended vocabulary and do not talk about yourself. If you have proper grammar, depending on the job, that can be seen as intelligence. And always use an appropriate closing that is respectful. Such as, Sincerely, John Doe.
Answer:
a) the Statement is Invalid
b) the Statement is Invalid
Explanation:
a)
lets Consider, s: student of my class
A(x): Getting an A
Let b: john
I have a student in my class who is getting ab A: Зs, A(s)
John need not be the student i.e b ≠ s could be true
Hence ¬A(b) could be true and the given statement is invalid
b)
Lets Consider G: girl scout
C: selling 50 boxes of cookies
P: getting prize
s: Suzy
Now every girl scout who sells at least 50 boxes of cookies will get a prize: ∀x ∈ G, C(x) -> P(x)
Suzy, a girl scout, got a prize: s ∈ G, P(s)
since P(s) is true, C(s) need not be true
Main Reason: false → true is also true
Therefore the Statement is Invalid
Answer:
#include <iostream>
using namespace std;
struct StudentType{
string studentName;
int studentId;
}
int n;
char answer[20];
int main(){
cout<< "Enter the size of the array: ";
cin >> n;
StudentType *student = new StudentType(n);
for (int i = 0; i < n; i++){
int name;
int number;
cin>> name;
cin >> number;
student[i].studentName = name;
student[i].studentId = number;
}
for (int i = 0; i < 20; i++){
cout<< "Enter answers: ";
cin >> ans;
answer[i] = ans;
}
}
Explanation:
The C++ source code has three global variables namely, answer which is an array of character data type, StudentType which is a structure data type and the integer variable n. The main function declares and initializes the dynamic-spaced student array of the structure datatype with the n variable.