
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Question
![7. What does the following function do? saved
void transform (int array[], int length)
{
int min_position = 0;
for (int k = 1; k < length; k++)
{
if (array[k] < array[min_position])
{
%3D
min_position
k;
%3D
}
}
int temp = array[min_position];
array[min_position]
array[0] = temp;
}
array[0];
%3D
It finds the smallest array element and overwrites it with a zero
It finds the smallest array element and swaps its value with the last array element.
It finds the smallest array element and swaps its value with the first array element.
It finds the smallest array element and attempts to swap it but fails because no reference parameters.
O O O O](https://content.bartleby.com/qna-images/question/3935a5a6-1355-4442-a788-b5eb7b8f90d8/7d99b26c-2285-4a63-bb66-451a8986207d/tyh961_thumbnail.png)
Transcribed Image Text:7. What does the following function do? saved
void transform (int array[], int length)
{
int min_position = 0;
for (int k = 1; k < length; k++)
{
if (array[k] < array[min_position])
{
%3D
min_position
k;
%3D
}
}
int temp = array[min_position];
array[min_position]
array[0] = temp;
}
array[0];
%3D
It finds the smallest array element and overwrites it with a zero
It finds the smallest array element and swaps its value with the last array element.
It finds the smallest array element and swaps its value with the first array element.
It finds the smallest array element and attempts to swap it but fails because no reference parameters.
O O O O
![6. What does the following function do? saved
int function(int array[], int size, int slot)
{
int val =
array[0];
slot
= 0;
for (int i
{
if (array[i] > val)
{
val
1; i < size; i++)
%3D
array[i];
i;
slot
}
}
return val;
}
Returns the min value in the array and index in slot
Returns the max value in the array and index in slot.
Returns the min value in the array.
Returns the max value in the array.
O O O O](https://content.bartleby.com/qna-images/question/3935a5a6-1355-4442-a788-b5eb7b8f90d8/7d99b26c-2285-4a63-bb66-451a8986207d/zg7l63j_thumbnail.png)
Transcribed Image Text:6. What does the following function do? saved
int function(int array[], int size, int slot)
{
int val =
array[0];
slot
= 0;
for (int i
{
if (array[i] > val)
{
val
1; i < size; i++)
%3D
array[i];
i;
slot
}
}
return val;
}
Returns the min value in the array and index in slot
Returns the max value in the array and index in slot.
Returns the min value in the array.
Returns the max value in the array.
O O O O
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution
Trending nowThis is a popular solution!
Step by stepSolved in 2 steps with 1 images

Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- C PROGRAMMING LANGUAGEarrow_forwardMatrix Addition• Write an addition function that accepts two 2D numpy arrays, andreturns the sum of the two (if they are the same size). This functionshould test that the arrays are the same size before performing theaddition. If the arrays are not the same size, the function shouldreturn -1. solve in pythonarrow_forwardPrompt: In python langauge, write a function that adds a random noise to all elements of a NumPy array Code: import numpy as np import math import matplotlib.pyplot as plt import pandas as pd def addNoise(inputArray): modifiedArray = np.zeros(len(inputArray)) #YOUR CODE HERE: return(modifiedArray) def test(): inputs = np.arange(-5, 5,0.2) outputs = addNoise(inputs) plt.figure(1) plt.plot(inputs) plt.title('Input') plt.xlabel('Index') plt.ylabel('Value') plt.show() plt.figure(2) plt.plot(outputs, 'black') plt.title('Output') plt.xlabel('Index') plt.ylabel('Value') plt.show() test()arrow_forward
- 1- Write a user-defined function that accepts an array of integers. The function should generate the percentage each value in the array is of the total of all array values. Store the % value in another array. That array should also be declared as a formal parameter of the function. 2- In the main function, create a prompt that asks the user for inputs to the array. Ask the user to enter up to 20 values, and type -1 when done. (-1 is the sentinel value). It marks the end of the array. A user can put in any number of variables up to 20 (20 is the size of the array, it could be partially filled). 3- Display a table like the following example, showing each data value and what percentage each value is of the total of all array values. Do this by invoking the function in part 1.arrow_forwardPrompt: In Python language, write a function that applies the logistic sigmoid function to all elements of a NumPy array. Code: import numpy as np import math import matplotlib.pyplot as plt import pandas as pd def sigmoid(inputArray): modifiedArray = np.zeros(len(inputArray)) #YOUR CODE HERE: return(modifiedArray) def test(): inputs = np.arange(-100, 100, 0.5) outputs = sigmoid(inputs) plt.figure(1) plt.plot(inputs) plt.title('Input') plt.xlabel('Index') plt.ylabel('Value') plt.show() plt.figure(2) plt.plot(outputs,'Black') plt.title('Output') plt.xlabel('Index') plt.ylabel('Value') plt.show() test()arrow_forwardMIPS Assembly The program: Write a function in MIPS assembly that takes an array of integers and finds local minimum points. i.e., points that if the input entry is smaller than both adjacent entries. The output is an array of the same size of the input array. The output point is 1 if the corresponding input entry is a relative minimum, otherwise 0. (You should ignore the output array's boundary items, set to 0.) My code: # (Note: The first/last entry of the output array is always 0# since it's ignored, never be a local minimum.)# $a0: The base address of the input array# $a1: The base address of the output array with local minimum points# $a2: Size of arrayfind_local_minima:############################ Part 2: your code begins here ###la $t1, ($t2)la $t1, ($t2)move $a1, $s0 li $a2, 4jal find_local_minima print:ble $a2, 0, exitlw $a0, ($s0)li $v0, 1syscall addi $s0, $s0, 4addi $a2, $a2, -1 ############################ Part 2: your code ends here ###jr $ra I am not getting the correct…arrow_forward
arrow_back_ios
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education

Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON

Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education