Questions tagged [sorteddictionary]
Represents a collection of key/value pairs that are sorted on the key.
sorteddictionary
175
questions
0
votes
0
answers
31
views
How can I sort a dictionary with in the dictionary by the keys of the second dictionary in python? [duplicate]
I have a dictionary as follows:
dict_1 ={'Spain':{'wins':1,'loses':0,'draws':2,'goal_difference':2, 'points':3},'Portugal':{'wins':3,'loses:1,'draws':1,'goal_difference':0,'points':4},'Morocco':{'wins'...
1
vote
1
answer
63
views
Is there a clever way to implement CeilingEntry equivalent of Java TreeMap in C# SortedDictionary, in O(logn)?
You may see similar questions on this topic - like this one and this.
The main reason I want to use a SortedDictionary is to have search and insertion functionalities in O(log n) - the best case ...
-2
votes
2
answers
55
views
Sort SortedDictionary by to the value [closed]
I have sorted dictionary like below:
var map = new SortedDictionary<string, List<Account>>();
I need to sort it by value size (so List>.Count).
How do I do that?
I tried as suggested ...
-2
votes
3
answers
55
views
Order dict by value
I have an initial dict named grouped_items and i need to populate it via
grouped_items =
{
"tcp_permit": [],
"tcp_deny": [],
"udp_permit": [],
"...
0
votes
1
answer
16
views
How to sort a dictionary inside a dictionary by values?
I am trying to sort this dictionary that contains divisions of hockey teams. Each team is an element of the dictionary and each team's value is a dictionary that has a number of points (PTS) and a VRP ...
0
votes
1
answer
61
views
SortedDictionary with class for a key becomes unsorted
SortedDictionary is supposed to always be sorted by its key.
Now consider the following code:
public class ContentKey
{
public int key_num = 0;
}
public static void Main(string[] args)
{
...
-1
votes
1
answer
29
views
Sorting the SortedDictionary keys using for each
Good afternoon. I have a strange problem. When iterating through the list, SortedDictionary does not recognize the key. Namely, it gives out that the key was not found. System.Collections.Generic....
1
vote
1
answer
438
views
Time complexity for accessing a value in a dictionary [duplicate]
I'm trying to understand why time complexity of accessing a value in a dictionary is O(1).
If I understand correctly, a dictionary is essentially an associative array, i.e. an array A of size n where ...
0
votes
3
answers
99
views
How to sort Dictionary based on keys where key contains Month Year expression of DateTime as String
I am trying to sort below Dictionary
Dictionary<string, int> map = new Dictionary<string, int>();
map["Sep 20"] = 10;
map["Oct 20"] = 11;
map["Nov 20"] = 23;
...
0
votes
1
answer
152
views
Sorting dictionary by keys that are dates
When developing a telegram bot, you need to sort the dictionary by date, to output news in chronological order. The problem is the difference in key formats (dates). There is the format %d.%m at %...
0
votes
0
answers
44
views
Do I need to define comparer for values inside sortedDictionary?
I have sortedDictionary where key is float and value is some class i wrote. I try to use myDictionary.Max(), but I get an argument exception:
ArgumentException: At least one object must implement ...
0
votes
1
answer
35
views
How can I order entries in my OrderedDict where values are duplicated?
I have a bunch of code that is out of scope of this question. The code scrapes data and gives me the following dictionary:
{'Male Open 60 Mins': {'Kavin Jones': {'total_points': 47,
'plate_number': '...
1
vote
1
answer
71
views
How to sort multiple columns values from min to max, and pivot them using python?
I have a dataframe with datetime objects in columns 'start' . I want to sort these dates into new columns : evry time ID start to a new location with order
df = pd.DataFrame(data={'ID':['a1','a2','a1',...
0
votes
3
answers
75
views
how to find the most popular letter in a string that also has the lowest ascii value
Implement the function most_popular_character(my_string), which gets the string argument my_string and returns its most frequent letter. In case of a tie, break it by returning the letter of smaller ...
1
vote
3
answers
76
views
Subtracting elements from sorted dictionary in Python
I have a sorted dictionary (here the bids of an order book) with the following form, where the items in the parentheses are {price: amount} and sorted.
bids = SortedDict({0.0005: 11.0, 0.006: 10.0, 0....