Computer Science 101 with Erik Oosterwal

with
Erik Oosterwal

Search for specific programs or algorithms:
Custom Search




Use the following code snippets as you wish. I've hacked my way through a number of quick jobs and, not finding the code I needed at the time on the web, decided to place some of my own where people could find it when they need it. Most of this code does not check for proper usage - meaning that it doesn't always check for entries to be within range or option selections to be valid, etc. You should test your own applications in the environment where they will be run.

If you have a specific algorithm or task you need help with, feel free to send an email to the address found on the Home page.

Read more discussions and subscribe to RSS feeds on Computer Science and Computer Theory topics at the Computer Algorithms Blog Site.

Visual Basic
A Comparison of Sorting Algorithms A comparison of the Bubble, Heap, Quick, Shell, Shell-Metzner, and O-Sort (a variation of the Comb sort) algorithms.  Example code is provided. 

Floating Point Decimal to Floating Point Binary Conversion An algorithm that converts decimal fractions to binary fractions.  Example code is provided using Visual Basic. 

Floating Point Decimal to Integer Fraction Conversion Convert floating point decimal values to whole number integer fractions.  Example code is provided using Visual Basic. 

Infix to Reverse Polish Notation Convert  typical infix notation, where mathematical operators bisect their operands to reverse polish notation (RPN) where operators follow their operands.  Example code is provided in Visual Basic. 

Calendar Creator This bit of code will find the starting day of the week for any given year after 1600, then print a 12 month calendar for that year.  Example code is provided in Visual Basic. 


Visual Basic for Applications

Extract Peaks in Excel Data How to extract positive and negative peaks from a column of data in an Excel Spreadsheet.  Extensive Visual Basic for Applications program code included.

Open File How to open a file from inside an Excel macro.  I use this extensively for importing text  or comma separated data into an Excel Spreadsheet for further data manipulation.  Very short Visual Basic for Applications code is included.

Converting Bases in Excel How to create a function in Excel to convert between different number bases.  Lately there seems to be a lot of people searching for a function to do this in Excel, this page will give you the complete instructions on how to create the function in Excel and how to use it.  The function described here is almost completely identical to the code listed in the article titled Numeric Base Conversion, which you can find further down on this page.

Excel Function to Convert Decimals to Integer Fractions How to create a function in Excel to convert a decimal number to a text string containing an integer numerator and integer denominator.  Lately there seems to be a few people looking for a function to do this in Excel, this page will give you the complete instructions on how to create the function in Excel and how to use it.


Fortran

Alpha to Real How to convert numbers which are stored in a string array to integer or floating point numbers.  A subroutine in FORTRAN is included.

Area of an Opening Sample subroutines to calculate openings in appliances when there are semi-regular shaped openings.

Selected Range Copy A routine to move or copy data from one location to multiple other locations which may or may not be contiguous.

Decimal to Hexadecimal Converting decimal numbers to hexadecimal strings.  This is a specialized version of the Numeric Base Conversion routine found elsewhere on this page.

Hexadecimal to Decimal Routine to convert hexadecimal strings to decimal integers.  This is a specialized version of the Numeric Base Conversion routine found elsewhere on this page.


LabVIEW

Excel Timestamp How to create a timestamp value in LabVIEW (G) that can be read by an Excel Spreadsheet.


Misc (you should be able to figure it out)

All Permutations Routine A very efficient algorithm for running through all permutations of an array of data.

Numeric Base Conversion How to convert from one numeric base to any other numeric base.  The magnitude of the bases is only limited by the number of symbols available on your computer system. There is a Pseudo Code listing as well as a PHP implementation of that code provideded by Maurice K., a reader of this site.

Roman Numeral Conversion Five different algorithms are presented that demonstrate how to convert a Decimal value to Roman Numerals and how to convert Roman Numerals back to Decimal values. Example code is provided in VB .NET along with VB projects that you can download and manipulate to fit your own requirements.

Temperature Conversion Converting temperatures from fahrenheit to celsius or from celsius to kelvin is simple.




All code and original algorithms are Copyright E. Oosterwal - 1987-2008
Home