1
vote
1answer
64 views

High School Java Class: Pong Project External Reviewer

Panelball class: import java.awt.*; import java.awt.event.KeyEvent; import javax.swing.*; public class Panelball extends JPanel implements Runnable { private static final long ...
3
votes
1answer
44 views

Code to find the proper index comparing 3 values for max one

I have an algorithm and the idea is to move over an array choosing as index the index of the neighboring cell that has the max value. I.e. if array[i + 1][j + 1] has the largest value among the 3 ...
1
vote
1answer
116 views

C arrays and loops optimization

I am writing a program for learning purposes that takes an input of a file structured similarly to: 13,22,13,14,31,22, 3, 1,12,10 11, 4,23, 7, 5, 1, 9,33,11,10 40,19,17,23, 2,43,35,21, 4,34 ...
4
votes
1answer
136 views

Optimizing Python / Numpy Code

So I'm implementing a version of the mean shift image processing algorithm for color segmentation in python/numpy. I've written a pure numpy version of the actual mean shifting per pixel (which I ...
1
vote
2answers
63 views

Request for help to tidy up code involving arrays and loops

I posted the following code on here a few days ago: public class Practical4_Assessed { public static void main(String[] args) { Random numberGenerator = new Random(); int[] ...
4
votes
1answer
968 views

Java 2d array nested loops

Okay, So I have this method I made that searches a 2d array of user input column length and row length comprised of integers. The method is suppose to find 4 alike numbers in rows, columns, and both ...
1
vote
1answer
124 views

Extracting Multiple Associative arrays in PHP

public static function find_user_tracks($id) { global $mySQL; $sql = "SELECT * FROM `tracks` WHERE account_id = {$id}"; $result_set = $mySQL->query($sql); $ret = array(); ...
1
vote
1answer
162 views

Downsampling boundaries of a 2D array

I have a linearized 2D array u (block_height * block_width) containing the values of a physical quantity over a regular 2D mesh. I need to downsample boundaries (top, bottom, left, right) of this ...
2
votes
1answer
859 views

Better method to loop through arrays in VBA

I supplied the following code as an answer to this question on SO, but I was wondering if there was a better way to write out all those array loops. (i.e. perhaps using a Collection/Dictionary?) It ...
1
vote
3answers
290 views

Optimize Array.indexOf

How can I optimize checking a value in recursion before operating on it? I'm using Array.indexOf (this is Javascript) var nums = [], lengths = []; function findNumLength(n) { //preliminary check ...