Tuesday, November 30, 2010

Algorithms every software developer must know

Basics in algorithms

What is Big O notation? (link Stackoverflow)
It is relative representation of the complexity of an algorithm

Sorting Algorithms

Sorting algorithms are often classified by
  • Computational complexity 
    • of elements in terms of the list size
    • of swaps
  •  Memory usage
  • Recursion
  • Stability
  • Adaptability

Popular sorting algorithms

Simple sorts : Insertion sort, Selection sort
Efficient sort: Merge sort, Heap sort, Quick sort
Bubble sort


Resources

http://stackoverflow.com/questions/33923/what-is-tail-recursion
http://stackoverflow.com/questions/tagged/algorithm

Tuesday, November 23, 2010

Modifiers in C#

Modifiers are used to modify declarations of types and type members. Following are the modifiers comes in C# (MSDN)

sealed #

  • In classes, sealed modifier prevents other classes from inheriting from it.
  • Can also use sealed modifier on a method or property that overrides a virtual method or property in a base class
    • Enables you to allow classes to derive from your class and prevent them overriding specific virtual methods or properties 
  • When applied to a method or property sealed must always used with override 
  • Structs are implicitly sealed, they cannot be inherited. This is because structs are value types 

virtual #



  • Virtual is used to modify methods, properties, indexers or event declarations and to be overriden in a derived class. 
  • virtual member can be changed in a derived class with override modifier. 
  • By default methods are non-virtual. Therefore you cannot override a non-virtual method. 
  • Virtual members are an implementation of type-based polymorphism. When you have a base class and a derived class, the derived class can re-implement the base class virtual method thus giving you dynamic entry point to the class type.
  • You cannot create private virtual members. You'll get virtual or private members cannot be private Exception.
  • virtual properties behave like abstract methods, with few differences.


http://www.dotnetperls.com/virtual

abstract #

  • indicates thing being modified has a missing or incomplete implementation
  • abstract method is implicitly virtual

default (SO)

  • For a reference type returns null
  • For a value type other than Nullable<T> returns 0 initialized value
  • For Nullable<T> returns empty value


const 

- Cannot change (compile time constants)

readonly

- Can change in the constructors. (runtime constants)


  • async
  • event
  • extern
  • new
  • override
  • partial
  • static
  • unsafe
  • volatile
Powered by Blogger.


Software Architect at Surge Global/ Certified Scrum Master

Experienced in Product Design, Software Engineering, Team management and Practicing Agile methodologies.

Search This Blog

Facebook