Create two Arrays A with 10 unsorted integer elements and B with 10 unsorted float elements. Find the largest element in A and B and then sum both of them calling a function SumAB() by reference. Sort A and B and then call another function StichAB() to merge B with A. Be careful about memory leakage.
Q: Write a C program that reads a matrix of n × m numbers, transpose the matrix, then print it out…
A: Sol: #include <stdio.h> #include <stdlib.h> void main() { int a[10][10], r, c, i,…
Q: Write a function REVCOL (in PO (5), int N, int int M) in C++ to display the content of a two…
A: Here we can write the c++ code and attach the output of the following so the coding of the following…
Q: Write a program using (string inst uctions) to transfer data from array starting at 34000H to…
A: Here is the solution and explanation.
Q: write a c++ program for the following Create a 5x5 two 2D-Dynamic array and initialize it with the…
A: Given: write a c++ program for the following Create a 5x5 two 2D-Dynamic array and initialize it…
Q: Write the function append which reads from standard input, appending the elements to the end of the…
A: The function code is given below.
Q: Write a function resize(.) that dynamically resizes an array of integers by a specified amount in…
A: C++: It is a general purpose programming language. It is extension of C program. It is efficient…
Q: Consider an array named “Student [Marks]” to store her marks for 3 subjects. Explain how a total of…
A: Pointer stores the address of a variable. Follow the below steps to get the sum of three subjects…
Q: Implement a function void fill with values (int a[], int size, IntFunPointer f) hat sets the ith…
A: COde snippet and sample output:
Q: 2. Write a program which sorts the CGPA array having cgpa of all students in ascending order by…
A: The program is written in C
Q: 2.) Revise the function quickSort so that it always chooses the last item in the array as the pivot.…
A: #include <iostream>#include <ctime>using namespace std; void swap(int* a, int* b){…
Q: Write the function lastOf which searches the array a for the last occurance of any value contained…
A: Algorithm: Start Read size of 2 arrays n and m Read n array elements in array a Read m array…
Q: Write program to display values of integer array and use dereferencing to change array values using…
A: Using dereferencing we are changing the values of the array using the pointer
Q: To accelerate the processing, we would like to split the original list of messages into 3. Rewrite…
A: CODE:- // Go program to illustrate how// to create an anonymous Goroutinepackage main import (…
Q: Write a function that receives a two-dimensional array, prints out the data by row along with the…
A: Since your not mentioning the programming language we used C to complete this program. PROGRAM:…
Q: Write a C++ program for any array to answer the following: int V[3] = {20, 30, -30}; Print out…
A:
Q: C++ Implement Exercise 8-13 (8-13: Write a program to calculate students’ average test scores and…
A: #include <iostream> #include<fstream> #include<iomanip> using namespace std; class…
Q: Write a function that takes two int arrays arr1 and arr2, and their size n as parameters. The…
A: I Give the code along with screenshot in python language.
Q: Write a program to declare an integer array of 50 elements. A. Write a function getArray() to get…
A: C++ code: #include <iostream>using namespace std; //A partvoid getArray(int arr[]) {…
Q: Complete the swift function given below and test it for the array [14, 67, 4, 16]
A: Complete the swift function given below and test it for the array [14, 67, 4, 16]. Given Function:…
Q: Q1:, ., Implement a range function for a dynamic array which returns a new dynamic array that is a…
A: Step 1 : Start Step 2 : Define a function which returns a new dynamically created array of the given…
Q: Write a function that returns True if two arrays, when combined, form a consecutive sequence. A…
A: Algorithm - Take input from the user. Now use the below logic - c = a + b x,y =…
Q: Following is the partition function for quicksort, where we have used the leftmost number as a…
A: The answer is 7, 8, 9, 14, 15, 22, 38 here 14 is pivot element ,the element less than 14 are on…
Q: Take number n from user and create an array A of random integers of size n. The size of n can be in…
A: Program: //main.cpp #include <iostream> //header file for cin,cout and endl #include…
Q: Given an Array M of 99 int values, and int *pit: 1. Declare two pointers pl and p2 2. Make p1 point…
A: NOTE: According to the guidelines, attempt only the first 3 subparts. First, we will create the…
Q: 1. Given an unsorted array of N integers (N > 0) and an integer value x, write the function that…
A: Array: A data object contained in contiguous memory locations is referred to as an array. So we cam…
Q: Implement the following function, without using any data structure. /* Given two vectors of chars,…
A: / include headers #include <bits/stdc++.h> // deinfe the namespace using namespace std; //…
Q: Write a function: • diceSim(D1,D2,trials) that takes as input the number of sides on die 1 (01) and…
A: diceSim(D1,D2,trials) that takes as input the number of sides on die 1 (D1) and die2 (D2) and the…
Q: You are given two integer arrays nums1 and nums2, sorted in non-decreasing order, and two integers m…
A: Step 2 This question explains about :
Q: Create a Numpy program to create a structured array from given student name, class, height and their…
A: Given: Create a numpy program to create a structured array from given student name, class, height…
Q: Program in c+. Given an unsorted array, find the least difference between the element pairs Display…
A: Input : Input the array Size of array Output : Find the pairs with least distance. Sort the array…
Q: 3.6 Write a program that reads Mathematic test marks of 10 (ten) student and stores it to a…
A: Here I ahve created the array with size 10. Next, I ahve taken input from the user and stored it…
Q: Write a C program that will ask the user to input (from the console) number of students in a class…
A: We must know what is Dynamic Memory Allocation :- At times , we face the issue where, The array size…
Q: Write a C program that receives from the user five integers that should be stored in an array for…
A: C++ Program is asked which takes 5 integer values into an vector array and reverses the vector and…
Q: Write a function that removes the duplicate items from an unsorted array entered by the user and…
A: Program: #include <stdio.h> void removeDuplicate(int arr[], int n) { int j = 0; int…
Q: Create two dynamic arrays A and B with random numbers. a) Merge B in array A calling a function by…
A: rand() generate random numbers in c++ rand() % 10 will generate values from 0-9 rand() % 100 will…
Q: Write a function for given main functionint * return_an_array(int n) which takes an integer n and…
A: Algorithm Steps:- Find the number of digits in the integer n using repeated divisions by 10 until…
Q: Write a function in C language that takes your student number as a value and adds each digit of your…
A: The code and the output screenshot has been given in step 2.
Q: Q1/ Write a program to transfer all even numbers from a one dimension array with length another…
A: I give the code in Java along with output and code screenshot
Q: By defining a dynamic allocation for pointer array, ask the user to enter some numbers and then…
A: According to the Question below the Solution: Output:
Q: Write a function to make a quicksort. Make two pivots: 1. Geometric mean from first, Middle and last…
A: Algorithm for quicksort: Step1:Start. Step2:quickSort (array A, start, end). Step3:if (start <…
Q: Consider one dimensional studentsMark array and find maximum and minimum scorer by defining a…
A: I have provided C CODE along with CODE SCREENSHOT and OUTPUT SCREENSHOT------------
Q: Create two dynamic arrays A and B with random numbers. a) Merge B in array A calling a function by…
A:
Q: You are given two integer arrays nums1 and nums2, sorted in non-decreasing order, and two integers m…
A: the answer is given below:-
Q: (a) Write a program to dynamically allocate memory to a one-dimensional array and find the second…
A: Dynamically allocate memory to a one-dimensional array to find the second largest element from the…
Q: Create a function that tweaks letters by one forward (+1) or backwar (-1) according to an array.…
A: As you have not mentioned any specific language so I assumed it as Java i give the code in Java…
Q: 10) Suppose you have two arrays A and B of 10 elements for each one. Write a program to merge A & B…
A: Below is the C++ program for same:
Create two Arrays A with 10 unsorted integer elements and B with 10 unsorted float
elements. Find the largest element in A and B and then sum both of them calling a
function SumAB() by reference. Sort A and B and then call another function StichAB()
to merge B with A. Be careful about memory leakage.
Step by step
Solved in 3 steps with 1 images
- Write a function that receives a two-dimensional array, prints out the data by row along with the sum of the row values. Each value should be printed separated by a space. After the last element in the row has been printed, the sum should be printed on the same line, followed by a newline.Write a Program for insertion and deletion from an array without replacement of element from the arrays. Also, write a program to search the array for the presence of a given element from an array. Write the sub-functions in the provided test case in text form and upload the same. #include<stdio.h> #include<stdlib.h> int cmpfunc (const void * a, const void * b) { return ( *(int*)a - *(int*)b ); } int insert_function(int *data, int n, int p, int x) { /* input data: array, n: size of array, p: position of insertion, x: element to insert*/ /*output:-1 indication error or 0 if successful /* write the function for inserting element into a position*/ } int delete_function(int *data, int n, int p, int x) { /* input data: array, n: size of array, p: position of deletion, x: element to deletion*/ /*output:-1 indication error or 0 if successful /* write the function for delete element into a position*/ } int linear_search_function(int *data, int n, int x) { /*write the function to…Write a function that takes two int arrays arr1 and arr2, and their size n as parameters. The functionreturns the number of elements that exist in arr1 and arr2 with indexes i1 and i2 respectively such that i1>=i2.(Example: arr1: [ 1,5,2,3,4,0,7] arr2: [0,1,3,7,4,2] then the function returns 3 ( 0,3,7) )
- Write a java labguage program to use parallel arrays to save User ID and Password. Ask the user to enter the user ID and Passwords for 3 users Save the above information in two parallel arrays (using the same index for each user) After the input is completed, ask the user to enter any user ID and then ask the password for that ID. Confirm if the User ID and password match, if not ask the passwordWrite a function that takes an array of objects and a key, and returns a new array sorted based on the values of that key in ascending order.Write a program, in C++, that uses a file called city.txt (attached sample) and reads information from the file into related arrays. Ask the user to type and select a name of a city, if the city is on the list, print the city name, and all other information about it. Otherwise say the City you entered is not in the list.
- 2.) Revise the function quickSort so that it always chooses the last item in the array as the pivot. Add a counter to the function partition that counts the number of comparisons that are made. Compare the behavior of the revised function with the original one (pivot should be selected using sortFirstMiddleLast algorithm), using arrays of various sizes. At what size array does the difference in the number of comparisons become significant? For which pivot selection strategy does the difference in the number of comparisons become significant? Compare your analysis with the actual running times and counter as a function of the input size n = 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 8192, 16384 <time.h> and clock() function. For comparison, you need to create two tables for execution times and a counter for both algorithms(This if for mindtap on cengage, if not possible, use devc++ 5.11 but mindtap is more accurate) Write a C++ function, smallestIndex, that takes as parameters an int array and its size and returns the index of the first occurrence of the smallest element in the array. To test your function, write a main that prompts a user for a list of 15 integers and outputs the index and value of the first occurrence of the smallest value. An example of the program is shown below: (look at picture) You can use the following integer lists to test your code: 56, 34, 67, 54, 56, 87, 66, 92, 15, 32, 55, 54, 88, 92, 30 79, 26, 97, 87, 73, 44, 67, 46, 55, 13, 20, 20, 33, 42, 60 63, 1, 40, 81, 30, 11, 26, 44, 98, 1, 80, 98, 15, 3, 42Implement a C function, named median, that receives two arrays as parameters passed and returns the median of the values stored in these two arrays. The two arrays are sorted. The prototype of the function MUST be: double median(int a[], int b[], int sizeA, int sizeB);For example, if I have int a[] = {1, 2, 10, 12, 100}; and int b[] = {3, 11, 20, 500, 600}; then the median is (11+12)/2 = 11.5.
- C++ Implement Exercise 8-13 (8-13: Write a program to calculate students’ average test scores and their grades.) using single-dimensional parallel arrays. Create a text file with the following data to test your code. Read the following data from this text file: Johnson 85 83 77 91 76Aniston 80 90 95 93 48Cooper 78 81 11 90 73Gupta 92 83 30 69 87Blair 23 45 96 38 59Clark 60 85 45 39 67Kennedy 77 31 52 74 83Bronson 93 94 89 77 97Sunny 79 85 28 93 82Smith 85 72 49 75 63 Using the data above your output should be: (image below)You are given two integer arrays nums1 and nums2, sorted in non-decreasing order, and two integers m and n, representing the number of elements in nums1 and nums2 respectively. Merge nums1 and nums2 into a single array sorted in non-decreasing order. The final sorted array should not be returned by the function, but instead be stored inside the array nums1. To accommodate this, nums1 has a length of m + n, where the first m elements denote the elements that should be merged, and the last n elements are set to 0 and should be ignored. nums2 has a length of n. Solution should avoid Runtime ErrorYou are given two integer arrays nums1 and nums2, sorted in non-decreasing order, and two integers m and n, representing the number of elements in nums1 and nums2 respectively. Merge nums1 and nums2 into a single array sorted in non-decreasing order. The final sorted array should not be returned by the function, but instead be stored inside the array nums1. To accommodate this, nums1 has a length of m + n, where the first m elements denote the elements that should be merged, and the last n elements are set to 0 and should be ignored. nums2 has a length of n.