The array-algorithms tag has no wiki summary.
0
votes
0answers
22 views
Matrix Traversal Algorithms
Is there an efficient algorithm for going through all the sub-cubes of a given cube ?
Ex :
Imagine a cube C of size n , i.e., with n^3 cells.
Is there any algorithm which traverses all sub-cubes of ...
0
votes
0answers
11 views
Optimize / redesign this java code
folks.
I need help or advice on decision making about a a design pattern (or sort of such) to uuse:
Have an application, running on weblogic via EJBs. Part of application deals with the the very ...
1
vote
3answers
60 views
Divide and Conquer Recursion
I am just trying to understand how the recursion works in this example, and would appreciate it if somebody could break this down for me. I have the following algorithm which basically returns the ...
2
votes
3answers
324 views
Finding a maximum sum contiguous sub array
I am writing a code to find the maximum sum contiguous sub array in C. The logic seems fine according to me, but still the output is not correct. Please look into the code. The algorithm divides a ...
5
votes
2answers
178 views
Median of medians algorithm: why divide the array into blocks of size 5
In median-of-medians algorithm, we need to divide the array into chunks of size 5. I am wondering how did the inventors of the algorithms came up with the magic number '5' and not, may be, 7, or 9 or ...
-1
votes
3answers
133 views
Clustering: finding groups of close items within a large collection
I have an array of items (~5000 items, each item is an English word) and a distance function between pairs of items. I want to find groups of items within the array where all the items within a group ...
-1
votes
3answers
386 views
Finding Minimum Key and Predecessor in B-Tree
Explain how to find the minimum key stored in a B-tree and how to find the predecessor of a given key stored in a B-tree.
0
votes
1answer
148 views
Intersection of maximum and minimum subarrays
Suppose we have an array of some integers (can be both +ve and -ve).
We find non-empty maximum and minimum subarrays(subarrays have successive elements only) from this.
My claim is that these ...
1
vote
4answers
85 views
Difference between shuffling algorithms
Let's say we're to write a method to produce a shuffled deck of cards. Now to make it very simple, disregard the suits and so we have 52 cards.
One algorithm would be:
Populate an array of 52 ...
0
votes
1answer
46 views
Need to find lowest differences between first line of an array and the rest ones
Well, I've been given a number of pairs of elements (s,h), where s sends an h element on the s-th row of a 2d array.It is not necessary that each line has the same amount of elements, only known that ...
-1
votes
1answer
254 views
implementing Brute Force in c++
I have a problem that deals with optimization of a game that includes 2 players.
So we have an undirected connected graph with a number of edges and some vertices.
Each player has to remove edges and ...
-1
votes
2answers
154 views
Algorithm for finding a sum within an array? [closed]
Say you have some array with elements that you know are all positive, and smaller than a number N.
Can someone give me a general, high-level description of an algorithm to find out whether there is ...
3
votes
2answers
112 views
Associative array lookup cost
Consider two lookup functions:
simple={1,3,5}
function isX(id)
for _,v in ipairs(simple) do
if v==id then return true end
end
return false
end
assoc={[1]=true,[3]=true,[5]=true}
...
0
votes
1answer
373 views
Trouble with my algorithm to solve a boggle board
so I'm relatively new to Java (I'm taking AP java at my school currently) and I am trying to develop a recursive algorithm to solve an n*n board and I feel I am very close but not quite there yet.
I ...
1
vote
1answer
297 views
How can I bubble sort this?
In this program I just wanted to bubble sort the ArrayList words. So far I used the Collections.sort and it has placed all the lines in the text file alphabetically. However, I want to implement a ...