All Questions
11 questions
5
votes
3
answers
1k
views
Separating the even and odd numbers in an array in C
I wrote a working program in C that takes an array with size 2ⁿ, and separates all the even numbers from the odd numbers.
For example: Input: {1,2,3,4,5,6,7,8}, Output: {8,2,6,4,5,3,7,1}
I want my ...
4
votes
2
answers
91
views
User defined function call on a stack based interpreter for concatenative language
I would like to receive some advice on how to improve a small concatenative stack-based interpreter, executing a joy-like programming language. It is really minimal, and is in fact a subset of a ...
18
votes
2
answers
4k
views
Simple recursive Sudoku solver
My Sudoku solver is fast enough and good with small data (4*4 and 9*9 Sudoku). But with a 16*16 board it takes too long and doesn't solve 25*25 Sudoku at all. How can I improve my program in order to ...
2
votes
1
answer
658
views
C Recursive Opendir Wrapper to Sort Directories First (ascending/descending)
A recent post on StackOverflow about a recursive directory listing which produced an unsorted mixed file/directory list, sparked the stray thought of "What would it take to write a wrapper for the ...
2
votes
2
answers
775
views
Find subsets of size K in N set
The question is: There is a set An, and it consists of integers from 1 to n.
...
2
votes
1
answer
146
views
trying out possible combinations of varying formula with recursion
I wrote a program in c what looks for integer solutions of different formulas. The program asks the user for a dimension which defines the formula. For example, the formula of the third dimension has ...
1
vote
2
answers
196
views
Using brute force to find an energy optimal path for a given amount of time
The code below implements a brute force method to find an energy optimal path for a given amount of time t_aim using recursion (the recursion function is ...
2
votes
1
answer
59
views
Multiplying a numeric string with the "vedic method"
This is vedic method multiplication. This code takes time on a very long numeric string, and I want to optimize it. I also apply recursion on multIndices (this ...
4
votes
1
answer
595
views
Optimization of matrix determinant calculation
I have this algorithm that calculates the matrix determinant using recursive divide-and conquer-approach:
...
6
votes
1
answer
538
views
Is a Recursive-Iterative Method Better than a Purely Iterative Method to find out if a number is prime?
I made this program in C that tests if a number is prime. I'm as yet unfamiliar with Algorithm complexity and all that Big O stuff, so I'm unsure if my approach, which is a combination of iteration ...
5
votes
1
answer
481
views
Recursive implementation of merge sort
Information about my code:
I am following this MIT OCW algorithms course. The first lecture described insertion sort and merge sort. I implemented merge sort in C.
The algorithm is structured as a ...