Sunday, June 24, 2012

Marshaling

For the program I'm developing, because we decided to use remoting service instead of WCF (.....) I had to go relearn how to marshal objects as the program was going to use it extensively but soon enough I thought to myself, "Do I really know what marshalling is?"

When I was taking .NET course for my undergrad, my professor briefly covered the topic of marshaling but he never really explained it in depth or rather, clear enough for me to understand. What's worse is this terminology isn't even clearly defined on the internet (Seriously, google "Marshalling" and it will only point you to a Wikipedia article which only gives an abstract explanation).

So I'm going to post an explanation I found on web that I personally believe is the clearest way you can explain what marshaling is.

Marshaling is the act of taking data from the environment you are in and
exporting it to another environment. In the context of .NET, marhsaling
refers to moving data outside of the app-domain you are in, somewhere else.

When you work with unmanaged code, you are marshaling data from your
managed app-domain to the unmanaged realm. Also, when transferring data
between app-domains (to another application, on the same or another
machine), you are also marshaling data from your app-domain, to another
app-domain.

Friday, June 22, 2012

Merge Sort vs Quick Sort

Merge Sort
Quick Sort
Time complexity (Average): O(n log n)Time complexity (Average): O(n log n)
Time complexity (Worst): O(n log n)Time complexity (Worst): O(n^2)
(Occurs when list is sorted)
Stable sort


Not dependent on any factors
Average case = Worst Case
Not a stable sort


Dependent on randomness of list
Memory: O(n)
Additional memory space required
Memory: O(log n)
Memory Complexity (Best): O(1)
Little additional memory space required