# Posts Tagged "C/C++"

## Plant a Node, make a Binary Tree Forest in C++!

Once in awhile I really like to push the crazy and bizarre in the way of programming theory. Twist something mother nature made into a computer mutation that only a mad computer scientist would love. I fell upon the idea of creating a binary forest. What is that you ask? Well it is what I am calling a vector made up of binary trees. Each tree would have its own ...

## Getting System Time with C/C++

This question came about on the board recently and I thought it might be a good little snippet to give people an idea of how to access the time. You could use this method to pull out the hours, minutes, seconds, months, years, days etc all in ready to use integer format so we can use it with math functionality. Now the example will be using localtime to get the ...

## Let the Carnage Begin! Josephus Solution in C++

It was a dark stormy night, the staff of DIC had been running all night up this steep mountain trying to avoid the hordes of newbies asking for solutions. "Run for the cave!" yelled supersloth. So the crew ran into the cave hoping to elude the beasts that will not let a programming master sleep. Shortly after the 10 staffers made it safely inside... "BOOM POW CRASH!" the cave entrance ...

## Generating Non-Repeating Random Values in C++

I have seen this question pop up on the board from time to time about generating random number values, in a given range, but not repeating any of the values. It is simple enough to create your standard number generator, and even simple to test the value it generates against previously selected values, but that method has always been a "brute force" type of approach and can be a nightmare ...

## BozoSort Definitive (C++, C#, VB.NET, Java, PHP)

WARNING: PLEASE USE WITH EXTREME CAUTION! CONTENTS MAY BE FUNNY BUT NOT FOR PRODUCTION USE. Programmer Discretion is Advised! Hey you bozos out there, now there is a sort even for you! For those who don't know, a Bozo Sort is a joke sorting algorithm that actually sorts but at horrible timing and is very inefficient. It is good to see it at work from a theoretical stand point but it ...

## Dijkstra’s Algorithm for C++

Who doesn't like graph theory? Come on... it is the foundation of all living beings! Ok maybe not but it is still a bit interesting from a theoretical standpoint. Graph theory is the study of graphs and their relationships between points on that graph and their overall collection. It is often made up of vertexes (aka nodes) and the connections between them known as edges. Linked together they form a ...