tagged [data-structures]

Are there any implementations of multiset for .Net?

Are there any implementations of multiset for .Net? I'm looking for a .Net implementation of a multiset. Can anyone recommend a good one? (A multiset, or bag, is a set that can have duplicate values, ...

Bi-directional dictionary?

Bi-directional dictionary? I have two sets of objects where in some cases the first set will be used as keys for the other set, and in other cases the second set will be used as keys for the first. In...

4 Aug at 13:56

Looking for the suffix tree implementation in C#?

Looking for the suffix tree implementation in C#? I've implemented a basic search for a research project. I'm trying to make the search more efficient by building a [suffix tree](http://en.wikipedia.o...

11 Oct at 07:16

Haskell's algebraic data types

Haskell's algebraic data types I'm trying to fully understand all of Haskell's concepts. In what ways are algebraic data types similar to generic types, e.g., in C# and Java? And how are they differen...

Sorting a linked list

Sorting a linked list I have written a basic linked list class in C#. It has a Node object, which (obviously) represents every node in the list. The code does not use IEnumerable, however, can I imple...

How to check deque length in Python

How to check deque length in Python How to check a deque's length in python? I don't see they provide deque.length in Python... [http://docs.python.org/tutorial/datastructures.html](http://docs.python...

C# flattening json structure

C# flattening json structure I have a json-object in C# (represented as a Newtonsoft.Json.Linq.JObject object) and I need to flatten it to a dictionary. Let me show you an example of what I mean: This...

13 Sep at 00:29

Get "Value" property in IGrouping

Get "Value" property in IGrouping I have a data structure like And I am trying to do... ``` var list = new List(); foreach (var group in dc.GetDespatchedProducts().GroupBy(i => i.DespatchDate)) { //...

30 Nov at 16:3

Best algorithm to test if a linked list has a cycle

Best algorithm to test if a linked list has a cycle What's the best (halting) algorithm for determining if a linked list has a cycle in it? [Edit] Analysis of asymptotic complexity for both time and s...

How to convert List to Map?

How to convert List to Map? Recently I have conversation with a colleague about what would be the optimal way to convert `List` to `Map` in Java and if there any specific benefits of doing so. I want ...

C# Array or Dictionary?

C# Array or Dictionary? I wanted to know is C# array has a constant access speed? I need to store 1000 items in static array, that will be initialized during server startup. This array will be used re...

C# Data Structure Like Dictionary But Without A Value

C# Data Structure Like Dictionary But Without A Value Is there any data structure in C# that is like a dictionary but that only has a key and doesn't have a value. I basically want a list of integers ...

1 Sep at 17:54

Should I use a Dictionary for collections with 10 items or less, or is there a better alternative?

Should I use a Dictionary for collections with 10 items or less, or is there a better alternative? I have a list of objects and I need to find an object as quickly as possible (by it's name property)....

Write a function that compares two strings and returns a third string containing only the letters that appear in both

Write a function that compares two strings and returns a third string containing only the letters that appear in both I got this homework. And have solved it in following way. I need your comments whe...

15 Sep at 23:19

How to update C# hashtable in a loop?

How to update C# hashtable in a loop? I'm trying to update a hashtable in a loop but getting an error: System.InvalidOperationException: Collection was modified; enumeration operation may not execute....

15 Jun at 20:18

C# Hashtable Internal datastructure

C# Hashtable Internal datastructure All - Asking a specific question which I came across recently and surprisingly didn't find any convincing answer. What is the internal backing data structure which ...

1 Jan at 18:56

Find kth smallest element in a binary search tree in Optimum way

Find kth smallest element in a binary search tree in Optimum way I need to find the kth smallest element in the binary search tree without using any static/global variable. How to achieve it efficient...

What are real world examples of when Linked Lists should be used?

What are real world examples of when Linked Lists should be used? Another programmer was mentioning that they haven't found a use case for using a linked list data structure in any professional softwa...

23 May at 10:32

Comparison of collection datatypes in C#

Comparison of collection datatypes in C# Does anyone know of a good overview of the different C# collection types? I am looking for something showing which basic operations such as `Add`, `Remove`, `R...

19 Oct at 11:17

Mapping Stream data to data structures in C#

Mapping Stream data to data structures in C# Is there a way of mapping data collected on a stream or array to a data structure or vice-versa? In C++ this would simply be a matter of casting a pointer ...

8 Aug at 13:52

List operations complexity

List operations complexity I have always thought that `List` in `C#`is a classic linked list, but recently I read that it is actually backed by array internally. Does this mean that when we do insert ...

4 Feb at 15:46

Calculate size of Object in Java

Calculate size of Object in Java I want to record how much memory (in bytes, hopefully) an object takes up for a project (I'm comparing sizes of data structures) and it seems like there is no method t...

Priority queue in .Net

Priority queue in .Net I am looking for a .NET implementation of a priority queue or heap data structure > Priority queues are data structures that provide more flexibility than simple sorting, becaus...

Data structure similar to a 2-argument map

Data structure similar to a 2-argument map Is there a data structure (readily available in STL or boost), that accepts two arguments and maps it to a certain value? Examples would be for returning cer...

20 Jun at 09:12

Declaring and initializing a string array in VB.NET

Declaring and initializing a string array in VB.NET I was trying to return an array of strings from a function and got surprised by an error. I would have expected this to work, but it produces an err...

19 Apr at 15:16