I have a dictionary:
Dictionary<char, Dictionary<char, int>> vertices = new Dictionary<char, Dictionary<char, int>>();
Example when adding:
('A', new Dictionary<char, int>() { { 'B', 5 }, { 'C', 3 }, { 'E', 3}, { 'F', 1 } });
Iam passing the Dictionary<char, int>to another class where I put all the int values from the dictionary to an array so that they can be sorted(heapsort).
Before:
{ 'B', 5 }, { 'C', 3 }, { 'E', 3}, { 'F', 1 } }
After:
[1,3,3,5}
How can I re-assign the values so that the keys are also re-arranged?
I want :
('A', { 'F', 1 }, { 'C', 3 }, { 'E', 3 }, { 'B',5 });
EDIT: Heap sort
List<Edges> elements = new List<Edges>();
List<int> r;
private int heapSize;
public void Add(Edges E)
{
elements.Clear();
elements.Add(E);
r =new List<int>();
foreach (var value in elements)
{
var x = (value as Edges).Value as Dictionary<char, int>;
foreach (var getValue in x.Values)
{
r.Add(getValue);
}
}
PerformHeapSort(r.ToArray());
}