Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,154,615 members, 7,823,683 topics. Date: Friday, 10 May 2024 at 01:19 PM

Code Challenge [1]: Pseudo-code, C#, JAVA (apply Object Oriented Principles) - Programming (2) - Nairaland

Nairaland Forum / Science/Technology / Programming / Code Challenge [1]: Pseudo-code, C#, JAVA (apply Object Oriented Principles) (5579 Views)

Programming Challenge 1 (any Language). / . / Coding Challenge 1: Permutations (2) (3) (4)

(1) (2) (Reply) (Go Down)

Re: Code Challenge [1]: Pseudo-code, C#, JAVA (apply Object Oriented Principles) by jacob05(m): 7:07am On Jun 24, 2013
@authurowen what is my implementation not doing? Or should have done?
Re: Code Challenge [1]: Pseudo-code, C#, JAVA (apply Object Oriented Principles) by kambo(m): 7:35am On Jun 24, 2013
authurowen:

Good try. I took a quick glance at your code, didn't test it out but It can BETTER be refactored and Improved.
= No Need for the Abstract Class

=- I assume the array is balanced. not jagged and that all cells are filled with data.
This should not be a problem either as we wouldn't care a hoot what the array cells contain, but rather give more pressing concerns to the position of the Array index we are at to prevent getting an out of bound exception.


= There are a lot of unnecessaries in your code as well.

You'll have to be more explicit when you say "refactored and improved".
The abstract class ? not needed? guy u serious. This is the S.E way of writing this?
it's extensible and maintainable.
The unnecessaries ? okay. i'll admit 2 methods were overkill , but not a "lot of unnecessaries as you say".
the methods are - allset() - not necessary . i cant see any other that was un necessary.


anyway imagine this scenario.

List<matrixPrinters> list_of_printers ;

printMatrices()
//
addPrinter(matrixPrinter mp)
//adds a matrix printer to a class.

addPrinter(spiralPrinter sp);
addPrinter(columnPrinter mp);
addPrinter(skipPrinter sp);
//

printMatrices()
//calls all the matrice printers...

or this:

Create a class that prints a polygonal object in a particular way.

you could go short and write:

class polygon{
public void print(){}
}

later on you can add more codes to it.

or you can go long hand:

abstract class Shape{
public abstract void draw();
}
abstract class Polygon extends Shape{}

or more completely.
abstract class Polygon extends Shape{}

class Rect extends Polygon{} class Rhombos extends polygon,
class trapezoid extends polygon etc...

One is more professional and maintainable than the faster hacks.


without sufficient polymorphism - read: root class u'll have chaos.!!

Anyway-- i expect a more thorough critique.


".. give me the position of the array index to avoid getting an index out of bound exception "
This wont happen. The task is to print the array in spiral form - which is what the method does.
for explanation of what is going on i left comments in the printer method indicating
what printing is taking place.

"printing right most column," "printing bottom row " etc.

If the matrix isnt a square one - the printing function would necessarily be more complex
than if it wasnt. Thats why i state the implied assumption that a square matrix is assumed.

On the s.E aspect , at the risk of appearing defensive,
the norm is maintainability at the cost of a lil efficiency.
modularity. meaningfulness at the cost of a lil verbosity.
see java for example , System.out.println() against cout<<
cuz with one, there's lil need for re-explanation.

donald knuth - "software should be written to be read by humans and in some rare cases
to be executed by a computer .. " (paraphrase).
Anyway, compile the code and see if it does what u want. i tested it and it worked.

Thanks for the exercise anyway.
Re: Code Challenge [1]: Pseudo-code, C#, JAVA (apply Object Oriented Principles) by WhiZTiM(m): 7:50am On Jun 24, 2013
authurowen:
Brother, the solution is not as complicated as you have made it out to be. There is no need for the Mathematical / logical Gibberish (for lack of better words) you've just written.

The lay Programmers would find it very difficult to comprehend your theory (I didn't even bother to look at it my self - NO USE!!) Keep it simple, thats how you tell who an SE is.

No bro... its NOT about software engineering... My python solution is not an Optimal solution in terms of speed... but I made it expose simple grid transversing to anyone that cares to understand it!! ....and I thought its so that we could all learn something? Nonetheless,

HERE is my OPTIMAL CODE in C++: Its currently the FASTEST implementation I reasoned...
---this code is what I presume you may call 'software engineering'?.

//just feed it in with a 2D array of cstrings and sz the size of one dimension
void print(char*** A, int sz)
{
int i = 0, j = 0;
int k = 0, p = 0;
int n = 1;
long lim = sz * sz;
while(k < lim)
{
for(p = 0; p < sz; p++, k++, j++)
cout << A[i][j]; i++;
for(p = 0; p < (sz - n); p++, k++, i++)
cout << A[i][j]; j--;
for(p = 0; p < (sz - n); p++, k++, j--)
cout << A[i][j]; i--; sz -= 1;
for(p = 0; p < (sz - n); p++, k++, i--)
cout << A[i][j]; n += 1;
}
}

I would really love to see yours in shorter lines... so that I can learn.
I wouldn't bother explaining this snippet since my Python code was discarded....
BUT it works, if anyone wants, I could upload a working program.... cheers....
Re: Code Challenge [1]: Pseudo-code, C#, JAVA (apply Object Oriented Principles) by danmc: 9:21am On Jun 24, 2013
WhiZTiM: HERE is my OPTIMAL CODE in C++: Its currently the FASTEST implementation I reasoned...
---this code is what I presume you may call 'software engineering'?.
//just feed it in with a 2D array of cstrings and sz the size of one dimension
man, u can't just copy and paste some portion of ur code and tell us to feed it with blah blah blah. it compiled fine but couldn't run it. crash!!! i beg check ur algo well and pls show us a working proggie.
Re: Code Challenge [1]: Pseudo-code, C#, JAVA (apply Object Oriented Principles) by WhiZTiM(m): 2:27pm On Jun 24, 2013
danmc:
man, u can't just copy and paste some portion of ur code and tell us to feed it with blah blah blah. it compiled fine but couldn't run it. crash!!! i beg check ur algo well and pls show us a working proggie.
Hmmn...(I wrote that snippet from my mobile)
Ohhkkkay pal... I'll post a working program...
Re: Code Challenge [1]: Pseudo-code, C#, JAVA (apply Object Oriented Principles) by WhiZTiM(m): 2:32pm On Jun 24, 2013
Here is a closely coupled working program that solves authurowens problem.
Its only 30lines;... I could explain the code and make the it more readable on anybody's request... so ask if you wanna understand grin....
NB: I made slight modification to the initially rough snippet I wrote from my mobile phone...
#EDIT... k value overshoot...FIXED

#include <iostream>
#include <string>
#include <sstream>
#include <vector>
using namespace std;
int main(int argc, char* argv[])
{
string line; vector<string> v;
getline(cin, line);
stringstream ss(line);
while(ss >> line)
v.push_back(line); int sz = v.size();
string A[sz][sz];
for(int i(0); i<v.size(); i++)
A[0][i] = v[i];
for(int i(1); i<sz; i++)
for(int j(0); j<sz; j++)
cin >> A[i][j];
cout << endl << endl;
int i = 0, j = 0, k = 0, p = 0, n =1;
long lim = sz * sz;
while(k < lim)
{
for(p = 0; p < sz; p++){ cout << A[i][j] << " "; k++; j++; } i++; --j;
for(p = 0; p < (sz - n); p++){ cout << A[i][j] << " "; k++; i++; } j--; --i;
for(p = 0; p < (sz - n); p++){ cout << A[i][j] << " "; k++; j--; } i--; j++; sz -= 1;
for(p = 0; p < (sz - n); p++){ cout << A[i][j] << " "; k++; i--; } i++; j++; sz -= 1;
} cout << endl;
return 0;
}

USage: all inputs are via stdin so that input values can be entered manually or by piping a file into the program....
**Input must be guaranteed to be a square matrix!
**my code automatically determines the size of the grid from the first line.
- - - My algorithm here is pretty simple.
- - Also, try to understand my Python code, you may learn a few lazy-man's tricks...
Re: Code Challenge [1]: Pseudo-code, C#, JAVA (apply Object Oriented Principles) by danmc: 5:22pm On Jun 24, 2013
WhiZTiM: Here is a closely coupled working program that solves authurowens problem.
Its only 30lines;... I could explain the code and make the it more readable on anybody's request... so ask if you wanna understand grin....
NB: I made slight modification to the initially rough snippet I wrote from my mobile phone...
tanx boss for the proggie but it still isn't perfect yet. try inputting a 3x3 matrix e.g. "1 2 3", "4 5 6" and "7 8 9". the output misses the last item in the spiral i.e. "5"! pls fix it grin
Re: Code Challenge [1]: Pseudo-code, C#, JAVA (apply Object Oriented Principles) by jacob05(m): 5:47pm On Jun 24, 2013
:/ @danmc
jacob05: @authurowen what is my implementation not doing? Or should have done?
Re: Code Challenge [1]: Pseudo-code, C#, JAVA (apply Object Oriented Principles) by WhiZTiM(m): 5:47pm On Jun 24, 2013
danmc:
tanx boss for the proggie but it still isn't perfect yet. try inputting a 3x3 matrix e.g. "1 2 3", "4 5 6" and "7 8 9". the output misses the last item in the spiral i.e. "5"! pls fix it grin
. . .lol!... Thanks man. You are following very well sir!.... Err, my bros... If you cared to check out the logical part, you would have noticed that there was an overshoot with 'k'... THE FIX IS SIMPLE: REMOVE THE LAST "k++;" that is at the very end of the line in the last for loop...
Re: Code Challenge [1]: Pseudo-code, C#, JAVA (apply Object Oriented Principles) by WhiZTiM(m): 6:29pm On Jun 24, 2013
@danmc. I have removed the last k++;... So try that code again...

The algorithm can be implemented recursively to further beat down the SLoC by a meagre factor...

@authurowen... I don't really believe in writing programs alone and calling myself a software engineer. . . . I inherently mean, I wouldnt call myself a Software Engineer. But rather a Software Engineering hobbyist....
Re: Code Challenge [1]: Pseudo-code, C#, JAVA (apply Object Oriented Principles) by danmc: 9:20pm On Jun 24, 2013
WhiZTiM: The algorithm can be implemented recursively to further beat down the SLoC by a meagre factor...
i removed it like u said and now it works well. just to quote linus torvalds: "talk is cheap. show me the code", pls implement what u just said. i'd love to see it.
Re: Code Challenge [1]: Pseudo-code, C#, JAVA (apply Object Oriented Principles) by WhiZTiM(m): 10:34pm On Jun 24, 2013
danmc:
i removed it like u said and now it works well. just to quote linus torvalds: "talk is cheap. show me the code", pls implement what u just said. i'd love to see it.
like seriously bro??!!
You are trying to put me to a show using Torvald's qoute... ...not cool.
Nope. I would NOT implement it....
Nonetheless, the version I did, has 4 for loops to transverse in 4 directions. My thought to the recursive version is to have a function with several control args, transverse in only 2 directions or one preferential direction... While subsequent calls recursively controls the rest of the direction... C'mon, not everything will be given to you... think!! Haba Oga danmc At The Top!...
Though... As for me... I have a knack for Robotics and Control Systems...
Re: Code Challenge [1]: Pseudo-code, C#, JAVA (apply Object Oriented Principles) by kambo(m): 2:07am On Jun 25, 2013
Anoda passve poster in d programmg room.
He shud ,provde his own implementation, justifyg his design choices, for all to see and possibly learn from not just vanish into thin air after postg a Q.
Re: Code Challenge [1]: Pseudo-code, C#, JAVA (apply Object Oriented Principles) by jacob05(m): 2:44pm On Jun 25, 2013
kambo: Anoda passve poster in d programmg room.
He shud ,provde his own implementation, justifyg his design choices, for all to see and possibly learn from not just vanish into thin air after postg a Q.
Seconded undecided
Re: Code Challenge [1]: Pseudo-code, C#, JAVA (apply Object Oriented Principles) by jacob05(m): 2:51pm On Jun 25, 2013
But I'm greatly concerned about what is wrong with my implementation.(PHP)
Re: Code Challenge [1]: Pseudo-code, C#, JAVA (apply Object Oriented Principles) by WhiZTiM(m): 4:07pm On Jun 25, 2013
kambo: Anoda passve poster in d programmg room.
He shud ,provde his own implementation, justifyg his design choices, for all to see and possibly learn from not just vanish into thin air after postg a Q.
already seconded, thus, I am
Third in line!
Re: Code Challenge [1]: Pseudo-code, C#, JAVA (apply Object Oriented Principles) by authurowen(m): 4:52pm On Jun 25, 2013
WhiZTiM:
already seconded, thus, I am
Third in line!

Sorry guys, I went quiet for a while (Got caught up).

I will provide my own implementation so you all can criticize as much as you want (we're all here to learn). I'll give one more day for others to post their solution and then post mine.

Mine should be up by Wednesday.
Re: Code Challenge [1]: Pseudo-code, C#, JAVA (apply Object Oriented Principles) by authurowen(m): 6:50pm On Jun 26, 2013
Find below, my Implementation to the print spiral Question written in JAVA (There is very little difference btween C# and Java so C# Developers will be able to relate to it).

Pls Criticize to the very lowest details as much as you please.

public class PrintSpiral
{
private Object[][] matrix;

final int VERTICAL_UP = 0;
final int VERTICAL_DOWN = 1;
final int HORIZONTAL_LEFT = 2;
final int HORIZONTAL_RIGHT = 3;


public PrintSpiral(Object[][] matrix)
{
setMatrix(matrix);
}

/**
* Method to return a string representation of the matrix,
* traversing it in a spiral movement.
*
* @return spiral string representation of the matrix
*/
public String toSpiral()
{
int top, left;
top = left = 0;

int bottom, right;
bottom = right = matrixIsEmpty()? -1 : matrix.length -1;

return (matrix != null && matrix.length > 0) ? toSpiralHelper(left, right, top, bottom, HORIZONTAL_RIGHT) : "";
}

// Recursive method
// Logic here
// =============
// In a wider view, to traverse the matrix sprirally would visually mean
// -------->
// ------> |
// ||---> ||
// |<-----||
// <--------
//

/***
* @pre: Left <= Right & Top <= Bottom
* @Post: Left >= Right & Top >= Bottom
*/
private String toSpiralHelper(int top, int bottom, int left, int right, int direction)
{
StringBuilder b = new StringBuilder();


if(direction == HORIZONTAL_RIGHT && left <= right)
{
b.append(printForward(top, left, right));
top += 1;
b.append(toSpiralHelper(top, bottom, left, right, VERTICAL_DOWN));
}

if(direction == HORIZONTAL_LEFT && left <= right)
{
b.append(printReverse(bottom, left, right));
bottom -= 1;
b.append(toSpiralHelper(top, bottom, left, right, VERTICAL_UP));
}

if(direction == VERTICAL_DOWN && top <= bottom)
{
b.append(printDownwards(right, top, bottom));
right -= 1;
b.append(toSpiralHelper(top, bottom, left, right, HORIZONTAL_LEFT));
}

if(direction == VERTICAL_UP && top <= bottom)
{
b.append(printUpwards(left, top, bottom));
left += 1;
b.append(toSpiralHelper(top, bottom, left, right, HORIZONTAL_RIGHT));
}

//
// At this point, We should have gone through the matrix and
// stored every item (from the matrix) in the string builder.
//

return b.toString();
}

// Spit out contents of the matrix
public String toString()
{
StringBuilder b = new StringBuilder();

for(int i=0; i < matrix.length; i++)
{
for(int j=0; j < matrix.length; j++)
{
b.append(matrix[i][j]);

if(j+1 < matrix.length)
b.append(" "wink;
}
b.append("\n"wink;
}

return b.toString();
}

//
// PRINTERS
// =====================
private String printForward(int row, int startIndex, int endIndex)
{
StringBuilder b = new StringBuilder();

for(int i=startIndex; i <= endIndex; i++)
{
b.append(matrix[row][i]);
b.append(" "wink;
}

return b.toString();
}

private String printReverse(int row, int startIndex, int endIndex)
{
StringBuilder b = new StringBuilder();

for(int i=endIndex; i >= startIndex; i--)
{
b.append(matrix[row][i]);
b.append(" "wink;
}

return b.toString();
}


private String printDownwards(int col, int startIndex, int endIndex)
{
StringBuilder b = new StringBuilder();

for(int i=startIndex; i <= endIndex; i++)
{
b.append(matrix[i][col]);
b.append(" "wink;
}

return b.toString();
}


private String printUpwards(int col, int startIndex, int endIndex)
{
StringBuilder b = new StringBuilder();

for(int i=endIndex; i >= startIndex; i--)
{
b.append(matrix[i][col]);
b.append(" "wink;
}

return b.toString();
}

//
// ACCESSORS & MUTATORS
//

/**
* @param matrix Matrix to Set
*/
public void setMatrix(Object[][] matrix)
{
this.matrix = matrix;
}

public Object[][] getMatrix()
{
return this.matrix;
}

public boolean matrixIsEmpty()
{
return this.matrix == null || this.matrix.length == 0;
}
}


Test Code Fragments written in Java

public static void main(String[] args)
{
//
// Positive Unit test case for the PrintSpiral Class.
// Provide the class with a 5 x 5 Matrix, from 1 to 25
// Class.toSpiral should return 1 2 3 4 5 6 7 8 .... 20 21 22 23 24 25
//

Integer[][] x = new Integer[5][5];

x[0][0] = 1; x[0][1] = 2; x[0][2] = 3; x[0][3] = 4; x[0][4] = 5;
x[1][0] = 16; x[1][1] = 17; x[1][2] = 18; x[1][3] = 19; x[1][4] = 6;
x[2][0] = 15; x[2][1] = 24; x[2][2] = 25; x[2][3] = 20; x[2][4] = 7;
x[3][0] = 14; x[3][1] = 23; x[3][2] = 22; x[3][3] = 21; x[3][4] = 8;
x[4][0] = 13; x[4][1] = 12; x[4][2] = 11; x[4][3] = 10; x[4][4] = 9;

PrintSpiral p = new PrintSpiral(x);
System.out.println("Positive UNIT TEST CASE 1:"wink;
System.out.println("============================="wink;
System.out.printf("Length of Matrix: \n%d x %d\n\n",x.length, x[0].length);
System.out.printf("Matrix Representation: \n%s\n", p.toString());
System.out.printf("Spiral Representation: \n%s\n\n\n", p.toSpiral());


// Test 2

Object[][] y = new Object[4][4];

y[0][0] = 'R'; y[0][1] = 'W'; y[0][2] = 'Q'; y[0][3] = 'F';
y[1][0] = '6'; y[1][1] = 'P'; y[1][2] = 'E'; y[1][3] = 'G';
y[2][0] = 'D'; y[2][1] = 'J'; y[2][2] = 'L'; y[2][3] = 'V';
y[3][0] = 'Z'; y[3][1] = "31"; y[3][2] = 'K'; y[3][3] = '1';

p = new PrintSpiral(y);
System.out.println("Positive UNIT TEST CASE 2:"wink;
System.out.println("============================"wink;
System.out.printf("Length of Matrix: \n%d x %d\n\n",y.length, y[0].length);
System.out.printf("Matrix Representation: \n%s\n", p.toString());
System.out.printf("Spiral Representation: \n%s", p.toSpiral());
}



Test Output:

Positive UNIT TEST CASE 1:
=============================
Length of Matrix:
5 x 5

Matrix Representation:
1 2 3 4 5
16 17 18 19 6
15 24 25 20 7
14 23 22 21 8
13 12 11 10 9

Spiral Representation:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25


Positive UNIT TEST CASE 2:
============================
Length of Matrix:
4 x 4

Matrix Representation:
R W Q F
6 P E G
D J L V
Z 31 K 1

Spiral Representation:
R W Q F G V 1 K 31 Z D 6 P E L J
Re: Code Challenge [1]: Pseudo-code, C#, JAVA (apply Object Oriented Principles) by authurowen(m): 6:51pm On Jun 26, 2013
Be on the look out for the second part of the programming questions. I will open another thread for it.

Thanks for participating
Re: Code Challenge [1]: Pseudo-code, C#, JAVA (apply Object Oriented Principles) by jacob05(m): 7:10pm On Jun 26, 2013
@authurowen and how is your algo different from mine undecided.
Re: Code Challenge [1]: Pseudo-code, C#, JAVA (apply Object Oriented Principles) by authurowen(m): 9:21pm On Jun 26, 2013
jacob05: @authurowen and how is your algo different from mine undecided.

Jacob, you are a developer. Can you take a closer look at your implementation and mine and see the difference?

Also try parsing the other test case i provided in my solution to your own solution and see what it returns.
secondly, Using your algorithm (which is wrong) after you're done printing the array, Your Master Array It will become empty (at a quick glance)
Re: Code Challenge [1]: Pseudo-code, C#, JAVA (apply Object Oriented Principles) by WhiZTiM(m): 2:38am On Jun 27, 2013
authurowen: Find below, my Implementation to the print spiral Question written in JAVA (There is very little difference btween C# and Java so C# Developers will be able to relate to it).

Pls Criticize to the very lowest details as much as you please.
[code]
Its TOTALLY not my pleasure to criticize your code...
I hate critics and I hate to criticize...

I am going to criticize you from an Engineering POV.. on the fact that you used the Phrase in your original Post.
N.B: Be Genuine in your solutions, Real S.E(s) are.

That phrase annoyed me so much. . .
Like I said, I don't call myself a Software Engineer... I rather consider myself a Software Engineering hobbyist...

ANYWAY... my small review
NB: Your code is ACCEPTABLE for this exact problem in a very localized manner
Also NOTE: I am Not a Java Programmer

1
I thought I was a Sappy Programmer when it comes to OOP skills and patterns until I saw what you called OOP....
I am No Java Programmer but IMHO, Your code is NOT close to being truly OOP:::

You used Objects... why not have the algorithm generic for a Matrix of objects...
in a generalist perspective... having all this in One object is a flawed design!
Advice:: SOMETIMES, write bloated/insane codes to learn something against tomorrow... but write tight, solid, highly efficient(and probably localized) codes for production;
"This code is acceptable for tight conditions like time constraints, etc"
Localized implementations are always usually fastest and efficient for any problem.
Broadened implementations are costly, but if and only if done well, You'll never regret doing it

2
If I ask you of these, you'll need way too much modification::
*The Inputed Array are NOT strings, but objects with features on a grid... Print them out in spiral form
*the ARRAY is NOT a Square Matrix.. but print it in a deterministic manner as defined by some rules.
*Print the array in
---- reverse manner starting from the center
---- Anticlockwise manner;
---- Spiral manner skipping some things... I need a callback for each element you are on... and this callback determines whether you should print the next item or not...
ADVICE (2): stop hardcoding your test-run inputs... except for real testing.

NB: "SUBJECTIVELY" Rough benchmark...
---The algorithm will be rated on the scale of 1 to 10.. 10 is best:
Comprehension: 9
Generalization(Generic): 2
Need to Modify for other purpose: 1
Speed: 7
Memory on small input: 7
memory on large input: 1
Defense to Offense ratio: 5

That's good

GOOD THINGS:
Your algorithm is pretty descent and really easy to comprehend... good one, I loved it...
---the use of printing functions was a good and future-proof idea...
---Recursion is pretty good here... NB: When dealing with Matrix data that might be large... prefer iterative algorithms over recursive algorithms. ...Stop stacking up memory
---You have good approach to keeping things simple

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Re: Code Challenge [1]: Pseudo-code, C#, JAVA (apply Object Oriented Principles) by WhiZTiM(m): 2:42am On Jun 27, 2013
Here is a third Solution from me....
Very bloated and fun to grasp.....

Not about professionalism, but writing and drafting out toy algorithms with respect to tomorrow(no matter how stupid) pays off.... err(Don't make it too stupid though))) ...lol.

I had several choices of algorthim, some, as short as my 7lines C++ algorithm version... and a recursive 6line version...
BUT having 3 solutions should hopefully pass something to someone out there... I have other problems I am solving... again its for my to figure out somestuff...

This solution is presented in C#.... partially 'generalistic'... Again, I make no use of optimally localized algorithm... just some very very basic stuff on grid travellers...

NB: "SUBJECTIVELY" Rough benchmark for my C# code...
---The algorithm will be rated on the scale of 1 to 10.. 10 is best:
Comprehension: 4
Generalization(Generic): 8
Need to Modify for other purpose: 7
Speed: 5
Memory on small input: 7
memory on large input: 7
Defense to Offense ratio: 2


NB: "SUBJECTIVELY" Rough benchmark for my C++ code...
---The algorithm will be rated on the scale of 1 to 10.. 10 is best:
Comprehension: 7
Generalization(Generic): 2
Need to Modify for other purpose: 4
Speed: 10
Memory on small input: 10
memory on large input: 10
Defense to Offense ratio: 6
Re: Code Challenge [1]: Pseudo-code, C#, JAVA (apply Object Oriented Principles) by WhiZTiM(m): 2:52am On Jun 27, 2013
Here is the link ...http://pastebin.com/GAK00hF8

C#4.0 or later

........ Notice the class Program.. where the Main() function resides...
look into the Main... that is how you should build up things in OOP;;;

Again... this uses standard input.. (stdin) for input...

@everyone: Please Criticize my code also... especially the C# PROFESSIONALS... who know any specifics of C# that I am not harnessing


/* (2D) Finite Matrix - transverser
* ---incooperated a Spiral Matrix Printer
*
* (C) WhiZTiM 27th June, 2013
* FOR EDUCATIONAL PURPOSES only!
*/
using System;

namespace SP
{
//2D Coordinate...
public struct Coord
{
public int X { get; set; }
public int Y { get; set; }
}

//make a prepaid contract for element types
public abstract class Element
{
protected bool _taken { get; set; }
public void setTaken(bool value) { _taken = value; }
public bool isTaken() { return _taken; }
}

//String elements
public class StringElement : Element
{
private readonly string _value;

public StringElement(string value) : base()
{
_value = value;
}
public string str() { return _value; }
}

//A thin wrapper for StringElements
public class Spiral_Array
{
private readonly StringElement[,] _array;
public Spiral_Array (StringElement[,] elements)
{
_array = elements;
sizeX = _array.GetLength(0);
sizeY = _array.GetLength(1);
}
public StringElement this[int x, int y]
{ get{ return _array[x,y]; }
private set { /* */ }
}
public int sizeX{ get; private set; }
public int sizeY{ get; private set; }
}

//This is a helper class that creates 2D 'Element' Objects from a string array
public class Helper_2D_Elements
{
public StringElement[,] Elements {get; private set; }
public Helper_2D_Elements(string[] array)
{
int arrSize = array.Length;

Elements = new StringElement[arrSize,arrSize];

for(int i = 0; i < arrSize; i++)
{
string[] str = array[i].Split(' ');
for(int j = 0; j < arrSize; j++)
{
Elements[i,j] = new StringElement(str[j]);
}
}
}
}

//this is an independent traveller object...
/*
* It takes a finite grid of size (0,0) to (X, Y)
* transverses through it in very definite direction
* and only passes through a point once!
*/
public class Element_Traveller2D
{
public enum Direction : int { Right, Down, Left, Up }
public enum SweepDirection { Clockwise, Aniclockwise }
private Coord _coord;
private readonly int LimX, LimY;
private readonly long _max;
private bool[,] _taken;
private long _taken_count;
private int _preference;
private bool _first;
private SweepDirection _sweep;
public Element_Traveller2D(int X, int Y, SweepDirection sweep, Direction startingAt)
{
LimX = X; LimY = Y;
_coord = new Coord{ X = 0, Y = 0 }; //defaults to 0,0
_taken = new bool[X,Y]; //defaults to false
_first = true;
_max = X * Y;
_taken_count = 0;
_preference = (int) startingAt;
_sweep = sweep;
}

private void changeDir()
{
if(_sweep == SweepDirection.Clockwise)
{ _preference = (++_preference) % 4; }
else
{ _preference = (--_preference) % 4; }
}

public Coord nextPoint()
{
if(_first){
_taken[0,0] = true;
_taken_count++;
_first = false;
return _coord;
}
for(int _a = 0; _a < 4; _a++) {
switch (_preference) {
case 0:
if(_coord.Y + 1 < LimY && !_taken[_coord.X, _coord.Y + 1])
{
_coord.Y += 1; _taken_count++;
_taken[_coord.X, _coord.Y] = true;
return _coord;
}
changeDir();
break;
case 1:
if(_coord.X + 1 < LimX && !_taken[_coord.X + 1, _coord.Y])
{
_coord.X += 1; _taken_count++;
_taken[_coord.X, _coord.Y] = true;
return _coord;
}
changeDir();
break;
case 2:
if(_coord.Y - 1 >= 0 && !_taken[_coord.X, _coord.Y - 1])
{
_coord.Y -= 1; _taken_count++;
_taken[_coord.X, _coord.Y] = true;
return _coord;
}
changeDir();
break;
case 3:
if(_coord.X - 1 >= 0 && !_taken[_coord.X - 1, _coord.Y])
{
_coord.X -= 1; _taken_count++;
_taken[_coord.X, _coord.Y] = true;
return _coord;
}
changeDir();
break;
default:
changeDir();
break;
}
}
_taken_count = _max;
return new Coord();
}

public bool canMove()
{
return (_taken_count < _max);
}
}

/* This class is responsible for instantiating the Traveller object
* and transverse through the grid... while printing it
* */
public class Spiral_Printer
{
private readonly Spiral_Array _value;
private readonly Element_Traveller2D traveller;
public Spiral_Printer(Spiral_Array array)
{
_value = array;
traveller = new Element_Traveller2D( _value.sizeX, _value.sizeY,
Element_Traveller2D.SweepDirection.Clockwise, Element_Traveller2D.Direction.Right );
}

public void Print()
{
while(traveller.canMove())
{
Coord dim = traveller.nextPoint();
Console.Write("{0} ", _value[dim.X, dim.Y].str());
}
}
}


public class Program
{
public static void Main(string[] args)
{
Program prog = new Program();
//read inputs
string[] values = prog.readInput();
if(string.IsNullOrEmpty(values[0]))
{
Console.WriteLine("ID10T!"wink;
return;
}

//create an array of string elements
Helper_2D_Elements elements = new Helper_2D_Elements(values);

//create the Spiral Array class
Spiral_Array spiral = new Spiral_Array(elements.Elements);

//Create a printer
Spiral_Printer printer = new Spiral_Printer(spiral);
printer.Print();
}

string[] readInput()
{
string str = Console.ReadLine();
if(string.IsNullOrEmpty(str) || string.IsNullOrWhiteSpace(str) ) {
Console.WriteLine("Invalid input Numbnuts"wink;
return null;
}
string[] arrCount = str.Split(' ');
int arrSize = arrCount.Length;
string[] StrList = new string[arrSize];
StrList[0] = str;
for(int i = 1; i < arrSize; i++)
{
str = Console.ReadLine();
StrList[i] = str;
}
return StrList;
}
}
}
Re: Code Challenge [1]: Pseudo-code, C#, JAVA (apply Object Oriented Principles) by kambo(m): 4:02am On Jun 27, 2013
authurowen: Find below, my Implementation to the print spiral Question written in JAVA (There is very little difference btween C# and Java so C# Developers will be able to relate to it).

Pls Criticize to the very lowest details as much as you please.

public class PrintSpiral
{
private Object[][] matrix;

final int VERTICAL_UP = 0;
final int VERTICAL_DOWN = 1;
final int HORIZONTAL_LEFT = 2;
final int HORIZONTAL_RIGHT = 3;


public PrintSpiral(Object[][] matrix)
{
setMatrix(matrix);
}

/**
* Method to return a string representation of the matrix,
* traversing it in a spiral movement.
*
* @return spiral string representation of the matrix
*/
public String toSpiral()
{
int top, left;
top = left = 0;

int bottom, right;
bottom = right = matrixIsEmpty()? -1 : matrix.length -1;

return (matrix != null && matrix.length > 0) ? toSpiralHelper(left, right, top, bottom, HORIZONTAL_RIGHT) : "";
}

// Recursive method
// Logic here
// =============
// In a wider view, to traverse the matrix sprirally would visually mean
// -------->
// ------> |
// ||---> ||
// |<-----||
// <--------
//

/***
* @pre: Left <= Right & Top <= Bottom
* @Post: Left >= Right & Top >= Bottom
*/
private String toSpiralHelper(int top, int bottom, int left, int right, int direction)
{
StringBuilder b = new StringBuilder();


if(direction == HORIZONTAL_RIGHT && left <= right)
{
b.append(printForward(top, left, right));
top += 1;
b.append(toSpiralHelper(top, bottom, left, right, VERTICAL_DOWN));
}

if(direction == HORIZONTAL_LEFT && left <= right)
{
b.append(printReverse(bottom, left, right));
bottom -= 1;
b.append(toSpiralHelper(top, bottom, left, right, VERTICAL_UP));
}

if(direction == VERTICAL_DOWN && top <= bottom)
{
b.append(printDownwards(right, top, bottom));
right -= 1;
b.append(toSpiralHelper(top, bottom, left, right, HORIZONTAL_LEFT));
}

if(direction == VERTICAL_UP && top <= bottom)
{
b.append(printUpwards(left, top, bottom));
left += 1;
b.append(toSpiralHelper(top, bottom, left, right, HORIZONTAL_RIGHT));
}

//
// At this point, We should have gone through the matrix and
// stored every item (from the matrix) in the string builder.
//

return b.toString();
}

// Spit out contents of the matrix
public String toString()
{
StringBuilder b = new StringBuilder();

for(int i=0; i < matrix.length; i++)
{
for(int j=0; j < matrix.length; j++)
{
b.append(matrix[i][j]);

if(j+1 < matrix.length)
b.append(" "wink;
}
b.append("\n"wink;
}

return b.toString();
}

//
// PRINTERS
// =====================
private String printForward(int row, int startIndex, int endIndex)
{
StringBuilder b = new StringBuilder();

for(int i=startIndex; i <= endIndex; i++)
{
b.append(matrix[row][i]);
b.append(" "wink;
}

return b.toString();
}

private String printReverse(int row, int startIndex, int endIndex)
{
StringBuilder b = new StringBuilder();

for(int i=endIndex; i >= startIndex; i--)
{
b.append(matrix[row][i]);
b.append(" "wink;
}

return b.toString();
}


private String printDownwards(int col, int startIndex, int endIndex)
{
StringBuilder b = new StringBuilder();

for(int i=startIndex; i <= endIndex; i++)
{
b.append(matrix[i][col]);
b.append(" "wink;
}

return b.toString();
}


private String printUpwards(int col, int startIndex, int endIndex)
{
StringBuilder b = new StringBuilder();

for(int i=endIndex; i >= startIndex; i--)
{
b.append(matrix[i][col]);
b.append(" "wink;
}

return b.toString();
}

//
// ACCESSORS & MUTATORS
//

/**
* @param matrix Matrix to Set
*/
public void setMatrix(Object[][] matrix)
{
this.matrix = matrix;
}

public Object[][] getMatrix()
{
return this.matrix;
}

public boolean matrixIsEmpty()
{
return this.matrix == null || this.matrix.length == 0;
}
}


Test Code Fragments written in Java

public static void main(String[] args)
{
//
// Positive Unit test case for the PrintSpiral Class.
// Provide the class with a 5 x 5 Matrix, from 1 to 25
// Class.toSpiral should return 1 2 3 4 5 6 7 8 .... 20 21 22 23 24 25
//

Integer[][] x = new Integer[5][5];

x[0][0] = 1; x[0][1] = 2; x[0][2] = 3; x[0][3] = 4; x[0][4] = 5;
x[1][0] = 16; x[1][1] = 17; x[1][2] = 18; x[1][3] = 19; x[1][4] = 6;
x[2][0] = 15; x[2][1] = 24; x[2][2] = 25; x[2][3] = 20; x[2][4] = 7;
x[3][0] = 14; x[3][1] = 23; x[3][2] = 22; x[3][3] = 21; x[3][4] = 8;
x[4][0] = 13; x[4][1] = 12; x[4][2] = 11; x[4][3] = 10; x[4][4] = 9;

PrintSpiral p = new PrintSpiral(x);
System.out.println("Positive UNIT TEST CASE 1:"wink;
System.out.println("============================="wink;
System.out.printf("Length of Matrix: \n%d x %d\n\n",x.length, x[0].length);
System.out.printf("Matrix Representation: \n%s\n", p.toString());
System.out.printf("Spiral Representation: \n%s\n\n\n", p.toSpiral());


// Test 2

Object[][] y = new Object[4][4];

y[0][0] = 'R'; y[0][1] = 'W'; y[0][2] = 'Q'; y[0][3] = 'F';
y[1][0] = '6'; y[1][1] = 'P'; y[1][2] = 'E'; y[1][3] = 'G';
y[2][0] = 'D'; y[2][1] = 'J'; y[2][2] = 'L'; y[2][3] = 'V';
y[3][0] = 'Z'; y[3][1] = "31"; y[3][2] = 'K'; y[3][3] = '1';

p = new PrintSpiral(y);
System.out.println("Positive UNIT TEST CASE 2:"wink;
System.out.println("============================"wink;
System.out.printf("Length of Matrix: \n%d x %d\n\n",y.length, y[0].length);
System.out.printf("Matrix Representation: \n%s\n", p.toString());
System.out.printf("Spiral Representation: \n%s", p.toSpiral());
}



Test Output:

Positive UNIT TEST CASE 1:
=============================
Length of Matrix:
5 x 5

Matrix Representation:
1 2 3 4 5
16 17 18 19 6
15 24 25 20 7
14 23 22 21 8
13 12 11 10 9

Spiral Representation:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25


Positive UNIT TEST CASE 2:
============================
Length of Matrix:
4 x 4

Matrix Representation:
R W Q F
6 P E G
D J L V
Z 31 K 1

Spiral Representation:
R W Q F G V 1 K 31 Z D 6 P E L J


critiquing your code:


s.e code defensively.
>> case:
imagine this scenerio.

Object[][] matrix = new Object[x][y];
matrix[0][1]= new HashTable();
matrix[0][2]= new File("/.."wink;
matrix[0][3]= new String(""wink;//etc...

silly, yes - but possible on your code!!! or generic codes like that!!.

preferred :
Number[][] matrix = new Number[][]
or
Char[][] matrix = new Character[][]

2.)
jagged arrays cripple the algorithm.

case:

Integer[][] matrix = new Integer[x];

for(int u=0;u<matrix.length;u++)
matrix[u]=new Integer[Math.random()*u];//set different array sub lengths!!!
cud thoroughly mess up the algorithm.

Such abuse can be injected into undefensive code.

3.)
PrintMatrix(Object[][] obj)

abusive case:
PrintMatrix prm = new PrintMatrix(null);//oops - wrong arg

or : obj[][] = new obj{{}};//empty matrix.
printMatrix(obj);// wrong args --
defensive leaks ..


-->(1)
(x,y)
(4) [][][][][]
^[] [] |
(4)|[] [] v
|[][][][][](2)
(3)<--

Essentially this is what the app does.
take a matrix, traverse it in the following order
and all the app needs for traversal is to set
the values of x and y.
x = x axis (column indexes)
y = y axis (row indexes)

Recursion is calling the print matrix on smaller and smaller
matrixes . (within the main matrix)

Your methods take 5 arguments - thats readable but

performance wise wasteful.
see this.
all a printer methods needs to know is how to print ,in one

of 4 directions.
where to start and where to stop (2 arguments, and how to

print making a total of 3 arguments only)
5 argument print methods is overkill. though most coders

would use this.
for simplicity this is the print argument required.

print(x,y,Direction);

in my code i didnt bother specifying the direction attribute,
but using a shortened printArgument .
print(x,y). all the direction was done by changing pointer

values in the print method - .

but to be even more efficient - the Direction attribute is

not needed.
The print happens in a fixed order - like.
A-B-C-D.
left-right)/down/right-left/up.

so every print function to completely print its matrix will,
do so in the following order-

e.g
print(x,y)
{

//print left to right
//codes go here.

print up to down
//codes go here
print right to left
//...
print down to up.

// call itself again. recourse
print(modified-x,modified-y);
}

this print function is faster, uses less arguments
and is more complete - since the printing pattern is all the

same.


the printing logic:
for a square matrix. the right to left printing
will require - a start index(x), and a stop point(y)
the stop point will be the maximum index of the first row.

e.g at first print on a 5 by 5 matrix,
x=0,y=(length-1) = 4.

the printing
int ptr=x;
for(;ptr<=y;ptr++)
print/store (matrix[x][ptr]);//


When the first cycle of printng is over - .
the recursion is about to occur-
the submatrix will be the inner matrix within the outer

block.
and it will start at x+1,y-1;
so the start point will be x+1, and the maxindex for

right-to-left for the inner matrix willbe y-1.

therefore recursion will be
print(x+1,y-1).

this is all the work needed to print the matrixes.

but as recursion keeps occuring,
an interesting phenomena arises.
x+1,y-1 , will eventually make the arguments of print(x,y)
either equal to each other : x==y , for odd dimension

matrixes,
or x will surpass y , for even dimension matrixes.

this phenomena has to be cartered for, in the print function.

so
print(x,y)
{

// do all the print up /down/left/etc..
// check states of x ,y befor recoursing..
// alter the x,y in anticipation of recursing
// check states of x,y b4 recursing to prevent index

exceptions
if(x==y)// in the innermost cell of the matrix. print out out

and exit.
if(x==y) print(matrix[x][y]);/exit/return

else
if(x>y) // even matrix size all cells have been printed .

return

else
{
// its okay to recurse
print(modified-x,modified-y);
}
}

Essentially this is what i did when i solved this problem in

my code...
but your code is more readable but will run slower on a

machine due to the overheads..

>> unnecessary -: creating a stringBuilder object in every
printMethod.
to save the overhead,
a single stringBuilder cud have been creatd externally and

passed to all methods calling print.
like
print(x,y,StringBuilder)

Then what's the point of capturing the matrix contents in a

sequence when all the user is going to see is some output to

screen?! - better just print all the cells via print call

statements.


thanks for sharing..
Re: Code Challenge [1]: Pseudo-code, C#, JAVA (apply Object Oriented Principles) by Nobody: 10:18am On Jun 27, 2013
OP, you had better pay WHIZTIM for those sweet stunts up there.

Nice quiz, OOP approach means the spiral could any size and it will still work.
am battling with 2 projects with 2mrw as deadline.

when am through with them, I'll attempt this in actionscript 3.0, just that Seun seems to have removed the [flash][/flash] embed thing so you may not be able to test it here. brb.
Re: Code Challenge [1]: Pseudo-code, C#, JAVA (apply Object Oriented Principles) by jacob05(m): 3:57pm On Jun 27, 2013
authurowen:

Jacob, you are a developer. Can you take a closer look at your implementation and mine and see the difference?

Also try parsing the other test case i provided in my solution to your own solution and see what it returns.
secondly, Using your algorithm (which is wrong) after you're done printing the array, Your Master Array It will become empty (at a quick glance)

I don't know the version of PHP you're using but my code(Unedited) works perfectly well and correct providing the values you used in your code;


<?
class Spiral{

private $masterArray= [];

public function addArray(array $array){
$this->masterArray[] = $array;
}

public function getSpiral(){
$workingList = [];
while (!empty($this->masterArray) ){

$workingList = array_merge($workingList,$this->popListTopArray());
$workingList = array_merge($workingList,$this->popLastArraysElement());
$workingList = array_merge($workingList,$this->popListLastArrayReversed());
$workingList = array_merge($workingList,$this->popFirstArraysElementReversed());
}

return $workingList;

}

private function popFirstArraysElementReversed()
{
if(empty($this->masterArray)) return array();
$workingArray = [];
foreach ($this->masterArray as &$array) {
$workingArray = array_merge($workingArray,(array)array_shift($array));
}
krsort($workingArray);
return $workingArray;

}

private function popListLastArrayReversed()
{
if(empty($this->masterArray)) return array();
$workingArray = [];
$workingArray=array_pop($this->masterArray);
krsort($workingArray);

return $workingArray;
}

private function popListTopArray()
{
if(empty($this->masterArray)) return array();
return array_shift($this->masterArray);
}

private function popLastArraysElement()
{
if(empty($this->masterArray)) return array();
$workingArray = [];
foreach ($this->masterArray as &$array) {
//$testArray = $array[0];
$workingArray = array_merge($workingArray,(array)array_pop($array));
}
return $workingArray;

}
}

//First Implementation
$a = [1,2, 3, 4, 5];
$b = [16 ,17 ,18 ,19 ,6];
$c = [15 ,24 ,25 ,20 ,7];
$d = [14 ,23 ,22 ,21 ,8];
$e = [13 ,12 ,11 ,10 ,9];

$spiral = new Spiral();
$spiral->addArray($a);
$spiral->addArray($b);
$spiral->addArray($c);
$spiral->addArray($d);
$spiral->addArray($e);

var_dump($spiral->getSpiral());

//Second
$a = [ 'R', 'W' ,'Q' ,'F'];
$b = [6 ,'P', 'E' , 'G'];
$c = ['D', 'J', 'L', 'V'];
$d = ['Z' ,31, 'K', 1];

$spiral = new Spiral();
$spiral->addArray($a);
$spiral->addArray($b);
$spiral->addArray($c);
$spiral->addArray($d);
var_dump($spiral->getSpiral());
Re: Code Challenge [1]: Pseudo-code, C#, JAVA (apply Object Oriented Principles) by tobsbola: 8:21am On Jul 04, 2013
Hi Hi Hi pls ao can i develop CBT test app using swing with Java? I did one bt i nid d questions numbers to b generated randomly from d database. Tnx
Re: Code Challenge [1]: Pseudo-code, C#, JAVA (apply Object Oriented Principles) by authurowen(m): 10:49pm On Jul 04, 2013
abc
Re: Code Challenge [1]: Pseudo-code, C#, JAVA (apply Object Oriented Principles) by WhiZTiM(m): 8:42am On Jul 05, 2013
@authurowen.... I think you should read more books to increase your comprehension skills. Lemme clear out a few things...
1. I said its sometimes a plus to write bloated codes when you are have NO concrete goal in mind...

2. Your citation with the mathematics expression shows your poor understanding of my intent... If you are damn good in maths, you could be solving a COMPLEX problem, you could express a subproblem of that problem as parametric equations etc... just to get the results you need and continue with more subproblems till you are done!

But assuming it was only that subproblem that existed and you have nothing else doing, you could represent it as ODE's or some more complex model and plot graphs to investigate behavior at certain values.... Ofcause... The knowledge is just for keeps.
.
FOR THE RECORD: as a result of writing crazy overkills in free time, I have implemented a few algorithms that I never knew it formally existed...
This started few years back, when I implemented a shortest part algorithm in a bloated solution to a code challenge.... only to later realize that it was 95% Edgar Dijkstra's algorithim! And any fair solution to that problem did not even require a graph algorithm! . . .

3. I would usually go for optimal solution in real life or any software routine...

4. Yes. I am Software tester with experience limited to GUI Applications (I use Python to automate mouse and keyboards), and C++ programs using a few arsenels... e.g Valgrind tools is my fave for blackbox testing.

6. Yes. I have participated in some programming contests, most notably, I am an ex-regionals contestant of the Worlds most renowned programming contest, ACM-ICPC...

I am yet to sign up for codeforces etc, cause I know I wouldnt rise up the ranks quickly even in years. I have lots of responsibilites than programming all day or weekend.

7. If you are talking of solving problems in exact. my C++ solution beats yours in ALL endeavors.

8. Your problem is not an Engineering problem.

in this context, PLEASE consider Droping the phrase "Software Engineer" or "engineering", BECAUSE your problem and solution is an insult of the first order to Engineering! ...or qualify it with "trainee", "prospective" etc.

9. Recursion builds up stack! Compilers happen to be clever than you that's why the stack size of recursive fuctions MAY be smaller compared to what it was supposed to be...!

Peace.... I think we'll make good friends bro.

1 Like

Re: Code Challenge [1]: Pseudo-code, C#, JAVA (apply Object Oriented Principles) by WhiZTiM(m): 8:58am On Jul 05, 2013
I would stop derailing from the goal of your thread. . .
And BTW, I have been a subscriber to code simplicity, it actually reduces maintenance burden and upgrades by the next maintainer. . .

. . .and thank you for the problem. . awaiting the next problem.

Cheers.
Re: Code Challenge [1]: Pseudo-code, C#, JAVA (apply Object Oriented Principles) by prakharmishra04: 3:07am On May 19, 2016
/* hows this
import java.util.*;
class spiralfill
{
static int a[][];
public static void main(String args[])
{
int k=0,c=1,i,j,l;
Scanner sc=new Scanner(System.in);
System.out.println("enter the size of matrix"wink;
l=sc.nextInt();
a=new int[l][l];
while(c<=l*l)
{
for(j=k;j<l-k;j++)
a[k][j]=c++;
for(i=k+1;i<l-k;i++)
a[i][l-1-k]=c++;
for(j=l-2-k;j>=k;j--)
a[l-1-k][j]=c++;
for(i=l-2-k;i>=k+1;i--)
a[i][k]=c++;
k++;
}
arraydisplay(l);
}
public static void arraydisplay(int l)
{
int i,j;
for(i=0;i<l;i++)
{
for(j=0;j<l;j++)
System.out.print(a[i][j]+"\t"wink;
System.out.println();
}
}
}

(1) (2) (Reply)

Dll Load Failure With Py2exe (python And Qt) / My Journey Into React Native / Tytit users keep growing since it launched on 7th September

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 144
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.