# recursion

• ## Peg Solitare Recusion solution2018-02-13

Everyone knows of the cracker barrel triangle peg solitare game. You take one peg and jump it over another into an empty hole and the goal is to have only one peg left. In my code for the game board object I have a function sCpeg(int a, int b) which

Tags: algorithm, search, recursion
• ## recursive call through ajax2018-01-07

i am using the following code to recursively call through ajax. function ajax_pay(i) { var opt=document.getElementById("fpayee").options; payid=opt[i].value; alert(i); if(payid==""){return;} alert(payid); if (window.XMLHttpRequest) { /

Tags: javascript, ajax, recursion
• ## how to find an iterative solution2017-12-22

Can any body please give me an iterative solution for the tower of hanoi I understand this recursive code public class MainClass { public static void main(String[] args) { int nDisks = 3; doTowers(nDisks, 'A', 'B', 'C'); } public static void doTowers

Tags: java, recursion, iteration
• ## Product of two permutations (cycles) in Prolog2017-08-26

I would like to find the product of two permutations in Prolog (in cycle form) and I'm having problems with it (mostly because I can't even imagine, what it will look like). I thought about changing these permutations into another representation, but

• ## decimal to binary conversion using recursion in MatLab 2017-08-17

This question is an exact duplicate of: recursive function matlab decimal to binary conversion 1 answer I am writing a function in Matlab that converts a decimal number to binary and every time I try to run it, it tells me that I am in a infinite loo

Tags: matlab, binary, recursion
• ## Javascript recursion for tree creation2016-04-30

i am trying to create funcion for creating decision tree with state of game in every node in game (doesnt matter what game). I wrote recursive function (DFS) like this: function makeTree(anchor,count,player){ var subTree=null; var nodes=[]; if(player

Tags: javascript, tree, function, scope, recursion
• ## Adding Top parent to existing SQL query2016-01-29

I have a problem with my SQL-Statement. I want to add the Top Parent of each object to each row. I tried a few things but I have to say that I'm pretty much a SQL beginner. For example: Object A: ID 2, ParentID NULL Object B: ID 10, ParentID 2 Object

Tags: sql, sql server, recursion
• ## recursively database filling with multidimensional array2016-01-29

I would like to recursively access the id field and libelle field to fill my database. I tried the following script I fill only the first level of id and libelle.(where idTypeCaategorie = 0). It's just a part of my array. I want fill just two field i

• ## Javascript - Why no recursion?2015-12-15

Recursion is not happening? Can anyone point out why? function a() { console.log("xx"); console.log(this); a(); } var a2 = new a(); --------------Solutions------------- Answer to the updated question: Your update to the question completely chang

• ## Oracle "start with" bottom to top recursion SQL Server equivalent2015-11-10

I have seen many posts that address how to convert an Oracle "connect by prior" statement to a SQL Server common table expression. However, I have an Oracle "connect by prior" statement that has a "start with fieldname in ('value1

• ## How can I sub-divide or split my 2D Array into smaller quadrants repeatedly?2015-10-02

I'm trying to split a 2^n by 2^n 2D array into 4 quadrants. I then want to search these quadrants for pieces of information. If all the quadrant array elements = 1 or 0, then that quadrant can be left alone. If the quadrant has a mix of 1's and 0's,

Tags: arrays, split, recursion

I'm creating a recursive search method on a linked list and i'm getting an error and i can't even compile so don't even know if my methods are working correctly yet. My error is "The method search(E, E) in the type LinkedListRec is not applicable for

Tags: search, java, linked list, recursion
• ## Regarding Tail-Recusive Programming in Java 2015-09-24

I've been coding in C/C++ for a few years, and I just started Java recently. In one of the projects I've done, I was doing tail-recursion on a big data set (I apologize for not providing the code because I can't find it...). I realized an obvious per

• ## Method using Recursion2015-09-10

I am writing a "clean" method for a "Time" class. The clean method would take a Time object and would make sure that the number of seconds and minutes is between 0 and 59. I am running into an error with recursion. Here is what I have

Tags: python, methods, recursion
• ## Method to count edges from root to furthest node in tree2015-08-04

I am trying to write a method that will calculate the largest amount of edges taken to get from the root to the furthest node. public static int depth(Tree t) { if(t == null) return 0; else return 1 + Math.max(depth(t.left), depth(t.right)); } The me

Tags: java, tree, recursion, edges
• ## how to compute Big O complexity in this recursive algorithms?2015-03-23

The following recursive code is used to compute how many different possible ways that could sum a given number. Input:4 Output: 1111 112 121 112 22 13 31 4 There are 8 (2^(n-1)) different ways to get 4. I wanna know what's the Big O complexity of thi

• ## C++ Programming code logic explanation2015-03-23

i have a question for recursion in C++,i read a lot of posts,but i still can't get the logic in this exam i have.If you please help me what is the exact logic and if it possible to become easier i would be gratefull. If i enter N=3 and R=2 the answer

Tags: logic, recursion
• ## Matlab: Recursive function to find sum of numbers greater than k2015-03-19

Hi I am using matlab and need to write a function that works out the number of numbers in a vector that are greater or equal to k. It should return 0 if there are none. So far this is what I have done: function totalnumb = numbgreater(v,k) if any(v

Tags: matlab, recursion
• ## Finding a path using the Parents Array Recursively in Python2015-03-19

So I have a task, that is, to write a function that takes a parents array produced by a traversal, a starting vertex, and an end vertex, and produces a path from the start vertex to the end vertex. I have tried writing the code for this def tree_path

Tags: python, recursion, path finding
• ## Recursive Singly Linked List insert Before method cutting off rest of list2015-03-17

In creating a manual linked list using recursive methods, I cant figure out why my Insert Before method is cutting off the list after a new node is inserted. The list is not sorted. I am new to this and any help would be appreciated as to why this is