0

Disappointed

by 24. September 2011 14:28

Some people, I've always knew they aren't reliable, but some I thought they were, but again add to my disappointment, more unreliable ones.  Again, I learned that people are just so fake.  First, ask me to cherish our friendship; as soon as I agree, the next thing they do is trash it. WTF!  I feel so sorry for them!  Teaching me to cherish, I wonder if they really know what "cherish" really means.  Shame on them!  I actually feel sorry for myself to have known these "friends".  Oh well, another good lesson learned!  I'll be smarter next time!

Tags:

Random thoughts

0

Data Structures

by 22. July 2011 15:33

I've been programming for many years, but I've just realized that I don't pay too much attention on the performance and efficiency of my code.  For my past projects, I've only know to care about what I can produce and not how well I can make it work.  The main reason for this is because my knowledge is so limited; therefore, I need some improvements.  I don't want to be just another programmer, but I want to be a good programmer; writing effective and efficient code.

 

Direct accessing and storing contents- suboptimal when (large) data needs to be searched

Array- searching an unsorted array process takes time proportional to the number of elements in the array

 

List

 

These collections only allo data to be accessed in a predetermined order

Queue

 

Stack

 

Hashtables - direct access, but store data indexed by an arbitray object (such as string key)

 

Logarithmically proportional to the number of elements log(n)

Binary Search Tree - improve efficiency for serach

SkipLists - mixed between binary trees and linked lists

*********************************************************

 

Graph - a collection of nodes with a set of edges connecting the various nodes.

 

Set - an unordered collection of items

 

Disjoint sets - collection of sets that have no elements incommon with one another

 

 

The time it takes to search an array is linearly proportional to the number of elements in the array.  This sort of analysis described here is called asymptotic analysis, as it examines how the efficiency of a data structure changes as the data structure's size approaches infinity. The notation commonly used in asymptotic analysis is called big-Oh notation. The big-Oh notation to describe the performance of searching an unsorted array would be denoted as O(n). The large script O is where the terminology big-Oh notation comes from, and the n indicates that the number of steps required to search an array grows linearly as the size of the array grows.

A more methodical way of computing the asymptotic running time of a block of code is to follow these simple steps:

  1. Determine the steps that constitute the algorithm's running time. As aforementioned, with arrays, typically the steps considered are the read and write accesses to the array. For other data structures, the steps might differ. Typically, you want to concern yourself with steps that involve the data structure itself, and not simple, atomic operations performed by the computer. That is, with the block of code above, I analyzed its running time by only bothering to count how many times the array needs to be accessed, and did not bother worrying about the time for creating and initializing variables or the check to see if the two strings were equal.
  2. Find the line(s) of code that perform the steps you are interested in counting. Put a 1 next to each of those lines.
  3. For each line with a 1 next to it, see if it is in a loop. If so, change the 1 to 1 times the maximum number of repetitions the loop may perform. If you have two or more nested loops, continue the multiplication for each loop.
  4. Find the largest single term you have written down. This is the running time.

Note   In case you need a quick mathematics refresher, loga b = y is just another way to write ay = b. So, log2 4 = 2, since 22 = 4. Similarly, log2 8 = 3, since 23 = 8. Clearly, log2 n grows much slower than n alone, because when n = 8, log2 n = 3. In Part 3 we'll examine binary search trees whose search operation provides an O(log2 n) running time.

For example, there are a myriad of algorithms for sorting an array that have differing running times. One of the simplest and most naïve sorting algorithms is bubble sort, which uses a pair of nested for loops to sort the elements of an array. Bubble sort exhibits a running time of O(n2) due to the two for loops. An alternative sorting algorithm is merge sort, which divides the array into halves and recursively sorts each half. The running time for merge sort is O(n log2 n). Asymptotically, merge sort is much more efficient than bubble sort, but for small arrays, bubble sort may be more efficient. Merge sort must not only incur the expense of recursive function calls, but also of recombining the sorted array halves, whereas bubble sort simply loops through the array quadratically, swapping pairs of array values as needed. Overall, merge sort must perform fewer steps, but the steps merge sort has to perform are more expensive than the steps involved in bubble sort. For large arrays, this extra expense per step is negligible, but for smaller arrays, bubble sort may actually be more efficient.

MSDN

Tags:

Asp.net | Programming | Software Development

0

Life Cycle

by 18. May 2011 10:21

Request Life Cycle

Request Life Cycle

Application Life Cycle

Application Life Cycle

 

 

Generic Methods with Constraints

public static void MyMethod(string param) where Incoming_Type : Some_Types { //process something here }

*Source from MSDN

Tags:

Asp.net | Programming | Software Development

0

School over, New Job and Trips

by 9. May 2011 15:40

First of all, I'm so glad that school is over, and I am happy to say that I will be taking this summer off, yay, I can really enjoy this summer! Cool

The past two months were stressful months; midterms were in place, projects about to due, then final exams; on top of that, new job also added more stress.  Don't get me wrong, I like what I do here, its just that I need to spend an additional amount of time to know more about my responsibilities, get to know the system and of course, the people.  And that wasn't it, I also had to spend more time and did more work for Dr. Hui as my good friend decided to quit.  I had so many things to do, yet so little time.  I am so, but so glad that school is finally over; now I can focus completely on my new job.  Probation is still not over, so there's still some stress, but I will try very hard.

May is also the month of travelling.  I visit NYC last week with couple of my friends to attend my cousin's wedding (btw, she was gorgeous!) and walked around NYC.  It was an amazing trip; good food, good humor, good walk, good pics etc it was fantastic....can't wait for the next one to come. 

Tomorrow, I'm heading to Chicago for a small business trip.  Am I looking forward?  Well, I guess, I've never been to Chicago, but just the thought of waking up at 4am to catch the flight....isn't fun anymore.  By the time I come back from this trip, I'll be death.

Tags:

Maslow's hierarchy of needs | Random thoughts

0

Strive for loosely coupled designs between objects that interact.

by 12. November 2010 17:12
[No text]

Tags:

Design Principle

Powered by BlogEngine.NET 1.5.0.7
Original Design by Laptop Geek, Adapted by onesoft