Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options not deleted user 135856

C# is a multi-paradigm, managed, garbage-collected, object-oriented programming language created by Microsoft in conjunction with the .NET platform. Use this tag for questions related to C#. In case a specific version of the framework is used, you could also include that tag; for instance .net-2.0.

5 votes

Min & Max heap implementation

I will just repeat my comment - I don't see a point of creating Min and Max Heap functionalities at the same time. MaxHeap data structure can be made by using MinHeap taking all numbers with negative …
pgs's user avatar
  • 922
2 votes

C# RGBA to ARGB using shifts

The code looks fine. I would just suggest, if it's possible, to use uint instead int: public static uint ToARGB(uint rgba) { return (rgba << 24) | (rgba >> 8); } This way, you can …
pgs's user avatar
  • 922
4 votes
Accepted

A simple C# calculator

I completely agree with you that such tasks is a good opportunity to learn new concepts and the language itself. And, as you asked, I have a few comments on your code Do not call variables by reser …
pgs's user avatar
  • 922
1 vote

Finding the number of capital letters in a word grouped by letter

I would prefer to use IEnumerable<char> instead of string. It's more generic solution. I like the @bruno-costa' answer, but instead of Dictionary I would suggest to use just array of int. publ …
pgs's user avatar
  • 922
1 vote

Bisect Insertion Container for Calculating Running Median

The main my concern is about function FindDestinationIndex, specifically how you organized the while cycle. I would like to suggest this implementation instead of the original one private int FindDes …
pgs's user avatar
  • 922
17 votes
Accepted

Get all combinations of selecting k elements from an n-sized array

Binomial coefficient \$\binom{n}{k}\$ is growing too fast (with \$n\$) to keep a list of all combinations in memory. I would suggest to use yield return instead. The main improvement which can be d …
pgs's user avatar
  • 922
9 votes

Project Euler Problem #4 - Palindromic number

The desire polyndromic number should be 6-digit number. We can show that this number is divisible on \$11\$ and use this fact to improve performance. \$P=100000x+10000y+1000z+100z+10y+x = 11(9091x+91 …
pgs's user avatar
  • 922
7 votes
3 answers
3k views

Calculator of combinations without repetition

I am interested to find an absolute value (not an approximation) of "combination without repetition" for given \$n\$ and \$k\$, or \$\binom{n}{k}\$. The brute force solution would look like this p …
pgs's user avatar
  • 922
7 votes
2 answers
2k views

Class Matrix implementation

Following the 18.06 Linear algebra course, I was curious to reinvent the matrix class and basic functionality, like \$PA=LU \$ decomposition, Gauss elimination, finding inverse matrix etc. Any comme …
pgs's user avatar
  • 922
3 votes
Accepted

Class Matrix implementation

In the book “Introduction to Linear Algebra”, that comes along with this course, the author highlights several times the advantages of finding L (low-triangle matrix) instead of E (elimination matrix) …
pgs's user avatar
  • 922