# tagged [theory]

#### What is the complexity of these Dictionary methods?

What is the complexity of these Dictionary methods? Can anyone explain what is the complexity of the following `Dictionary` methods? I'm trying to figure out the complexity of a method I wrote: ``` pu...

- Modified
- 27 Mar at 22:8

#### How can building a heap be O(n) time complexity?

How can building a heap be O(n) time complexity? Can someone help explain how can building a heap be complexity? Inserting an item into a heap is , and the insert is repeated n/2 times (the remainder ...

- Modified
- 30 Apr at 15:34

#### "const correctness" in C#

"const correctness" in C# The point of const-correctness is to be able to provide a view of an instance that can't be altered or deleted by the user. The compiler supports this by pointing out when yo...

- Modified
- 21 Jan at 05:28

#### Why is the time complexity of both DFS and BFS O( V + E )

Why is the time complexity of both DFS and BFS O( V + E ) The basic algorithm for BFS: So I would think the time complexity would be: ``` v1 + (incident edges) + v2 + (incident edges) + .... + v

- Modified
- 15 Nov at 06:8

#### Which is better: O(n log n) or O(n^2)

Which is better: O(n log n) or O(n^2) Okay so I have this project I have to do, but I just don't understand it. The thing is, I have 2 algorithms. and . Anyway, I find out in the project info that if ...

- Modified
- 19 Mar at 09:34

#### Reason for precedence of instanceof/is

Reason for precedence of instanceof/is In both C#/Java the operator precedence of `is` respectively `instanceof` leads to some ugly necessary parenthesis. For example instead of writing `if (!bar inst...

- Modified
- 10 May at 22:12

#### ? operator without else-part

? operator without else-part I use C# ? operator when I have if-statements that affects one row and it's all good. But lets say I have this code (using classic if-statements): This can be achieved on ...

- Modified
- 24 Jul at 13:18

#### HashMap get/put complexity

HashMap get/put complexity We are used to saying that `HashMap` `get/put` operations are O(1). However it depends on the hash implementation. The default object hash is actually the internal address i...

- Modified
- 30 Aug at 11:47

#### async await performance?

async await performance? Assuming I have this code with many `awaits`: Where each task can take a very short period of time , (again , theoretical) There a situation where the with all those "releas...

- Modified
- 26 May at 14:5

#### Partially Overriding a Virtual Auto-Property in a Child Class

Partially Overriding a Virtual Auto-Property in a Child Class Time for a theoretical question I just ran across. The following code is valid and compiles: ``` public class Parent { public virtual ob...

- Modified
- 7 Oct at 17:10

#### .NET console application exit event

.NET console application exit event In .NET, is there a method, such as an event, for detecting when a console application is exiting? I need to clean up some threads and [COM](https://en.wikipedia.or...

- Modified
- 17 Jan at 23:4

#### Finding symmetric difference with LINQ

Finding symmetric difference with LINQ I have two collections `a` and `b`. I would like to compute the set of items in either `a` or `b`, but not in both (a logical exclusive or). With LINQ, I can com...

- Modified
- 25 May at 21:2

#### C# graph drawing library?

C# graph drawing library? I'm looking for a (free) library which allows me to draw a [CFG](http://en.wikipedia.org/wiki/Control_flow_graph) (control flow graph). Something like [yFiles](http://yworks....

- Modified
- 4 Feb at 15:25

#### Algorithm for Grouping

Algorithm for Grouping I am trying to help someone write a program that I thought would be easy, but of course it never is :) I am trying to take a class roster (usually between 10-20 students) and ef...

- Modified
- 23 Mar at 15:18

#### Would it be possible to have a compiler that would predict every possible 'situation specific' runtime error?

Would it be possible to have a compiler that would predict every possible 'situation specific' runtime error? By 'situation specific' I mean it uses some data that it would have access to such as your...

- Modified
- 4 Oct at 05:2

#### Advantages of compilers for functional languages over compilers for imperative languages

Advantages of compilers for functional languages over compilers for imperative languages As a follow up to this question [What are the advantages of built-in immutability of F# over C#?](https://stack...

- Modified
- 23 May at 11:51

#### Distributed probability random number generator

Distributed probability random number generator I want to generate a number based on a distributed probability. For example, just say there are the following occurences of each numbers: ``` Number| Co...

- Modified
- 23 May at 12:9

#### Interface or abstract class?

Interface or abstract class? For my new Pet-Project I have a question for design, that is decided already, but I want some other opinions on that too. I have two classes (simplified): ``` class MyObje...

#### How and when to abandon the use of arrays in C#?

How and when to abandon the use of arrays in C#? I've always been told that adding an element to an array happens like this: > An empty copy of the array+1element is created and then the data from th...

#### Time complexity of python set operations?

Time complexity of python set operations? What is the the time complexity of each of python's set operations in [Big O](http://en.wikipedia.org/wiki/Big_O_notation) notation? I am using Python's [set ...

- Modified
- 8 Sep at 16:38

#### Determining complexity for recursive functions (Big O notation)

Determining complexity for recursive functions (Big O notation) I have a Computer Science Midterm tomorrow and I need help determining the complexity of these recursive functions. I know how to solve ...

- Modified
- 7 Jun at 10:23

#### Why does tail call optimization need an op code?

Why does tail call optimization need an op code? So [I've read many times before](https://stackoverflow.com/a/491463/5056) that technically .NET support tail call optimization (TCO) because it has the...

- Modified
- 23 May at 12:1

#### How to enumerate x^2 + y^2 = z^2 - 1 (with additional constraints)

How to enumerate x^2 + y^2 = z^2 - 1 (with additional constraints) Lets `N` be a number `(10

- Modified
- 23 Feb at 07:0

#### What is the lookup time complexity of HashSet<T>(IEqualityComparer<T>)?

What is the lookup time complexity of HashSet(IEqualityComparer)? In C#.NET, I like using HashSets because of their supposed O(1) time complexity for lookups. If I have a large set of data that is goi...

- Modified
- 21 Mar at 20:5

#### How to improve Cyclomatic Complexity?

How to improve Cyclomatic Complexity? Cyclomatic Complexity will be high for methods with a high number of decision statements including if/while/for statements. So how do we improve on it? I am handl...

- Modified
- 5 Jan at 11:29