• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Dimensional Matrix to output Dimensional Array: Help needed

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I have a question on a mock exam paper that i need to know the answer so I can learn it fo an exam I am doing in a few weeks.
This is it in a shorter format below; for the actual exam I will only need to put in bare bits of code not the whole thing but if possible could someone implement it in as much code as possible so it will make me understand it better.
Whats Required:
Sequential program that receives as input a single Y x Z dimensional matrix (A) with a large amount of unsorted integer numbers.
The program then has to produce an N-dimensional array B containing the sum of the numbers in each A column(for exmaple Bi = Ai1 + Ai2 + etc + AiN
(i = 1 .....M)

Thanks for any help.
[ December 16, 2003: Message edited by: David Hunt ]
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sounds very simple. What part do you need help with? What do you have so far?
 
David Hunt
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I haven't got much worth posting so far. I am stuck I just can't get my head around it even though it sounds simple. I'll try and get it started and post some later but it would be much appreciated if you or someone else could get me started or put as much code as possible.
Thanks
 
Ernest Friedman-Hill
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, I don't know what the format of the input looks like, but there would be perhaps two nested for-loops, one over Y, one over Z, to read the input. Then to generate the output, again, two nested for-loops; one just steps over the columns, the other steps the length of each column, adding up the numbers; at the end of the outer loop, outside the inner loop, you'd assign the result to one element of the outside array.
Make sense?
 
David Hunt
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sort of but some code would be nice
 
David Hunt
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Could someone implement the above in some java code for me please?
As I have two more similar questions to try out anyway so it would be great for someone to get me started.
Thanks a lot
 
David Hunt
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Has anyone got any idea because I am still stuck
 
Ernest Friedman-Hill
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You'll find that people here are very interested in helping you to learn Java, whether it's to do well in a class, to do well at your job, or to pass an exam. Shortcuts -- i.e., you pass the exam without actually learning Java -- don't get us nearly so excited.
Now, if you want to take a stab at writing some code, we'd be happy to critique it, and tell you how to improve it.
 
This is my favorite tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic