最好和最简单的数据结构 [英] Best and simple data structure

查看:29
本文介绍了最好和最简单的数据结构的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在我的 vb.net 中创建以下矩阵,以便在处理过程中我可以获得字母的匹配分数,例如:A 和 N 的匹配是什么?,我将查看内置矩阵并返回 -2同样,P 和 L 的匹配是什么?,我将查看内置矩阵并返回 -3

I am trying to create the below matrix in my vb.net so during processing I can get the match scores for the alphabets, for example: What is the match for A and N?, I will look into my inbuilt matrix and return -2 Similarly, What is the match for P and L?, I will look into my inbuilt matrix and return -3

请建议我如何去做,我试图使用这样的嵌套字典:

Please suggest me how to go about it, I was trying to use nested dictionary like this:

Dim myNestedDictionary As New Dictionary(Of String, Dictionary(Of String, Integer))()
Dim lTempDict As New Dictionary(Of String, Integer)
lTempDict.Add("A", 4)
myNestedDictionary.Add("A", lTempDict)

另一种方法是从基于文本的文件中读取矩阵,然后填充二维数组.

The other way could be is to read the Matrix from a text based file and then fill the two dimensional array.

谢谢.


(来源:clcbio.com)

推荐答案

我认为使用带有两个字符键的非嵌套字典会更简单.

I would think it would be simpler to use an un-nested dictionary with two-character keys.

myDictionary.add("AA", 4)

这篇关于最好和最简单的数据结构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆