Browsing projects by Tag(s)

Select a tag to browse associated projects and drill deeper into the tag cloud.

Showing page 1 of 1

RecursionSimplicity is (almost) everything. This project contains recursive algorithms which demonstrate the simplicity and the power potential of recursion and an algorithm visualizer. This visualizer application has an algorithm interface, new algorithms can be plugged into it, and it provides an ... [More] interface to visualize and parametrize the algorithms. Screenshot of the Visualizer More screenshots... What is recursion?Who wouldn't have seen the simple recursive factorial algorithm? int fact( int n ) { if ( n < 2 ) return 1; else return n * fact( n - 1 ); }I don't think there's a need to explain recursion in a new way, you can find numerous explanation for that (wikipedia or just google it). Recursion is often said to be slow and ineffective, which is true. But those are not the only aspects of writing programs and developing softwares. There are many cases where the recursive solution is way more simple and clearer, and it takes much less time and effort to develop it, maintain it and understand it. This project is here to give you examples how simple, clear and understandable it can be. The best advice you can give and take:  Don't be afraid of using recursion, but use it wisely! The basics of recursionThe 2 main things you have to know about recursive algorithms are: They (the functions/methods) call themselves before they would return, before they would actually finish their job (maybe not themselves directly, but a function/method that called them before, and not yet returned). There has to be some kind of condition (so called termination condition) in the recursive calls in order so they will stop sometime and return eventually. How can we recognize the situations and possibilities to use recursion?Self similarity. If we can identify self similarity in the problem, it's almost sure we can use recursion to solve it. If we can break down the original task into smaller pieces which are similar to the bigger problem in a way that the solution of the bigger problem can be assembled from the solutions of the smaller ones, we're almost winners. The recursive algorithm's job is to define how to assemble the whole solution from the smaller ones. For example in the factorial algorithm, we break down of calculating n! into calculating (n-1)!, and then we get the solution of n! by multiplying (n-1)! by n. Note that the recursive factorial algorithm stands here only by a demostration as the iterative solution for calculating the factorial is much more effective. So when should we use recursion?Whenever we identify self similarity, we should not always turn to recursion automatically. Profit becomes noticeably bigger when the small pieces are not independent, when the solution of a small piece depends on or requires the solution(s) of another piece(s) (usually the neighbors'). For example if we want to generate a terrain, we're more than welcome to use recursion. Because if we look at a slice of the terrain, what does it look like? Yes, like a terrain. Like the whole. So we can use recursion here, but for the whole terrain to be smooth, we want the slices to connect to each other without break lines, without edges, so in order to generate a slice of a terrain we need to know what its neighbors look like, we need the generated data (the terrain heights for example) on the borders of the slices at least (or the derivate of the surface on the borders for smoother terrain generation). [Less]

0
 
  0 reviews  |  0 users  |  495 lines of code  |  0 current contributors  |  Analyzed 3 days ago
 
 

Project uses a tree data structure to keep the branches data (position, angle relative to parent node, etc). Drawing is done by recursivly traversing the tree structure. Tree drawing is affected by extrnal parameters, such as wind speed.

0
 
  0 reviews  |  0 users  |  35 lines of code  |  0 current contributors  |  Analyzed 6 days ago
 
 

XML to Associative Array for JavaScript

0
 
  0 reviews  |  0 users  |  0 current contributors  |  Analyzed 2 days ago
 
 

Imagine plotting the content of every file in a SVN repository on a zoomable map. Imagine being able to use a revision slider to watch the project develop in real time. This is SVN Map.

0
 
  0 reviews  |  0 users  |  1 line of code  |  0 current contributors  |  Analyzed over 1 year ago
 
 

This program written by Chris Lemire crawls the web. It starts by taking a word or phrase from the user, choosing a random google search result on that word, and then randomly choosing a link from each website it visits to go on to the next website where it then randomly picks another website to go ... [More] to. Each new website causes one call of recursion to happen. If a dead end is reached, where a new website can't be obtained from the current website, then the recursion stack unwinds until a different website can be obtained from one of the previously visited websites. This program is just for fun to see where you will end up and for practice. [Less]

0
 
  0 reviews  |  0 users  |  1,531 lines of code  |  0 current contributors  |  Analyzed 10 days ago
 
 

Programming Languages and Translators Professor Alfred V. Aho Friendly Interactive Recursion Educator (FIRE)

0
 
  0 reviews  |  0 users  |  2,323 lines of code  |  0 current contributors  |  Analyzed 7 days ago
 
 

这是一个用java语言编写的一个snl编译器,程序包括词法分析和语法分析两部分。

0
 
  0 reviews  |  0 users  |  2,570 lines of code  |  0 current contributors  |  Analyzed 2 days ago
 
 

这是一个用java语言编写的一个snl编译器,程序包括词法分析和语法分析两部分。

0
 
  0 reviews  |  0 users  |  1,516 lines of code  |  0 current contributors  |  Analyzed 2 days ago
 
 
 
 

Creative Commons License Copyright © 2013 Black Duck Software, Inc. and its contributors, Some Rights Reserved. Unless otherwise marked, this work is licensed under a Creative Commons Attribution 3.0 Unported License . Ohloh ® and the Ohloh logo are trademarks of Black Duck Software, Inc. in the United States and/or other jurisdictions. All other trademarks are the property of their respective holders.