Skip to main content
The 2024 Developer Survey results are live! See the results

Questions tagged [sorteddictionary]

Represents a collection of key/value pairs that are sorted on the key.

sorteddictionary
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'...
MohammadMahdi Saeedi's user avatar
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 ...
Shubham Chaudhary's user avatar
-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 ...
rejkid's user avatar
  • 315
-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": [], "...
as path prepend's user avatar
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 ...
Popcycle999's user avatar
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) { ...
DragonGamer's user avatar
-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....
RedToni's user avatar
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 ...
Renato Dias's user avatar
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; ...
Sawan Meshram's user avatar
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 %...
Apple's user avatar
  • 13
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 ...
Crimsoon's user avatar
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': '...
Eddi's user avatar
  • 189
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',...
phœnix's user avatar
  • 377
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 ...
Libi's user avatar
  • 35
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....
Julien's user avatar
  • 35

15 30 50 per page
1
2 3 4 5
12