Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Best and simple data structure

Tags:

vb.net

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.

Thanks.

alt text
(source: clcbio.com)

like image 215
anshu Avatar asked Mar 15 '10 17:03

anshu


People also ask

Which is the easiest data structure?

Arrays. An array is the simplest and most widely used data structure. Other data structures like stacks and queues are derived from arrays.

Is there a best data structure?

Arrays. The array is the most basic data structure, merely a list of data elements that you can access by an index, which is the data's position inside the array. Arrays are quite efficient at searching if the elements in the array are ordered.

Which is the most efficient data structure?

Arrays. An array is a linear data structure that holds an ordered collection of values. It's the most efficient in storing and accessing a sequence of objects.

What are the 4 data structures?

When we think of data structures, there are generally four forms: Linear: arrays, lists. Tree: binary, heaps, space partitioning etc. Hash: distributed hash table, hash tree etc.


1 Answers

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

myDictionary.add("AA", 4)
like image 160
Carl Manaster Avatar answered Oct 13 '22 10:10

Carl Manaster