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
3
votes
3 answers

Future minimum pandas dataframe

I have a time series in a Pandas DataFrame for which I want to add a new column with the (future) minimum values. Specifically, imagine I have the following values in my time series: VAL 1 0 4 3 2 3 4 I would like to find the…
rv123
  • 476
  • 1
  • 3
  • 14
3
votes
3 answers

How to find maximum negative and minimum positive number in a numpy array?

I am given an array containing both positive and negative numbers. import numpy as np arr = np.array([-10.2, -5.3, -2.1, 0, 1.2, 3.4]) I would like to find the index corresponding to the maximum negative number and to a minimum positive number. In…
matttree
  • 125
  • 1
  • 1
  • 11
3
votes
1 answer

How to find minimum element in a given range of indices for a vector?

How to find the minimum element in a given range of indices for a std::vector? Let us say the vector is vector v = {1,2,3,4,5}; So min_element(v.begin(), v.end()); will give 1. But what if we want a minimum from indices 1 to 3? That is, in…
Swapnil B.
  • 729
  • 1
  • 8
  • 23
3
votes
2 answers

Given an array A and m queries

Given an array A and m queries each query is integer T For each query find index i and j such that | (|sum of elements from i to j| - T) | is minimum wher |x| is abs(x) and array can have negative numbers as well I was asked this question in…
3
votes
3 answers

How to select a single object using Linq in vb.net

I have done a lot of searching to what appears to be a simple LINQ problem but I can't figure out how to do grab an object out of a collection that has a specified minimum (or max value) without resorting to a sort like this: dim customers=…
Hucker
  • 671
  • 1
  • 8
  • 25
3
votes
3 answers

How to organize a MST when one node disappear?

I'm doing my research and stuck with a question: I am having a minimum spanning tree (prim algorithm), now one node in my tree gets deleted, I wonder if there is a way i can re-organize my tree such that the optimality still maintains? I'm looking…
user188276
3
votes
2 answers

Finding the minimum in a list that is Decreasing and then Increasing and might contain duplicates

Given a list that can be broken into two pieces L[:z] and L[z:] such that the first is non-increasing and the second is non-decreasing and may or may not contain duplicate elements, create a function such that: Input: A list L as specified above A…
3
votes
1 answer

minimum set cover with no overlapping element between solution sets

I am trying to solve a sub problem of set cover. For example, the U={ (1,2,3), (4,3), (5,3), (1,2), (4) } I want to find the minimum number of sets that cover all the elements in U, however with a constraint that the solution set should not have…
Joy
  • 181
  • 2
  • 8
3
votes
1 answer

Index of the minimum value in array; "recursive"

I'm trying to find the first index of the minimum value based on the first column in a 2d array, this is my function: n is the number of rows and k is 0 at the beginning. public int findMinRecursive(int[][] array, int n, int k) { int min; if…
3
votes
1 answer

R shiny numericInput step and min value interaction

Consider the following numeric widget in an R Shiny app: numericInput("val", "Enter value:", value = 50, min = 0, step = 5) If you click on the up/down arrows in the widget when the app is run, the value will increase or decrease by 5 (0, 5, 10,…
qanda
  • 225
  • 3
  • 12
3
votes
1 answer

Find the Optimal vertex cover of a tree with k blue vertices

I need to find a 'dynamic - programming' kind of solution for the following problem: Input: Perfect Binary-Tree, T = (V,E) - (each node has exactly 2 children except the leafs). V = V(blue) ∪ V(black). V(blue) ∩ V(black) = ∅. (In other words,…
Ygrno
  • 141
  • 1
  • 8
3
votes
3 answers

How to delete the lowest number in an array, and if there's several minimum numbers, delete the first

I'm trying to make a script, where the input is an array with random numbers. I try to delete the lowest number in the array which is no problem. But if there are several occurrences of this number in the array, how do I make sure that it is only…
3
votes
1 answer

Find minimum of various predicates

I want to find the minimum value of all permutations called from main predicate. For simplicity, I have removed my entire code, assume that I just want to find the minimum of head elements of all permutations. appendlist([], X,…
qwe
  • 53
  • 3
3
votes
5 answers

Java collection to retrieve minimum element in O(1) or O(log(n)) at worst

I'm iterating through a huge file reading key and value from every line. I need to obtain specific number (say 100k) of elements with highest values. To store them I figured that I need a collection that allows me to check a minimum value in O(1) or…
stanwar
  • 181
  • 1
  • 8
3
votes
1 answer

std::min_element on list does not return the minimum

I have a while loop that initialize a list with some doubles. I would like to output the smallest value but what I have done so far seem not be working, because I don't get any output. This is the relevant part of my code: list
Viktoria
  • 533
  • 2
  • 7
  • 24