Teach Time Encyclopedia - Learn About Our World
Home Page
Teach Time
Featured Topics

United States
by state

CITYology

Academic Disciplines

Historical Timelines

Themed Timelines

Calendars

Reference Tables

Biographies

How-tos



Thursday, January 08, 2009

Binary logarithm

Logarithms in the form log2n are called Binary logarithms or Base 2 logarithms. Base 2 logarithms are frequently written lg n.

Algorithms and data structures that are binary in nature, like Binary search trees and binary partition halving, make use of the lg n property. For BSTs, basic dynamic set algorithms can be designed to operate on BSTs in lg n time.

Binary partition halving can split an array in lg n time. As an example, a recursive algorithm can split an array of size n into 2 n/2 arrays. The algorithm can call itself and split those 2 n/2 arrays into 4 n/4 arrays, and so forth. During each iteration i, the size of the input array is n/2i. Assuming that the algorithm ends at array of size 1 (the base case), 2i = n. Using the binary logarithm on 2i, we see that i iterations takes lg n time.

Also, binary algorithms that are multiplied by a linear term are sometimes called linearithmic (n lg n).

Many algorithms grow in lg n or n lg n time. Some examples include:


Compare: natural logarithm (Base e), common logarithm (Base 10)


Internet Hotel Solutions

Site Sponsors
AC Units
Baltimore Harbor
Boot Camp Grads
Bra Size
Burkittsville
College Hotels
Digital Harbor
Free Cell Phones
Golden Hare Travel
Golf Vacations
Golf Courses
Gourmet
Hair Styles
Hippodrome
iWoman
Lesson Plans
Maryland Hotels
MD Genealogy
Minor League Stuff
Motel Site
Ocean City
OC Real Estate
Old Agers
Office Supplies
Orlando
Pet Friendly Hotel
Room Prices
Savannah, GA
Ski Vacations
South Baltimore
Student Teaching
Travel Sources
University Hotels
Visit Military Bases
Washington, DC

Brought to you by NoChildLeftBehind.com and the Beaches and Towns Network, LLC.