User Profile

Collapse

Profile Sidebar

Collapse
maNdy3
maNdy3
Last Activity: Dec 1 '15, 08:20 AM
Joined: Nov 16 '15
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • maNdy3
    replied to How to bubble sort 2d array?
    in PHP
    Seems like me and Deizi share the same assignments. Yes, it is necessary to bubble sort it as a whole.
    I`ve already done it the easy way - foreach to create a 1d array out of the 2d, then bubble sort, than array_chunk to make it 2d again.
    Now I`m trying to do it without changing it.
    Here is what I have so far :
    Code:
    $array = [
    		[5, 8, 7, 6],
    		[1, 15, 10, 9],
    		[2, 13, 3, 4],
    		[11, 16, 12, 14],
    ...
    See more | Go to post

    Leave a comment:


  • maNdy3
    replied to max sum of row and max sum of column 2d array
    in PHP
    Thank you! I hope I`ll stop making that stupid mistakes soon.
    See more | Go to post

    Leave a comment:


  • maNdy3
    replied to max sum of row and max sum of column 2d array
    in PHP
    Oh, God! Yes, now I see it, thank you so much! All I had to do is add a reset line before the inner loop... Thank you, thank you, thank you!
    See more | Go to post

    Leave a comment:


  • maNdy3
    replied to max sum of row and max sum of column 2d array
    in PHP
    Yes, I have tried this too...Both with a for and a foreach loop. But this way I get the sum of all elements (136). I can`t figure out what I`m missing, so that I can get the sum of every single row and col of the matrix.
    See more | Go to post

    Leave a comment:


  • maNdy3
    replied to max sum of row and max sum of column 2d array
    in PHP
    I`m actually trying to solve the same problem. I have some kind of a solution, I get the right answers, but it`s quite lame by my opinion... I`m sure there is a better (and shorter!!!) way :/

    Code:
    include_once 'readline.php';
    
    $array = array(
    	array(1, 2, 3, 4),
    		array(5, 6, 7, 8),
    		array(9, 10, 11, 12),
    		array(13, 14, 15, 16),
    );
    
    $rows = 4;
    $cols = 4;
    
    $sum = 0;
    ...
    See more | Go to post
    Last edited by Rabbit; Nov 16 '15, 11:10 PM. Reason: Please use [code] and [/code] tags when posting code or formatted data.

    Leave a comment:

No activity results to display
Show More
Working...