Skip to main content

All Questions

Tagged with
0 votes
0 answers
139 views

Best choice for a holding large number of objects in java

I have a set of array, containing a large number of objects (products), which has lately grown so large, searching in it takes about a minute, which is considered too long, since one search is ...
kry's user avatar
  • 101
0 votes
1 answer
606 views

Algorithm to find the highest Tetromino in a Tetris board?

Lets say that our Tetris board is represented as a 2D array of zeros and ones, where a 0 means empty and 1 means occupied, and you where asked to find the highest row in which a tetromino exists. ...
Raed Tabani's user avatar
3 votes
1 answer
537 views

Conveniently sorting and (binary?) searching an array of pairs of numbers?

So I have an array of distinct pairs of positive integers. That is, my array looks something like this (for instance): { (1,5) , (6,4), (5,3), (2,3), (2,4) } And my task is, for a given pair (a,b) ...
Nu Nunu's user avatar
  • 131
0 votes
3 answers
7k views

Find all lines segments intersections

I have a collection of lines segments, represented by an array. Ex: [3,7,13,6,9] is 4 line segments: [(3,7)(7,13)] , [(7,13)(13,6)] , [(13,6)(6,9)] , ([6,9)(9,3)] I want to find all the lines ...
Ilya Gazman's user avatar
3 votes
5 answers
8k views

How do you find the first common element in two arrays

How do you find the first common element in two arrays? My attempt: I looped through each at the same time and add the current value to a separate set for each of the lists. Also, check if the current ...
user1136342's user avatar
1 vote
1 answer
2k views

Is there a more efficient way to filter large arrays than preg_match()?

I have a log that our web application builds. Each month it contains around 16,000 entries of a string with about the average sentence worth of text. To filter/search through these in our admin panel ...
hozza's user avatar
  • 313