subject

A permutation is a reordering of elements in a list. For example, 1, 3, 2 and 3, 2, 1 are two permutations of the elements in the list 1, 2, 3. In this problem, we will find all the permutations of the elements in a given list of numbers using recursion. Consider then the three-element list 1, 2, 3. To see how recursion comes into play, consider all the permutations of these elements: We observe that these permutations are constructed by taking each element in {1,2,3} {1,3,2} {2,1,3} {2,3, 1} {3, 1,2} {3, 2, 1} the list, putting it first in the array, and then permuting all the remaining elements in the list. For instance, if we take 1, we see that the permutations of 2, 3 are 2, 3 and 3, 2. Thus, we get the first two permutations on the previous list. For a list of size N, we pull out the k-th element and append it to the beginning of all the permutations of the resulting list of size N-1. We can work recursively from our size N case down to the base case of the permutations of a list of length 1 (which is simply the list of length 1 itself). *Caution* You are not allowed to use Matlab built-in functions such as: perms(), pemute(), nchoosek(), or any other similar functions. Task Complete the function genPerm using the function declaration line: 1 function (allPerm] genPerm(list) ⢠list - a 1D array of unique items (i. e. [1,2,3])
⢠allPerm - a cell array of N! 1D arrays. Each of the 1D arrays should be a unique permutation of items of list. Use a recursive algorithm to construct these permutations. For a list of size N there will be N! permutations, so do not test your code for arrays with more than a few elements (say, no more than 5 or so). Note that writing this function requires good knowledge of cell arrays, so it is recommended that you review that material before undertaking the programming task.

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 19:20
Number of megabytes of ram in a computer. qualitative or quantitative? because
Answers: 3
question
Computers and Technology, 22.06.2019 18:00
When is it appropriate to use an absolute reference
Answers: 1
question
Computers and Technology, 23.06.2019 01:40
You have a linux system that has a 1000gb hard disk drive, which has a 90gb partition containing an ext4 filesystem mounted to the / directory and a 4gb swap partition. currently, this linux system is only used by a few users for storing small files; however, the department manager wants to upgrade this system and use it to run a database application that will be used by 100 users. the database application and the associated data will take up over 200gb of hard disk space. in addition, these 100 users will store their personal files on the hard disk of the system. each user must have a maximum of 5gb of storage space. the department manager has made it very clear that this system must not exhibit any downtime as a result of hard disk errors. how much hard disk space will you require, and what partitions would you need to ensure that the system will perform as needed? where would these partitions be mounted? what quotas would you implement? what commands would you need to run and what entries to /etc/fstab would you need to create? justify your answers.
Answers: 3
question
Computers and Technology, 23.06.2019 04:31
Cloud computing service providers manage different computing resources based on the services they offer. which resources do iaas and paas providers not manage? iaas providers do not manage the for the client, whereas paas providers usually do not manage the for their clients. iaas- storage server operating system network paas- applications interafce storage vertualiation
Answers: 2
You know the right answer?
A permutation is a reordering of elements in a list. For example, 1, 3, 2 and 3, 2, 1 are two permut...
Questions
question
Mathematics, 06.04.2021 21:30
question
History, 06.04.2021 21:30
question
English, 06.04.2021 21:30
question
History, 06.04.2021 21:30
question
History, 06.04.2021 21:30
Questions on the website: 13722367