Bit/Boolean

Published 21 July 07 07:14 PM | adrian

Yes, that's my favorite data structure. Cahnom and Irwansyah have blogged about their favorites, mine is bit.

Why? Because it's the single most significant thing in computer history. No linked list, no hash table, not even an integer without a single bit.

What's a bit? A bit is a memory state, whether high or low voltage (not zero voltage). It originally came from transistor states, where you supply one port with extra voltage to enable current transfer between the other two ports.

In .NET, a bit is called boolean. Boolean has two states, True or False, mimicking the original bit. Before .NET 2.0, people get confused when combining .NET Boolean with SQL Server Bit. 's because SQL Server Bit has three states; True, False, or Null. But since .NET Generics come to life, we can create a Nullable Boolean to comply with SQL Server Bit.

.NET Boolean has slightly different operations than any other types. .NET Boolean does not allow arithmetic operations (like +, -, *, and /). But nearly in any program, .NET Boolean will always present. That is, anytime you use a logical operation, a .NET Boolean will always used. It's so common that you sometime get mixed up between .NET Boolean as a type or as expression result. The significance of .NET Boolean in any .NET application is definitely unquestionable.

Code sample? Data structure drawing? I don't think anyone need an introduction to a Boolean, right? :D

P.S.: I just read that this was actually a contest held by Risman. I didn't know that until midway writing this article. Hopefully I can get the Cormen book... :D

Share this post: | | | |
Filed under:

Comments

# bsrd said on July 21, 2007 09:22 PM:

baru tau kalo bit/boolean itu masuk data structure, bukannye data type?

# adrian said on July 21, 2007 10:38 PM:

I was also wondering whether bit/boolean is a data structure... And apparently it's a prmitive data structure according to Wikipedia. Along with it are integer and character.

Interesting!

# cahnom said on July 23, 2007 04:57 PM:

Ntar, nulis lagi data structure nible, byte, word, double word. Atau mau nulis bagaimana bit itu derepresentasikan dalam besaran listrik dan bagaimana komputer bisa melakukan operasi penambahan dan pengurangan.

Oh... iya gambarnya mana om? Kan diminta gambarkan struktur data favorit Anda.

Leave a Comment

(required) 
(required) 
(optional)
(required) 

Enter the numbers above: