3
votes
1answer
45 views

Generating all keypad possibilities

I ran into this question on Stack Overflow. It looked like a really cool thing to try myself, being that I haven't done any recursion for ages (read at least 2 years). ...
1
vote
1answer
42 views
5
votes
6answers
853 views

Get rid of recursion in fruit picker

I have this simple code and it is working fine it is self explanatory: the user will choose a random number 10 times and based on the random number the array will be filled by fruits. ...
0
votes
0answers
11 views

performance in javascript recursion [duplicate]

I have this simple code and it is working fine It is self explanatory: the user will choose a random number 10 times and based on therandom number the array will be filled by fruits. ...
2
votes
1answer
54 views

Retaining depth information and recursive traversals

I have been using the pattern below for some time and it has worked well, but more than once I have almost bled my brain out of my ear trying to keep track of: the recursion depth the recursion path ...
11
votes
1answer
441 views

Recursion vs iteration of tree structure

Some recursive code is part of a particularly slow path of a project. Out of curiosity I was playing around with reimplementing the code using stack context iteration instead of recursion. Below are ...
3
votes
1answer
161 views

Recursively reading a directory in node.js

I made a function for recursively reading a directory and it just seems kind of long and complicated. If you could take a look and tell me what's good or bad about it, that would be great. Reading ...
10
votes
1answer
295 views

Sudoku solver: pencil marks & recursive patience

Here is my attempt at Weekend Challenge #3. Out of scope: It only will do 9*9 It will stop at the first solution Could have been smarter at re-using the cache when recursively calling ...
0
votes
1answer
159 views

Javascript recursive object is defined test

I wrote the method below, and was wondering whether a better way exists/best practice tips ...
4
votes
3answers
570 views

Finding Complementary Pairs

I've read the docs online explaining Log N and I do understand that the basic concept of it, but I'm still not sure I've managed to nail it. The problem This exercise is called "Complementary Pairs" ...
2
votes
1answer
148 views

Finding the longest non-decreasing subsequence in a grid

Over the weekend I was perusing the web, and came across the programming problem, finding the longest non-decreasing subsequence in a grid, and I wanted to tackle it. I'm a web developer by ...
5
votes
3answers
570 views

Implementing an algorithm that walks the DOM without recursion

Here's a simple algorithm that walks the DOM given a node: ...
2
votes
1answer
1k views

Optimize Recursive Function to traverse nested DOM nodes

I wrote a recursive function that traverses nested DOM nodes of the following form: ...
3
votes
1answer
1k views

Recursive find function in JavaScript / jQuery

I wrote the following code as a way of plucking data from a n-depth JavaScript object. It works a charm and even appends the parents of the the found item. I was just wondering if you guys had any ...
3
votes
2answers
1k views

Printing out Pascal's Triangle in row-major format

Here's the problem statement: Given an integer value, print out Pascal's Triangle to the corresponding depth in row-major format: Input Sample: 6 ...
4
votes
1answer
557 views

Recursively walking a tree to build up a new one

Could this be better factored as a reduce? ...
2
votes
1answer
729 views

Javascript “recursion” via setTimeout

I understand that because of Javascript's single-threaded execution, long loops or recursive calls could make the browser unresponsive while they execute. I thought about simulating recursion using ...