Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

14
LINES

< > BotCompany Repo | #1030560 // indexOfMinEntryInDoubleArray

JavaX fragment (include)

1  
static int indexOfMinEntryInDoubleArray(double[] a) {
2  
  if (empty(a)) ret -1;
3  
  int bestIndex = 0;
4  
  double bestValue = a[0];
5  
  int n = l(a);
6  
  for (int i = 1; i < n; i++) {
7  
    double x = a[i];
8  
    if (x < bestValue) {
9  
      bestIndex = i;
10  
      bestValue = x;
11  
    }
12  
  }
13  
  ret bestIndex;
14  
}

Author comment

Began life as a copy of #1030551

download  show line numbers  debug dex  old transpilations   

Travelled to 4 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt

No comments. add comment

Snippet ID: #1030560
Snippet name: indexOfMinEntryInDoubleArray
Eternal ID of this version: #1030560/1
Text MD5: e48fbd2bfdc6f43e52412579c123ca2a
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-01-07 18:45:20
Source code size: 303 bytes / 14 lines
Pitched / IR pitched: No / No
Views / Downloads: 170 / 205
Referenced in: [show references]