Click here to Skip to main content
15,889,844 members
Home / Discussions / Algorithms
   

Algorithms

 
GeneralRe: Find the sublist of objects with the highest value without exceeding weight limit Pin
Member 143364281-May-19 6:49
Member 143364281-May-19 6:49 
GeneralRe: Find the sublist of objects with the highest value without exceeding weight limit Pin
Richard Deeming1-May-19 8:09
mveRichard Deeming1-May-19 8:09 
GeneralRe: Find the sublist of objects with the highest value without exceeding weight limit Pin
Member 143364282-May-19 4:19
Member 143364282-May-19 4:19 
GeneralRe: Find the sublist of objects with the highest value without exceeding weight limit Pin
Member 143364281-May-19 11:09
Member 143364281-May-19 11:09 
QuestionAlgorithm to compress Image to RGB565 for embedded screen Pin
XxKeldecknightxX24-Apr-19 8:10
XxKeldecknightxX24-Apr-19 8:10 
AnswerRe: Algorithm to compress Image to RGB565 for embedded screen Pin
Gerry Schmitz24-Apr-19 8:56
mveGerry Schmitz24-Apr-19 8:56 
GeneralRe: Algorithm to compress Image to RGB565 for embedded screen Pin
XxKeldecknightxX24-Apr-19 11:21
XxKeldecknightxX24-Apr-19 11:21 
QuestionGet all groups in 4x4 matrix with width and height of power 2 Pin
Member 142151775-Apr-19 6:59
Member 142151775-Apr-19 6:59 
There is 4x4 matrix type of bool (can be 0 or 1)
It looks like this e.g.:
(1)(1)(0)(0)
(1)(0)(0)(1)
(1)(0)(0)(1)
(1)(1)(0)(0)
That is input...
And output is list(array) of pairs of positions and that pair represents one area
for example
In first column there are four 1s, so it should return (0,0)&(0,3) (1x4)
After that step then it becomes:
[1](1)(0)(0)
[1](0)(0)(1)
[1](0)(0)(1)
[1](1)(0)(0)
that means that 1s are used
After that you can do (0,3)&(1,0) (it's 2x2)
And that means that group can pass over like it's folded paper(when iterating use i%4)
Also that means 1s that are used can be used again
[1][1](0)(0)
[1](0)(0)(1)
[1](0)(0)(1)
[1][1](0)(0)
And do that over and over until all 1s are used

There are rules:

  1. All 1s must be used
  2. Same 1s can be used more than once
  3. Width and height must be power of 2 (1,2,4)
    that means groups can be (1x1,2x1,1x2,2x2,4x2,2x4,4x1,1x4,4x4)
  4. Group can cross over border to get to the other side
    (like folded paper; 0 can be connected with 3 and vice versa)
  5. Logically number of areas should be minimum possible
  6. Area is defined by it's top left corner and it's bottom right corner
    (In form of point)
  7. Optional:
    The times one [1] is used more than once must be maximum possible


Output for this example:
(0,3)&(1,0)
(3,1)&(0,2)
Also output can be done with more areas but this is only using two and it's wanted solution

There is example of one interesting matrix:
(1)(0)(1)(1)
(1)(0)(1)(0)
(1)(0)(1)(0)
(1)(0)(1)(1)
Output:
(3,3)&(0,0)(that means that all 4 corners are included in one area)
(0,0)&(0,3)
(2,0)&(2,3)


Another:
(0)(1)(1)(1)
(0)(1)(0)(1)
(1)(1)(0)(1)
(0)(0)(0)(0)
Output:
(0,2)&(1,2)
(1,1)&(1,2)
(1,0)&(2,0)
(3,0)&(3,1)
(3,1)&(3,2)

Preferable languange is any C type (C C++ C#)
GeneralRe: Get all groups in 4x4 matrix with width and height of power 2 Pin
Richard MacCutchan5-Apr-19 8:51
mveRichard MacCutchan5-Apr-19 8:51 
GeneralRe: Get all groups in 4x4 matrix with width and height of power 2 Pin
Member 142151776-Apr-19 1:26
Member 142151776-Apr-19 1:26 
GeneralRe: Get all groups in 4x4 matrix with width and height of power 2 Pin
Richard MacCutchan6-Apr-19 4:32
mveRichard MacCutchan6-Apr-19 4:32 
GeneralRe: Get all groups in 4x4 matrix with width and height of power 2 Pin
Member 142151776-Apr-19 5:18
Member 142151776-Apr-19 5:18 
AnswerRe: Get all groups in 4x4 matrix with width and height of power 2 Pin
Gerry Schmitz6-Apr-19 10:13
mveGerry Schmitz6-Apr-19 10:13 
AnswerRe: Get all groups in 4x4 matrix with width and height of power 2 Pin
Daniel Pfeffer6-Apr-19 21:16
professionalDaniel Pfeffer6-Apr-19 21:16 
QuestionTracking Sales and returns. Pin
Member 1420060727-Mar-19 20:22
Member 1420060727-Mar-19 20:22 
QuestionHow to find a good algorithm to fill a dense grid? Pin
Member 141732236-Mar-19 4:36
Member 141732236-Mar-19 4:36 
QuestionHow to calculate the number of labels available on a roll Pin
Member 1409963724-Feb-19 20:10
Member 1409963724-Feb-19 20:10 
GeneralRe: How to calculate the number of labels available on a roll Pin
CHill6024-Feb-19 23:52
mveCHill6024-Feb-19 23:52 
QuestionSteiner tree formulation WITHOUT set of terminals as input Pin
Member 1415897621-Feb-19 21:17
Member 1415897621-Feb-19 21:17 
QuestionNeed an efficient algorithm to solve the following problem Pin
User 1411988416-Feb-19 0:11
User 1411988416-Feb-19 0:11 
AnswerRe: Need an efficient algorithm to solve the following problem Pin
Gerry Schmitz16-Feb-19 8:33
mveGerry Schmitz16-Feb-19 8:33 
QuestionHelp to predict the output of this code Pin
Member 141133789-Jan-19 12:39
Member 141133789-Jan-19 12:39 
AnswerRe: Help to predict the output of this code Pin
Daniel Pfeffer9-Jan-19 21:48
professionalDaniel Pfeffer9-Jan-19 21:48 
AnswerRe: Help to predict the output of this code Pin
ChrisFromWales1-May-19 0:14
ChrisFromWales1-May-19 0:14 
PraiseDinic’s algorithm for Maximum Flow Pin
AshishKhuraishy6-Dec-18 3:56
AshishKhuraishy6-Dec-18 3:56 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.