If You Have Any Queries Please Comment Below
Please Upvote If You Like The Answer
/*pseudo code*/
Enter the Size of Array N
Enter the N elements of Array a[n]
min=a[0]
for i=1 to N
if a[i]<min
second=a[i]
else if a[i]<second and a[i]!=min
second =a[i]
end if
end for
print first and second
TRACING:
ALGORITHM:
FLOWCHART:
Devise an algorithm to find the two smallest values of a one-dimensional array. The inputs are...
Design a program that inputs a list of up to 50 real values from a data file, Problem1InputFile.txt, and print the count and smallest value to the screen. Hint: an array is not really needed, but you can use one. Here is one sample input file for Problem1InputFile.txt (note that there is one real value per line and there is an extra blank line at the end): 10.5 2.1 2.0 -1.7 -0.5 Sample output: Count: 5 Smallest: -1.7 Give pseudocode...
ASSEMBLY LANGUAGE The matrix (two-dimensional array) with ROWS and COLS dimensions of integer values is given. Perform various matrix processing activities according to the algorithms below. Store the results into the output vector (one-dimensional array) with appropriate size. For Grade 7) Count the number of odd values (n mod 2 <> 0) for each row. For Grade 9) Calculate the sum of positive values for each column. To obtain inputs and return the results, define appropriate type C/C++ functions. Please...
In Java, Implement a class MyArray as defined below, to store an array of integers (int). Many of its methods will be implemented using the principle of recursion. Users can create an object by default, in which case, the array should contain enough space to store 10 integer values. Obviously, the user can specify the size of the array s/he requires. Users may choose the third way of creating an object of type MyArray by making a copy of another...
Your goal is to create an ‘Array’ class that is able to hold multiple integer values. The ‘Array’ class will be given functionality through the use of various overloaded operators You will be given the main() function for your program and must add code in order to achieve the desired result. Do not change any code in main(). If something is not working, you must change your own code, not the code in main(). Assignment 5: overloading member functions. Overview:...
sort.c #include <stdlib.h> #include <stdio.h> #include "libsort.h" int main() { int* array; int size, c; float median; printf("Enter the array size:\n"); scanf("%d", &size); array = (int*) malloc(size * sizeof(int)); printf("Enter %d integers:\n", size); for (c = 0; c < size; c++) scanf("%d", &array[c]); sort(array, size); printf("Array sorted in ascending order:\n"); for (c = 0; c < size; c++) printf("%d ", array[c]); printf("\n"); median = find_median(array,...
Programming Assignment #7 (Recursion) This assignment is to write some methods that perform simple array operations recursively. Specifically, you will write the bodies for the recursive methods of the ArrayRecursion class, available on the class web page. No credit will be given if any changes are made to ArrayRecursion.java, other than completing the method bodies Note that the public methods of ArrayRecursion – contains(), getIndexOfSmallest(), and sort() – cannot be recursive because they have no parameters. Each of these methods...
In Python and in one file please. (Simple functions with an expressions) Create a function called load_inventory(filename). The filename argument in this case specifies the name of a file that contains all the inventory/product information for the store, including product names, descriptions, prices, and stock levels. This function should clear any information already in the product list (i.e., a fresh start) and then re-initialize the product list using the file specified by the filename argument. You can structure your file...
In Python and in one file please. (Simple functions with an expressions) Create a function called load_inventory(filename). The filename argument in this case specifies the name of a file that contains all the inventory/product information for the store, including product names, descriptions, prices, and stock levels. This function should clear any information already in the product list (i.e., a fresh start) and then re-initialize the product list using the file specified by the filename argument. You can structure your file...
1 Objective Build a hashing algorithm that is suitable for use in a Bloom Filter. Please note that while a cryptographic hash is quite common in many Bloom Filters, the hashing algorithm to be implemented is a mix of the the following algorithmic models, specifically, a multiply & rotate hash colloquially known as a murmur hash, and an AND, rolale, & XOR hash colloquially known as an ARX hash. 2 Requirements • Inputs. Read the input file which contains strings...
Hello I need help with this program. Should programmed in C! Program 2: Sorting with Pointers Sometimes we're given an array of data that we need to be able to view in sorted order while leaving the original order unchanged. In such cases we could sort the data set, but then we would lose the information contained in the original order. We need a better solution. One solution might be to create a duplicate of the data set, perhaps make...