0

Hi,

I know matrix 2d can be written like array[5][5] which saying 5x5 matrix but how do i make the row is like sequence of alphabets so its like array[a...z][5] while the column still numbers. Thanks.

2
Contributors
7
Replies
8
Views
6 Years
Discussion Span
Last Post by drogba123
0

yep. its like row and column but the row is number while the column is alphabets in order. from the array its only like declaring numbers and not characters

0

its like making an excel row and column where it has like [A][1] = 1; [1] = 2. something like that. is there any method i can use?thanks.

0

In Java chars are numbers according to the ASCII/Unicode tables, eg 'a' is 97, so you can use chars to index into an array:
a[2] is valid and identical to a[97][2]
You can also use them in arthmetic, so, for example
char x = 'a';
a[x-'a'][2] is valid and identical to a[0][2]
char x = 'b';
a[x-'a'][2] is valid and identical to a[1][2]
etc.
(that was a hint!)

0

Hi,

Thanks for the hint. after i created the matrix, i need to do a uniform cost search on the array so it can find the best path from start to the end point. any idea or tips how i can start on implement the algorithm? thanks

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.