Need help with example 7, written in c++. Please and thank you
Q: If foo is an abstract class in a C++ program, why is it acceptable to declare variables of type…
A: If foo is an abstract class in a C++ program, it is acceptable to declare variables of type foo*,…
Q: In C programming, how do you run Crud?
A: According to the information given:- We have to define C programming, how do you run Crud.
Q: Question 3: Rewrite the program in Question 2 part a in Java and C#, run them, and compare the…
A: Given: Rewrite the program in Question 2 part a in java and c#, run them and compare the results.
Q: Write an interesting program in c++ to illustrate the use of self referential class. Please write…
A: Sample Response: //C++ program to add and prints nodes in the linked list by using self-referential…
Q: Please show an example of how or how to to solve coding the problem from Starting out with Java…
A: algorithms require two important control structures: iteration and selection.
Q: Rewrite the program in Question 2 "the picture" in Java and C#, run them, and compare the results
A: The operator precedence is as follows: /, % , * is greater then + , - Example: 1 * 2 + 3 -4 1. LEFT…
Q: When we are talking about c++ and our code, what does portability mean? Please explain in detail…
A: Portability in C++ Portability of programming language is the ability to run the code written in the…
Q: Q2 \ write program in C# language to read employee information (Name, Salary, Graduation, Age) and…
A: Note: As per the policy we can answer a question at a time. Please repost the other question to get…
Q: By using suitable example, explain how a class can be declared in the C++ language
A: We can create a class, by using the class keyword. And inside the class Attributes( variables ) and…
Q: Encapsulation is one of the most significant aspects of OOP. What style of C++ implementation does…
A: Encapsulation is enforced by a class because encapsulation refers to the wrapping of data and…
Q: What does portability imply when we're discussing C++ and our code? Kindly elaborate.
A: Portable code generally means that the code will integrate and work well in any number of forums and…
Q: esearch on the following C++subject areas 1. History of C++ 2. Definition object-oriented…
A: 1. History of C++ The history of the C++ language is interesting to know. Here we are going to…
Q: How can you subscript and superscript small and big letters from a-z also from numbers 1-100 in c++…
A: It is possible Given are all the possible subscript and superscript along with the following…
Q: What is the difference between call by address and call by reference? Explain with proper example.
A: A function is a block of statement used to solve a specific problem. Functions exchange information…
Q: What is the application of the program "Scientific Calculator in C++" in real life and as an…
A: => i have provided this answer with full description in step-2.
Q: What is a function in C Programming Language? Explain the types of functions with examples in detail
A: I have given an explanation in step2
Q: What are header files, and what are its uses in C programming? Can I create a customized header…
A: Header files also known as library files is a file with extension .h which contains C function…
Q: What Does Static Variable Mean In C?
A: Given that: The topic is about Static Variable Mean In C.
Q: Write a c++ program for function overriding?
A: Function overriding: Function overriding is the concept of object-oriented programming where there…
Q: This is meant to assess prior knowledge about variables, constants, literals and expression types in…
A: Constant: Usage: By declaring a constant you can use the same identifier throughout the program.…
Q: What is the use of the // operator in python?
A: Since you have posted multiple questions, so we'll answer the first one. Please resubmit the…
Q: In C++, which of the following libraries need to be included in order to
A: There are many libraries available in C++ which can be included in the program to implement the…
Q: What do you mean by the Scope of the variable? What is the scope of the variables in C?
A: Introduction: What do you mean by the Scope of the variable? What is the scope of the variables in…
Q: What is modular programming? Write down all the necessary details about returning and non returning…
A: C-programming: It is a procedural programming language that can be used for developing several…
Q: What is the standard naming convention used among C# programmers for method names? Why?
A: Pascal case: Pascal case is used for method names. It seems to be similar like camelCase that is…
Q: What Are The Differences Between A C++ Struct And C++ Class?
A: Required: What Are The Differences Between A C++ Struct And C++ Class?
Q: Write a C++ problem using inheritance, input and output.
A: As per the requirement program is done. Here I am explaining the basic level inheritance. Algorithm:…
Q: In at least one paragraph, answer the following question: What are functions in C programming, what…
A: According to the question A function is a statement block that performs a specific function. Suppose…
Q: What are the most important phases in the C++ compilation process?
A: What does compilation means? Compilation is process of converting the high level language that is…
Q: What is the case in c++ Explain it please
A: Switch Case: its is used when have multiple conditions and need to perform different action based…
Q: OOP ideas need to be debated. How much of them are taken into consideration in the C++ program?
A: Object-situated programming - As the name proposes involves objects in programming. Object-situated…
Q: reusability
A: c++ code reusability mean
Q: This question is in the course of Programming Languages 2, which is the second course in C…
A: Array A will have the individual digits of roll number in it s1 will have sum of all even numbers in…
Q: Why there is no virtual constructor in C++? Illustrate with example
A: Why there is no virtual constructor in C++? Illustrate with example.
Q: Please explain the following question in 100 words atleast with proper examples. **Question) Share…
A: Given: Explain advantages of C++.
Q: What are the advantages and disadvantages of passing parameters in a C program instead of using a…
A: Parameter passing allows the user to use value of local variables which were declared within main…
Q: Explain the system() function in C++ like programming environments. Which library is needed? What is…
A: We have explain the system() function in C++ like programming environments.Which library is needed.…
Q: Why are jumping statements in c? Explain with help of examples?
A: Definition of jump statement in C language –Jumps statements are used to disrupt the program’s…
Q: Write a program using the C ++ language and its affiliate OOP to make a simple mathematical…
A: #include <bits/stdc++.h> #include <vector> using namespace std; class B;class C;class…
Q: can you explain this question , i just want basic experession for understanding it is c programming…
A: the given expressions are:- A $ B $ C * D A / (B * C + D * E)
Q: When we are talking about c++ and our code, what does abstraction mean? Please explain in detail…
A: We need to tell that what is the abstraction in C++.
Q: Write a program that demonstrates the similarities and differences between the concepts oop of Java…
A: Java is a programming language. It contains extensive libraries (package). It can be used to create…
Q: What is a type in c++ and does we need to create a new type
A: Each variable in c plus plus has type which denotes type of data stored in memory.
Q: What is a string in c-programming? Give the Importance of strings in c-programming, types of strings…
A: A string is described as a collection of characters. A character array do not ends with'\0' but a…
Q: What do you know about Compile time and Run time Polymorphism along with Code(Console based) Example…
A: Given: Compile time and Runtime Polymerphism.
Q: Give theory as solution like background theory, what concepts will apply in this questions and…
A: Theory: First, we will take the input1 i.e roll no. If the roll no. is in the range(1-400), move…
Q: A lady behaves like a teacher in a classroom, mother or daughter in a home and customer in a market.…
A: #include <iostream> using namespace std; class Lady { public: void info(){…
Step by step
Solved in 3 steps with 2 images
- c++ int primes={21,23,25,37,11,13,17.19,23,29,31,37,41,43,47,53,59,61,67,73,79,83,89,97} consider the above array of primes you have to search 53 in the array, also you have to check whether 53 is prime or not, also keep count of how many primes comes before 53.Select true or false for the statements below. Explain your answers if you like to receive partial credit Select true or false for the statements below. Explain your answers if you like to receive partial credit Which of the following is true about searching elements in an unordered array? With the data is unsorted, search is O(n) because if the element you are looking for is not there, you have to check every element in the array If you start at the end of the array and traverse to index 0, search improves to O(log n) because you only have to look at half of the array If you get lucky with checking the first element and find it immediately, then the worst case performance of search improves to O(n^2) Which of the following is true about searching elements in an ordered array? You cannot use binary search on an ordered array so the performance is O(n) If there are no holes in the array and the elements are all next to each other, then the performance for search improves to…Following is the function for interpolation search. This searching algorithm estimates the position (index) of a key in array based on the elements in the first position and last position in the array, and the length of array. The array must be sorted in ascending order. Suppose array A contains the following 15 elements: A = [1, 3, 3, 10, 17, 22, 22, 22, 24, 25, 26, 27, 27, 28, 28] At first iteration, at which position (index) the element of 24 is estimated in array A? In which part of array (starting index and ending index) the searching should continue? How many iterations the searching are performed until the element of 24 is found? int InterpolationSearch(int x[], int key, int n) { int mid, min = 0, max = n-1; while(x[min] < key && x[max] > key) { mid = min + ((key-x[min])*(max-min)) / (x[max]-x[min]); if(x[mid] < key) min = mid + 1; else if(x[mid] > key) max = mid - 1; else return mid; } if…
- 2. An interpolation search assumes that the data in an array is sorted and uniformly distributed.Whereas a binary search always looks at the middle item in an array, an interpolation searchlooks where the sought-for item is more likely to occur. For example, if you searched yourtelephone book for Victoria Appleseed, you probably would look near its beginning ratherthan its middle. And if you discovered many Appleseeds, you would look near the lastAppleseed. Instead of looking at the element a[mid] of an array a, as the binary search would,an interpolation search examines a[index], where p = (desiredElement - a[first]) / (a[last] - a[first]) index = first + [(last – first) × p]Implement an interpolation search of an array. For particular arrays, compare the outcomesof an interpolation search and of a binary search. Consider arrays that have uniformlydistributed entries and arrays that do not. Modify and save the file asSearchComparerYourlastname.java.// lab8ExB.cpp #include <iostream> using namespace std; void insertion_sort(int *int_array, int n); /* REQUIRES * n > 0. * Array elements int_array[0] ... int_array[n - 1] exist. * PROMISES * Element values are rearranged in non-decreasing order. */ void insertion_sort(const char** str_array, int n); /* REQUIRES * n > 0. * Array elements str_array[0] ... str_array[n - 1] exist. * PROMISES * pointers in str_array are rearranged so that strings: * str_array[0] points to a string with the smallest string (lexicographicall) , * str_array[1] points to the second smallest string, ..., str_array[n-2] * points to the second largest, and str_array[n-1] points to the largest string */ int main(void) { const char* s[] = { "AB", "XY", "EZ"}; const char** z = s; z += 1; cout << "The value of **z is: " << **z << endl; cout << "The value of *z is: " << *z << endl; cout << "The value of…The code below computes the intersection (the number of entries shared by two arrays). It is assumed that neither array contains any duplicates. It computes the intersection by sorting one array (array b) and then iterating over array a to see if each value is in b (through binary search). What is its duration? nt intersection(int[] a, int[] b) {mergesort(b);}int intersect = 0;for (int x : a) {if (binarySearch(b, x) >= 0) {intersect++;return intersect; }}
- Peaks and Valleys: In an array of integers, a "peak" is an element which is greater than or equalto the adjacent integers and a "valley" is an element which is less than or equal to the adjacentintegers. For example, in the array {5, 8, 6, 2, 3, 4, 6}, {8, 6} are peaks and {5, 2} are valleys. Given anarray of integers, sort the array into an alternating sequence of peaks and valleys.EXAMPLEInput: {5, 3, 1, 2, 3}Output: {5, 1, 3, 2, 3}Select true or false for the statements below. Explain your answers if you like to receive partial credit1) Which of the following is true about searching elements in an unordered array?a. With the data is unsorted, search is O(n) because if the element you arelooking for is not there, you have to check every element in the arrayb. If you start at the end of the array and traverse to index 0, search improvesto O(log n) because you only have to look at half of the arrayc. If you get lucky with checking the first element and find it immediately, thenthe worst case performance of search improves to O(n^2)Please help me with this assignment. For this assignment you will implement divide and conquer algorithms: merge sort . For merge sort, you will just implement the algorithm on an array of ints. I have provided the pseudo code for algorithms. You will need to handle cases of all sizes, not just powers of 2. Implement Merge Sort Create a class called MergeSorter in the divideandconquer package. This class willimplement merge sort on an array of ints. Implement the following method with the exactsignature below. You will need to create private helper methods that do most of the work. public static void mergeSort(int[] arr)This method sorts the int[] arr using the merge sort algorithm described in the pseudocodeabove.
- Given the following array: 65, 15, 129, 22, 12, 10, 239, 334, 10, 111, 180, 1, 2 What will be the array contents looking like in the following situations: 1) after calling the partition method three times in quick sort if pivot is the last element. 2) after the third iteration of the outer loop in insertion sort. 3) after the third iteration of the outer loop in Selection sort.There is an array with the original content as follows5,6,7,20,33,44,46,47,48,99,101,102,105Now execute Sequential search, and the state of the sorted array has been completed in the array, how many comparisons are required for the following numbers?48 : ___100 : ___int g(int nums[], int n) { if (n == 1) return 0; int val = g(nums, n-1); if (nums[n-1] > nums[val]) return val; return n-1; } Give a recurrence T(n) for the number of times the code nums[n-1] > nums[val] is executed when the array values are in ascending order. Then solve the recurrence