Refresher/SDLC/Algorithms

From Wikiversity
Jump to navigation Jump to search

Presentation

Construction - Part 4
Gohome.png
Algorithms
Data Structures
List of Topics
   
This presentation was made possible by Wikiversal/WikiverSuite, which is made possible by your donation. Thank you for your support.
Data Structures
Ledgray.png
 Even number if (number % 2 == 0)
 
Ledgray.png
 Odd number if (number % 2 != 0)
 
Ledgray.png
 X is power of 2 if ((x != 0) && ((x & -x) == x))
 
Ledgray.png
 Middle item of a string LinkedList: mylist.ElementAt(mylist.Count/2)
 
Ledgray.png
 Regular expression in C#: Regex Replace FormatWith in correct syntax
 
Ledgray.png
 Sample recursive solution: private void ExpandNode() { foreach (TreeViewItem node in Nodes) { ExpandNode(node); } }
 
Ledgray.png
 SortedList: mySL = new SortedList(); mySL.Add(key1,value1);
 
Ledgray.png
 Hashtable: openWith = new Hashtable(); openWith.Add("txt","notepad.exe");
 
Ledgray.png
 Hashtable speed: faster than SortedList
 
Ledgray.png
 String reversal: private static string rwr(string argSource, int argLen) { if (argLen == 1) return argSource; else return rwr(argSource.Substring(1, argSource.argLength-1),--argLen) + argSource[0].ToString(); }
 
Ledgray.png
 Find duplicate value: map int array to HashTable
 
Ledgray.png
 Travelling salesman problem: a special case of the Traveling purchaser problem
 
Ledgray.png
 Traveling purchaser problem: route with minimum combined cost of purchases and travelling given marketplaces, travel costs, available goods and their prices
 
Mobile version