我正在跟踪位置及其与其他位置的连接.
我将位置保存在NSArray中,而每个位置都表示为字典.每个位置都有Dictionary具有属性(locationName,Connections,latitude,longitude),其中Connections是此位置连接到的其他位置的数组(不是来自).我使用lat/lon和Haversine算法来确定两点之间的距离.
NEXT,我想使用dijkstra的最短路径算法来查找源和目标位置之间的最短路径(用户选择源和目标)
这不是商业用途,不需要支持数百或数千个位置.
我正在寻找一些将执行此搜索的客观C代码.
我有一个有数千个字符串的plist.
<plist version="1.0">
<array>
<string>Hello</string>
<string>Guitar</string>
<string>Geronimo</string>
......
</array>
</plist>
Run Code Online (Sandbox Code Playgroud)
如您所见,每个字符串都有一定的长度.
我在NSMutableArray中加载单词:
NSMutableArray *theList = [[NSMutableArray alloc] initWithContentsOfFile: [[NSBundle mainBundle] pathForResource:@"myplist" ofType:@"plist"]];
Run Code Online (Sandbox Code Playgroud)
我现在想迭代列表中的所有字符串并确定每个单词的长度,以便我可以根据字符串长度对它们进行分类.
这个环境的新手 - 我尝试了几种变体,但可能没有使用正确的语法.我如何用目标c做到这一点?