What's Here?
- Members: 307,100
- Replies: 841,744
- Topics: 140,664
- Snippets: 4,467
- Tutorials: 1,166
- Total Online: 2,031
- Members: 136
- Guests: 1,895
|
's Contributions
|
Below are the tutorials, code snippets, and resources has submitted to dream.in.code. For more information on Kudos and contributing to dream.in.code visit: http://home.dreamincode.net/?p=about#kudos.
|
|
Tutorials
No Tutorials Submitted. |
|
Code Snippets
|
 |
|
|
Submitted: February 1, 2007
Views: 16313
Performs an iterative implementation of binary search and counts all the critical operations. The algorithm is tested on arrays from 1-100 in size. The arrays are sorted using a simple bubblesort to ensure a sorted array for searching. Outputs array size, search key, whether the key was found, and a critical operations count.
|
|
|
 |
|
|
Submitted: January 29, 2007
Views: 3289
Bubble sort demo containing reuseable methods for bubble sorting arrays.
The program uses the bubble sort methods on arrays of between 1 and 100 pieces of data
and prints the number of comparisons made each time. The count variable keeps track of this.
This can be used to determine complexity in terms of big-O notation etc.
Also prints the final array (100 items) to check the programme is sorting correctly
Can be modified to print all arrays (e.g if you want to print them to a file)
by printing inside the loop.
|
|
|
 |
|
|
Submitted: January 30, 2007
Views: 6931
Bucket Sort demo containing reuseable methods for bucket sorting arrays.
The program uses the bucketsort methods on 100 arrays each of 100 pieces of data
and prints whether the search key is found or not each time.
Also prints the arrays to check the programme is working correctly
|
|
|
 |
|
|
Submitted: January 25, 2007
Views: 4697
Quicksort demo containing reuseable methods for quicksorting integer arrays.
The program uses the middle item in the array as the pivot value. Because the
array is filled with random numbers this should give a reasonable pivot value each time
(i.e. hopefully not the largest or smallest value!).
The program uses the quicksort methods on arrays of between 1 and 50 pieces of data
and prints the number of comparisons made each time. The count variable keeps track of this.
This can be used to determine complexity in terms of big-O notation etc.
Also prints the final array (50 items) to check the programme is sorting correctly
Can be modified to print all arrays by printing inside the loop.
|
|
|
 |
|
|
Submitted: May 30, 2008
Views: 256
This program creates 4 philosopher objects, who are seated at an imaginary table where they have only one fork beside each plate of food. Because they need two forks to eat, each philosopher attempts to pick up both their fork, and the one on their other side. Only the first thread started is able to do this, and the others go back to thinking (or philosophising) for a time, and then try to eat again.
see http://en.wikipedia.org/wiki/Dining_philosophers_problem for a description of the situation.
This simulation runs for only 40 seconds, but can be easily changed to run forever if you want to contemplate more fully!
This is a real short version to demo the problem. To solve it, some synchronisation is needed.
|
|
|
 |
|
|
Submitted: May 11, 2007
Views: 1925
Extremely short snippet for writing an extremely short piece of text to a .dat file
|
|
|
| |