My solutions to the problems in Rosalind's Python Village
This track is mainly to get you comfortable using the rosalind platform. For each problem you code the solution, and then download the dataset from the website. Run your program with this dataset as the input, and upload the output on the website.
- Installing Python
- Variables and some Arithmetic
- Strings and Lists
- Conditionals and Loops
- Working with Files For this problem, open your output file and copy the contents. Paste that into the answer box on the rosalind website.
- Dictionaries
This track has classic algorithm problems.
- [rosalind_in.txt] This file is where I put the sample inputs.
- [rosalind_out.txt] The program writes the output to this file.
- Majority Element The question asks which element occurs more than half the number of times in the array. After sorting, check the count of middle element. If it is more than half, that is the answer, else -1.
- Degree Array Just make a linear scan through the input and increase the count of every vertex you find.
- Insertion Sort Modified the insertion sort function to return the count of number of swaps, instead of a sorted array.
- Merge Arrays Just scan through both the arrays and add the element that is small er to the final array. The merge function from this problem can be used to solve the merge sort question.
- Merge Sort Added the merge_sort function to the code from Merge array problem.
- Double Degree array Simply make a dictionary containing nodes as keys, and add the neighbors to it's value (a list).
- Counting Nucleotides Used a dictionary with each nucleotide as a key
- Transcribing DNA to RNA Simple character replacement of 'T' by 'U'
- Complementing a strand of DNA String manipulation with dictionary.
- Mendel's first law First find the formula for the probability using the various combinations of the alleles. Then just substitute the values.
- Translating RNA into protein Used a dictionary of rna codons to translate rna into protein.
- Finding a motif in DNA Simple O(mn) algorithm that matches the string at each index of the original dna string.
- Calculating Expected Offspring First built a formula based on information provided in the problem.
- Finding Point Mutations Simple hamming distance O(n) algorithm
- Rabbits and Recurrence Relations - Findng the right formula and then just using a for loop is required.