Instantly share code, notes, and snippets.

# Sri Prasanna sri-prasanna

Created January 19, 2016 21:42
Divide and Conquer solution for MaxSubArray problem.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 void Main() { // divide and conquer algorithm // var A = new int [] {13, -3, -25, 20, -3, -16, -23, 18, 20, -7, 12, -5, -22, 15, -4, 7}; // var A = new int [] {-3, -25, -3, -16, -23, -7, -5, 22, -4}; var A = new int [] {12, -2}; var result = new int [3]; result = FindMaxSubArray(A, 0, A.Length - 1); Console.WriteLine( result ); }
Last active January 5, 2016 15:21
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 void InsertionSort(int [] A, int n) { int curr = A[n]; if (n != 0) InsertionSort(A, (n-1)); PushIntoItsSpot(A, curr, (n-1)); } void PushIntoItsSpot(int [] A, int val, int rpos) { while(rpos >= 0 && A[rpos] > val)
Last active August 29, 2015 13:56
ZipFile.Delete on a folder entry fails #48
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 ... ... ... ... int FindExistingUpdate(ZipEntry entry) { int result = -1; string convertedName = GetTransformedFileName(entry.Name); if (updateIndex_.ContainsKey(convertedName))
Last active December 31, 2015 20:09
A very simple attribute that can be used to record assumptions (if any) for any nunit based tests; after adding this attribute with some assumption text, when the concerned nunit test is run. the assumption text is displayed in the console..
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 [AttributeUsage(AttributeTargets.Method, AllowMultiple = true, Inherited = true) ] public class TestAssumptionAttribute : TestActionAttribute { private readonly string assumption; public TestAssumptionAttribute(string assumption) { this.assumption = assumption; } public override void BeforeTest(TestDetails testDetails) {
Last active December 19, 2015 09:59
A collection of powershell scripts that I create..
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 #script to list all eventlog entries with a specific text in the description \$regex_to_match=".*RoutingExtensions.*" Get-EventLog -LogName "Application" | Where-Object {\$_.Message -match \$regex_to_match} | format-list -Property Source,EntryType,Message,TimeWritten #filter eventlog entries based on date and regular expression \$regex_to_match=".*DfpLibrary.*" \$dateVal = (get-date 2013-07-01)