Questions tagged [non-recursive]

non-recursive programming avoids risks of recursion by using iteration instead.

In several programming languages, recursion can lead to out-of-memory problems, using non-recursive approaches can avoid this risk.

120 questions
2
votes
1 answer

non-recursive alpha beta pruning algorithm

I'm going to implement a game application on a hardware(fpga) and because of recognizable hardware difficulty i can't implement function recursion. I've just searched for non-recursive alpha-beta pruning algorithm on minimax trees. unfortunately…
muradin
  • 1,249
  • 2
  • 14
  • 34
2
votes
0 answers

how to make bottom up merge sort work

I am trying to make an iterative bottom up merge sort that does not waste extra time copying data from the temp back into the original array. instead i want to to just copy one time at the very end. This is the code i have so far. however i am not…
2
votes
4 answers

Determinant of huge matrix Java

I am making a project in Java where i have to use BigInteger class to implement an encryption method. I have square matrices nxn where n can be 200 and i need to calculate the determinant. I did the method using the determinant of submatrices but…
1
vote
1 answer

LL(1) table-driven compilers with ANTLR or ANTLR3

Is it possible to create a LL(1) table-driven (non-recursive) compiler with ANTLR or ANTLR3 ?
Academia
  • 3,984
  • 6
  • 32
  • 49
1
vote
0 answers

Is this an acceptable implementation of non recursive merge sort

I'm learning to code, I just read the chapter divide and conquer in the introduction to algorithms book. But I don't like the recursive algorithms and is very hard to my undertand it for that reason I tried to make a non recursive merge sort in…
StandardIO
  • 156
  • 1
  • 7
1
vote
2 answers

Non-recursive Quicksort

How do i make the bottom function non-recursive, ive tried but by creating new functions which is not the point in this problem. The first function is given and the inplace_quicksort_non_recursive is created by me. import random def…
j0can
  • 21
  • 6
1
vote
3 answers

Non-recursive add function in a binary tree using c++

I am writing an Add function to add nodes to a binary tree non recursively. I have run into the problem of only being able to produce one level deep binary tree. I debugged it and I know where the problem is but can't figure out how to fix it.…
GKED
  • 410
  • 7
  • 18
1
vote
0 answers

Sequential Merge Sort in Python(Nonrecursive Merge)

def seq_merge_sort(arr): rght = 0; wid = 0; rend = 0; left = 0 k = 1 num = len(arr) temp = [0] * num while(k < num): while(left + k < num): rght = left + k rend = rght + k if(rend >…
J HoYA
  • 41
  • 5
1
vote
2 answers

How to make fibonacci sequence in racket using abstract list functions

I am trying to write a racket program that computes the sum of the first n terms in a fibonacci sequence without using recursion, and only using abstract list functions (so map, builld-list, foldr, foldl). I can use helper functions. I'm stuck on…
1
vote
1 answer

Which is more efficient n^2 or n*lgn*lgn?

A problem that can be solved by a non-recursive algorithm in n^2 times. The same problem can be solved using a recursive algorithm in n lg(n) operations to divide the input into two equal pieces and lg(n) operations to combine the two solutions…
rjgupta21
  • 182
  • 4
  • 17
1
vote
3 answers

How to perform a non recursive copy using python

I need to copy the files with certain patterns. I need to perform the non recursive copy on a given directory using shutil. I tried this code given below with performs recursive copy. Is there any options to specify in it to do the non recursive…
ArockiaRaj
  • 588
  • 4
  • 17
1
vote
2 answers

How to transfer an outside recursion program into a non-recursive form (using stack not CPS)?

there are many questions about how to convert recursive to non-recursive, and I also can convert some recursive programs to non-recursive form note: I use an generalized way (user defined Stack), because I think it is easy to understand, and I use…
1
vote
1 answer

Goodness-of-fit indices "NA"

I'm running a non-recursive model with Lavaan. However, 2 things happened that I didn't quite understand. First, gooodness-of-fit indices and some standard errors were "NA". Second, the two coefficients between two variables of different directions…
Xian Zhao
  • 81
  • 1
  • 11
1
vote
1 answer

How to implement Stack withing >?

The program I am writing is to provide a non-recursive implementation for quick sort inside QuickSort class using a stack implementation. I feel that my code is correct within the sort() method. A problem I am having is with intializing Stack due…
1
vote
2 answers

what is the difference between a recursive version of "find" and a not recursive one?

In the book Accelerated C++ Programming, on page 205, there are the two following implementation of find template In find(In begin, In end, const X& x) I am interested in knowing what is any difference in terms of performance…