Skip to main content
Filter by
Sorted by
Tagged with
0 votes
1 answer
91 views

I am using the following the Heap Algorithm for computing permutation of words in elisp, but the permutations are not correct. The problem could be associated with the way I use the two calls to ...
Dilna's user avatar
  • 465
0 votes
0 answers
68 views

We are using Heap algorithm for generating permutations of an array a. . The generated permutations are passed to the printArr function, which calculates the correlation coefficient between two arrays ...
Shaggy's user avatar
  • 804
0 votes
0 answers
91 views

Right now I'm trying to understand why a certain non-recursive implementation of the Heap's Permutation Algorithm works. I implemented some code of this particular version of the algorithm in python, ...
Jahleel Murray's user avatar
2 votes
2 answers
1k views

I am trying to generate all permutations for an array using the Heap's algorithm that I found in wikipedia. This is what I tried so far: n <- 3 A <- c(1, 2, 3) perm <- function(n, A) { if (...
aycee 's user avatar
  • 49
0 votes
1 answer
252 views

I wanted to use the recursive version of Heap's algorithm in order to get all permutations of a sequence of natural numbers from 1 to k inclusive, but ran into certain difficulties. For k = 3, the ...
aldin's user avatar
  • 169
0 votes
1 answer
124 views

i'm preparing for an interview and was trying heap's algorithm for permutation with javascript. so the code works fine when i try to print to console. function per(a, size){ if(size === 1){ ...
Nayla's user avatar
  • 21
0 votes
1 answer
106 views

I’m trying to understand Heap’s algorithm from the Wikipedia page and I’m trying to compare the picture with the algorithm and I can’t seem to figure it out this picture is from the wikipedia page ...
no lemon no melon's user avatar
0 votes
1 answer
476 views

Goal: I want to execute a specific function for every permutation of an array. I don't need to save intermediate permutations. Paraphrase: I'm searching for a Javascript implementation of Heap's ...
DarkTrick's user avatar
  • 3,683
1 vote
2 answers
2k views

I'm working through some "Kata's" on CodeWars.com, and am stuck on the Permutations problem. Here is the problem: n this kata you have to create all permutations of an input string and ...
JTP709's user avatar
  • 130
-1 votes
2 answers
3k views

I need to get all the permutations of an iterable of length n in a brute force algorithm. I dont want to use itertools or any other external packages. I figured I could use Heap's algorithm but my ...
anna's user avatar
  • 11
1 vote
1 answer
174 views

Objective of my code: Trying to create an ArrayList of Arrays containing all permutations of passed array 'p'. Approach: Using Heap's algorithm, trying to generate all permutations, each permuatation ...
Kartik Gautam's user avatar
0 votes
1 answer
106 views

I am attempting to implement "Heap's Algorithm" (wiki) in Java, which constructs all permutations of a given set. (I am aware that this isn't technically Heap's algorithm because of subtleties pointed ...
cstover's user avatar
  • 171
1 vote
0 answers
177 views

I'm studying time complexity of recursive algorithms and I want to know the complexity of the Heap's algorithm that generate all possible permutations of n objects. procedure generate(k : integer, A ...
Garais16's user avatar
3 votes
2 answers
986 views

I have an alright understanding of how Heap's Algorithm works, but I can't figure out how to add each unique permutation into an array and return it based on the recursive nature of the algo. why is ...
totalnoob's user avatar
  • 2,781
1 vote
1 answer
408 views

I am currently implementing Heaps's Algorithm in Python, but my current solution is returning some of the permutations twice. def generate(startingIndex, alist): if startingIndex == 1: ...
winged hussar's user avatar
0 votes
1 answer
259 views

I am trying to get this heaps algorithm to return an array of permutations instead of printing as below. I know it could be done by declaring an array outside of the function and pushing to it but, I ...
Roijjer's user avatar
  • 57
6 votes
1 answer
3k views

I basically need the equivalent result of the following Python itertools command in C: a = itertools.permutations(range(4),2)) Currently my process involves first "choosing" 5 elements from ...
Siddharth Chabra's user avatar
2 votes
2 answers
4k views

I was set the task to create an array of all permutations/ 4 digit numbers of a given array of numbers: [1,2,3,4,5,6,7,8,9]. There can be no repeats of digits as each value must be unique. Below is my ...
matthew gabriel's user avatar
3 votes
1 answer
130 views

So I have a list: a 25 b 18 c 18 d 18 e 14 f 14 g 12 ... and so on For each number that matches, I have to get every permutation of the identifier. The lists I would need from my example would be as ...
Display Name's user avatar
0 votes
1 answer
118 views

I'm stuck with some heap's permutation algorithm. I wrote some JavaScript code to recursively find every possible permutation of a value: either an array or a string. My code seems to work perfectly ...
Wadson Fourrien's user avatar
2 votes
2 answers
413 views

I was trying to implement Heap's Algorithm in go using channels. The code below is working fine when just printing the slices on the screen, but when using channels to delivery the arrays to a for/...
Daniel Rangel's user avatar
1 vote
4 answers
2k views

This question is related to my question here. I am trying to get the following count programmatically to verify whether my mathematics is right. How many arrangements of the letters in the word ...
Kiran's user avatar
  • 914
0 votes
0 answers
218 views

I'm wanting to generate all possible permutations of the letters A - G (seven) and Heap's algorithm allegedly makes this possible. However, when I look at the pseudo code from the Wikipedia page I ...
Edson's user avatar
  • 285
-1 votes
2 answers
1k views

I have implemented Heap's non-recursive algorithm in JavaScript. When checking permutations with console.log(arr) everything works as expected. But when I try to push each permutation to a result ...
ruby life questions's user avatar
0 votes
0 answers
14 views

I am trying to modify this blogger's version of Heap's Algorithm. My issue is that this function prints out every permutation just fine, however if I try to add these permutations to an array which I ...
Danora's user avatar
  • 355