celebrating dena's b-day all sorts of ways

October 29, 2002 under Computers, Life, Programming

Today is Dena’s 26th birthday. Yup, she’s 26 thirty-two days before I am 🙂 She’ll be collecting her pension before me. So today, flood her with birthday wishes, if you can.

Not much else is new. I’ve updated a few more sections on the site; only a couple more to go. Oh, here’s a thought on sorting algorithms:

Bubble sort
-O(n^2) complexity
-easy to implement
-inefficient

void bubbleSort(int numbers[], int array_size)
{
  int i, j, temp;
 
  for (i = (array_size - 1); i >= 0; i--)
  {
    for (j = 1; j < = i; j++)
    {
      if (numbers[j-1] > numbers[j])
      {
        temp = numbers[j-1];
        numbers[j-1] = numbers[j];
        numbers[j] = temp;
      }
    }
  }
}

Heap sort
-O(n log n) complexity
-good for large data sets, but not for small ones

void heapSort(int numbers[], int array_size)
{
  int i, temp;
 
  for (i = (array_size / 2)-1; i >= 0; i--)
    siftDown(numbers, i, array_size);
 
  for (i = array_size-1; i >= 1; i--)
  {
    temp = numbers[0];
    numbers[0] = numbers[i];
    numbers[i] = temp;
    siftDown(numbers, 0, i-1);
  }
}
 
 
void siftDown(int numbers[], int root, int bottom)
{
  int done, maxChild, temp;
 
  done = 0;
  while ((root*2 < = bottom) && (!done))
  {
    if (root*2 == bottom)
      maxChild = root * 2;
    else if (numbers[root * 2] > numbers[root * 2 + 1])
      maxChild = root * 2;
    else
      maxChild = root * 2 + 1;
 
    if (numbers[root] < numbers[maxChild])
    {
      temp = numbers[root];
      numbers[root] = numbers[maxChild];
      numbers[maxChild] = temp;
      root = maxChild;
    }
    else
      done = 1;
  }
}

Insertion sort
-O(n^2) complexity
-easy to implement
-best suited for small data sets

void insertionSort(int numbers[], int array_size)
{
  int i, j, index;
 
  for (i=1; i < array_size; i++)
  {
    index = numbers[i];
    j = i;
    while ((j > 0) && (numbers[j-1] > index))
    {
      numbers[j] = numbers[j-1];
      j = j - 1;
    }
    numbers[j] = index;
  }
}

Quick sort
-O(n log n) complexity
-fast
-recursive and ugly to look at

void quickSort(int numbers[], int array_size)
{
  q_sort(numbers, 0, array_size - 1);
}
 
 
void q_sort(int numbers[], int left, int right)
{
  int pivot, l_hold, r_hold;
 
  l_hold = left;
  r_hold = right;
  pivot = numbers[left];
  while (left < right)
  {
    while ((numbers[right] >= pivot) && (left < right))
      right--;
    if (left != right)
    {
      numbers[left] = numbers[right];
      left++;
    }
    while ((numbers[left] <= pivot) && (left < right))
      left++;
    if (left != right)
    {
      numbers[right] = numbers[left];
      right--;
    }
  }
  numbers[left] = pivot;
  pivot = left;
  left = l_hold;
  right = r_hold;
  if (left < pivot)
    q_sort(numbers, left, pivot-1);
  if (right > pivot)
    q_sort(numbers, pivot+1, right);
}

I may not know all of these off the top of my head, since I don’t use most them on a daily basis. However, I can easily look them up in my notes from university and it all comes flooding back. Just a thought.

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)
comments: 0 »

tighten the strings

October 21, 2002 under Life

Lately Dena and I have decided to conserve cash. In the spirit of that, we did absolutely nothing this weekend. She finished up her copy of Red Dragon and I indulged in plenty of online UT2K3 and Warcraft3 goodness, and Scream TV‘s “October is Serial Killer Month” marathons. That is all

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)
comments: 0 »

switching gears

October 16, 2002 under ChrisBellini.com

Looks a little different here, doesn’t it?

I thought it was time for a change; out with the old and in with the new. A lot has changed. For starters, I trimmed down the number of sections I have. I don’t think the entire world needs to know the list of CDs that I own or which MP3s are in my playlist. Now there are a lot less sections for me to maintain, that weren’t really all that important to begin with. Next, I trashed that awful DHTML menu system that I made. It made code maintenance nasty, let me tell you. It should be obvious, I’ve opted to use an inline frame to display all content. Once again, this makes maintenance easier on me. All of you with old-ass web browsers, upgrade to a modern browser capable of displaying inline frames. Down with legacy systems!!!

I have to redo most of the sections, but it should take me far less time that it used to. It all should be hunky dory soon. Gimme a break; the NHL and NFL seasons are under way, and I’ve been in the mood for Warcraft 3 on Battle.net a lot lately.

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)
comments: 0 »

like bono says…

October 14, 2002 under ChrisBellini.com

“We just have to go away, and … dream it all up again.”

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)
comments: 0 »

new box

October 3, 2002 under Computers, Hardware

It’s been a while since I’ve last updated my .plan. That’s what happens when you’re putting together a new computer. Yup, that’s right, a new computer. For those interested in the specs, here they are. And for those who don’t care, too bad ’cause here are the specs anyway:

– Asus P4S8X motherboard
– Intel Pentium IV 2.4 GHz CPU
– 512MB DDR PC2700 RAM
– nVidia GeForce4 Ti 4400 (from my previous computer)
– Maxtor DiamondMax 60GB 7200 RPM hard drive (from my previous computer)
– Maxtor DiamondMax 30GB 7200 RPM hard drive
– Pioneer 16X DVD-ROM drive
– MSI 40X CD-RW drive
– CreativeLabs SoundBlaster Audigy Gamer sound card
– 3Com 3C905C-TX network card (from my previous computer)

So far, it rawks. The motherboard is great. It supports DDR333 memory AND unofficially supports DDR400. So when DDR400 is widely avaialble, I’ll be ready. Rambus is way too expensive anyway. I also like the fact that the mobo supports 8X AGP and has 6 USB 2.0 ports as well as 2 Firewire ports. Thanks to the other Firewire port on the Audigy, I have a total of three Firewire ports. I, unfortunately, have no Firewire devices whatsoever. It also has an on-board Promise RAID controller that I’m not using yet.

Performance is outstanding. Using the benchmark utility that ships with UT2K3, I get 137 FPS for flyby and 56 FPS for botmatch at 1024×768….and that’s without any tweaking 🙂 When the tweaking is done, look out.

Now that UT2K3 has been officially released, I can start modding for it. They just released the first version UDE (Unreal Development Environment; the tool for UnrealScript programming), so I still need to find time to check it out. Stay tuned…

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)
comments: 0 »