I am trying to solve this problem. I cannot seem to figure it out. I need to find the regional highest height from a subsection of a map. The regional highest height can be a point whose height is higher than all of its neighbors. The interior points have 8 neighbors, edge has 5 and corner has 3.
First number is the height, second is the longitude and third is the latitude. So For example, in the first record 90 is the height, 35°43'9" is the longitude and 45°45'19" is the latitude.
The answer is the maximum heights are 90, 45, 565. I am not sure how to come to this answer. I would really appreciate any help. Thanks.
I guess you would read each line and check for a common delimiter
e.g. VB, u can use the split command, split by spaces and this returns all elements in an array
you then there are 3 elements to one item i.e. height, long,lat
u have variables initialised to zero
u read each line one at a time
then compare current values with your variables. If higher,then assign your variables else continue to next
0
jess_82Author Commented:
Hello rock,
Would you please explain the algorithm a bit more? Would it give me that answer? Thanks.
what is the 3 3 at the start, does that represent the number of rows then columns?
0
With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.
1) open text file for reading
2) read the first line, store in iNoRows and iNoCols - we can use this for validation of textfile, but assume at this moment everthing is fine
3) define and initialise variables
dim iHighestHeight as integer
dim sLong as String
dim sLat as String
dim sFlds() as String
dim i as integer
dim sLine as String
iHighestHeight=0
sLong = ""
sLat =""
4) now keep looping, read each record into array,
sLine - represents one line read
sFlds = Split(sLine, " ")
'unbound is last element subscript number in array
For i = 0 To UBound(sFlds) Step 3
'Check height with last read highest height
If Val(sFlds(i)) > iHighestHeight Then
iHighestHeight = Val(sFlds(i))
sLong = sFlds(i + 1)
sLast = sFlds(i + 2)
End If
Next i
Now this only checks against the height, does it need to check against anything else?
0
jess_82Author Commented:
Hello Rock,
My problem is not language. I am not seeing the answer. Do you see the answer? How do you decide the neighbor? Thanks.
So take 90, compare its neighbours, 8 and 7, 90 is highest
take 8, compare neighbours, and current highest height for this line, 90 is still highest and is highest neighbour
take 45, compare neighbours, 45 is highest, but highest recorded is still 90
and so on
do you think its something along those lines?
0
jess_82Author Commented:
I think this is it. Let me get the review this again. Thanks.
0
jess_82Author Commented:
Hello Rock,
Thanks so much. I think that is the answer. Is there any way I could set this question so that no one can view it or is not detected by a search? Thanks.
I dont work for EE, Im just a volunteer expert so Im afraid I cannot really help you here.
You could try asking a question in EE community support (http://www.experts-exchange.com/Community_Support/),
Ive a feeling they will say no as its a response to a question, but if you have a valid reason, you could try though
I guess you would read each line and check for a common delimiter
e.g. VB, u can use the split command, split by spaces and this returns all elements in an array
you then there are 3 elements to one item i.e. height, long,lat
u have variables initialised to zero
u read each line one at a time
then compare current values with your variables. If higher,then assign your variables else continue to next