Questions tagged [minimum]

Minimum refers to the value in a collection of values that is the least or smallest.

In mathematics, the minimum of a function is the smallest value that the function takes at a point either within a given neighborhood (local or relative minimum) or on the function domain in its entirety (absolute minimum).

Examples

Python

>> import numpy as np
>> np.min([0, 1, 2])
0

See also

1056 questions
-2
votes
1 answer

Am I referencing or instancing wrong for finding the index of the smallest value in an array?

My array is: int a = new int[] {20,20,30,40,6,70,80} My code for finding minimum value is correct, but when I try to put idx=i or idx= i+1 and return idx, my output is 0. int minval=0; int idx=0; if(a==null || a.length==0) { return…
Lockser
  • 9
  • 1
-2
votes
1 answer

In R, how do I identify which two rows have minimum distance in my (x,y) dataframe?

In R, I have a dataframe with x,y as lat,long. How do I find which rows get the minimum distance and assign a number in a new column to show this? An simple example below shows the two rows, (5,3) and (5,2), that have a minimum distance and Column…
Kate
  • 35
  • 6
-2
votes
2 answers

Finding the smallest element of a vector

I'm 10th grade student, only 2 weeks of coding. I have a homework to fix this code if not working from the book with the title "Finding the smallest element of a vector". I've been stuck here over 5 days, and tomorrow is my due date. #include…
-2
votes
1 answer

Find the minimum and maximum number in an Array in Java

I'm new to programming. I want to find the maximum and minimum number in a given array. So I wrote this code. Although this gives the correct minimum number, it gives multiple maximum numbers. Can someone help me with this? package…
-2
votes
2 answers

Trying to find shortest sentence in string using arrays

I got function to find longest sentence in array of sentences how can i now turn this to find the shortest and then copy that into char R[red]; and then manipulate over last word of the sentence of the shortests one to change first and last letter…
-2
votes
1 answer

Finding the minimum from a nested list using recursion

I am trying to write a function to find the minimum value of a nested list. I have written code but get the error that I cannot use < between an integer and a list. Any ideas? I cannot use any built-in functions. def minimumVal(Y): if len(Y) ==…
-2
votes
3 answers

Finding minimum value in list of lists

I want to find the smallest value in a list of lists in Python. Example: ls = [[2,3,5],[8,1,10]] The minimum value in ls is 1. How can I get that in a simple way?
lfvv
  • 1,509
  • 15
  • 17
-2
votes
4 answers

Get min and max of nested JSON object

I have a nested json object which looks like--- [ {"key":"AXCG","values":[ {"interval":'1_to_2years',"value":34}, {"interval":'3_to_4years',"value":12}, {"interval":'5_to_6years',"value":45}, ]}, …
user435215
  • 127
  • 2
  • 11
-2
votes
3 answers

Finding the largest, second largest, second smallest, and smallest int from an array in java

I'm using a method to print the largest, second largest, smallest, and second smallest integers. This is what I have so far for the base: case 1: System.out.print("\nEnter the Limit: "); limit = input.nextInt(); …
Ashley
  • 17
  • 5
-2
votes
1 answer

Why I am always getting 0 as the minimum of an array

Below is my code for finding the minimum and maximum value from an array. Can anyone explain why I am getting 0 as the output for minimum element? What can be the reason behind it? I am getting the maximum value among the elements of array as…
-2
votes
3 answers

How to find the minimum, maximum , and mode in an array using if statements and for loops (java)?

First question here, so please be easy on me. Currently learning java for fun and I was hoping I can pick your guys' brain on asking for this. for (int i = 0; i < num; i++) { if (score[i] > max) { max =…
-2
votes
1 answer

which one of the following expressions is faster to determine index of minimum element in a list?

>>> l=[1,2,3] >>> l.index(min(l)) >>> 0 >>> from operator import itemgetter >>> min(enumerate(l),key=itemgetter(1))[0] >>> 0 need to use this repeatedly inside a loop of 10,000 iterations , so which is more efficient
user3000139
  • 11
  • 1
  • 3
-2
votes
5 answers

How to find the minimum element from two arrays in given time complexity in python

I have 2 arrays A and B. I'm trying to find the minimum from the elements which are common in the arrays A and B. Like , if A = [1,3,2,1] & B = [4,2,5,3,2], so it should return 2 because it is the minimum element which comes in both A & B. My code…
Ashka
  • 9
  • 2
-2
votes
1 answer

How do I find the minimum cost and the path in an NxN Matrix?

I have to start at location (0,0) and I can either move up or move right (no diagonal traversals). I need the minimum cost matrix to reach node (n-1,n-1). I also need the recorded path for the minimum cost. Also, I need to count the total number of…
ExeCode
  • 21
  • 1
  • 6
-2
votes
1 answer

How to find Minimum in a sequence

A = ... //tuples of Medication(patientid,date,medicine) B = A.groupby(x => x.patientid) Example B would look like below - now I need to find the minimum date, how to do that in scala?? ( 478009505-01, CompactBuffer( …