Skip to content

Instantly share code, notes, and snippets.

@amrkarthik
amrkarthik / CPUCahceExperiment.cs
Last active May 23, 2020 12:15
CPUCahceExperiment
using System;
using System.Linq;
using System.Text;
using System.Diagnostics;
public class Program
{
private static int loopCount = 5000;
private static void GetStringByCombinedExecution(StringBuilder myFirstStringBuilder,
@amrkarthik
amrkarthik / SingletonPatternC#.cs
Created May 1, 2018 12:18
Singleton design patter implementation example.
public class Singleton
{
private static Singleton instance;
private Singleton() {}
public static Singleton Instance
{
get{
if(instance == null){
@amrkarthik
amrkarthik / OperatorPrecedenceList.csv
Last active March 31, 2018 10:25
PostFix operator precedence list
S.No Operator Associativity
1 ( ) Left to Right
2 [ ] Left to Right
3 . Left to Right
4 -> Left to Right
5 ++ -- Left to Right
6 ++ -- Right to Left
7 + - Right to Left
8 ! ~ Right to Left
9 (type) Right to Left
@amrkarthik
amrkarthik / MergeSort.cs
Last active January 19, 2018 15:30
C# Merge Sort implementation
using System;
namespace ExamineApp
{
partial class Program
{
static int[] Mergesort(int[] array, int startIndex, int endIndex)
{
int midIndex;
if (startIndex < endIndex)
@amrkarthik
amrkarthik / josephus_recursivesolution.cs
Created January 1, 2018 14:23
Josephus problem solution
int FindJosephusPosition(int n, int k)
{
if (n == 1)
return 1;
else
return (josephus(n - 1, k) + k - 1) % n + 1;
}