I think it’s a
if it isn’t a then it’s d
Answer:
Motivation? The search problem.
Sorting algorithms: insertion sort, shellsort, heapsort, mergesort, quicksort, bubblesort
At the very least, "general purpose" sorting algorithms require O(n log n) comparisons
Explanation:
Answer:
// code in C++.
#include <bits/stdc++.h>
using namespace std;
// main function
int main()
{
// variables
int n;
cout<<"Enter a positive number:";
// read number
cin>>n;
// check number is positive or not
while(n<0)
{
// if number is negative
cout<<"Wrong input!!"<<endl;
// ask again to enter again
cout<<"Enter again:";
// read number again
cin>>n;
}
// generate random number between 1 to n
int ran=rand()%n +1;
// print random number
cout<<"Random number between 1 to "<<n<<" is: "<<ran<<endl;
return 0;
}
Explanation:
Read a number from user.Then if input number is negative then ask user to enter a positive number again.After this generate a random number between 1 to n.Print that random number.
Output:
Enter a positive number:-12
Wrong input!!
Enter again:9
Random number between 1 to 9 is: 2
Answer:
Check the explanation
Explanation:
kindly check the well written code below to get the solution to your question.
import json
def json_filter(input_string):
jsonFormat = json.loads(input_string)
result = []
for obj in jsonFormat:
if obj["temperature"] > 38.46:
result.append(obj)
return json.dumps(result)
Answer:
False: There are reasons to put comments in our code. We should have the habit of that.
Explanation:
- sometimes when we start to debug our program due to some error in execution, we don't recognize properly which code we have written for what purpose.
- if we distribute the code to others as a team, others get the intention of our code more clearly due to comments.
- The code can be reused taking it's sections to form an other program, where the comments has a vital role.