This repository contains my solutions to the Data Structures and Algorithms assignments offered by the University of California, San Diego (UCSD) and the National Research University Higher School of Economics (HSE) on Coursera. All of the problems from courses 1 through 6 have been solved using Python.
These solutions are intended to serve as a reference for those working on these assignments or seeking an alternative perspective on how to approach the problems. It is recommended that you try solving the assignments independently before consulting these solutions, as the best way to improve your skills is through practice. However, if you encounter difficulties or require additional guidance, these solutions are available for reference.
I hope that this repository proves to be a useful resource for your studies in data structures and algorithms.
This online course covers basic algorithmic techniques and ideas for computational problems arising frequently in practical applications: sorting and searching, divide and conquer, greedy algorithms, dynamic programming.
- Fibonacci Number
- Last Digit of a Large Fibonacci Number
- Greatest Common Divisor
- Least Common Multiple
- Fibonacci Number Again
- Last Digit of the Sum of Fibonacci Numbers Again
- Money Change
- Maximum Value of the Loot
- Car Fueling
- Maximum Advertisement Revenue
- Collecting Signatures
- Maximum Number of Prizes
- Maximum Salary
- Binary Search
- Binary Search with Duplicates
- Majority Element
- Improving Quick Sort
- Number of Inversions
- Organizing a Lottery
- Closest Points
- Money Change Again
- Primitive Calculator
- Edit Distance
- Longest Common Subsequence of Two Sequences
- Longest Common Subsequence of Three Sequences
In this online course, we consider the common data structures that are used in various computational problems.
- Check brackets in the code
- Compute tree height
- Network packet processing simulation
- Extending stack interface
- Maximum in Sliding Window
- Phone book
- Hashing with chains
- Find pattern in text
- Substring equality
- Longest common substring
- Pattern matching with mismatches
- Binary tree traversals
- Is it a binary search tree?
- Is it a binary search tree? Hard version
- Set with range sums
- Rope
In this online course, first learned what a graph is and what are some of the most important properties. Then we learned several ways to traverse graphs and how one can do useful things while traversing the graph in some order. Then we learned shortest paths algorithms — from the basic ones to those which open door for 1000000 times faster algorithms used in Google Maps and other navigational services. We finished with minimum spanning trees which are used to plan road, telephone and computer networks and also find applications in clustering and approximate algorithms.
- Checking Consistency of CS Curriculum
- Determining an Order of Courses
- Checking Whether Any Intersection in a City is Reachable from Any Other
- Computing the Minimum Cost of a Flight
- Detecting Anomalies in Currency Exchange Rates
- Exchanging Money Optimally
- Friend Suggestion
- Compute Distance Faster Using Coordinates
- Compute Distance with Preprocessing
- Compute Distance with Preprocessing on Larger Road Networks
- Travelling Salesman Problem
Textual information abounds in the world and on the internet. We read webpages, books, emails, and textual inquiries to conduct information searches. From the perspective of computer science, each of those are strings. Search engines employ a variety of string algorithms to make sense of all that data and improve the effectiveness of searches. In addition, a variety of search methods are used in the developing field of personalized medicine to identify mutations in the human genome that cause disease. You will master important pattern matching ideas in this online course, including attempts, suffix trees, suffix arrays, and even the Burrows-Wheeler transform.
- Construct a Trie from a Collection of Patterns
- Implement TrieMatching
- Extend TrieMatching
- Construct the Suffix Tree of a String
- Find the Shortest Non-Shared Substring of Two Strings
- Construct the Burrows–Wheeler Transform of a String
- Reconstruct a String from its Burrows–Wheeler Transform
- Implement BetterBWMatching
- Construct the Suffix Array of a String
- Find All Occurrences of a Pattern in a String
- Construct the Suffix Array of a Long String
- Pattern Matching with the Suffix Array
- Construct the Suffix Tree from the Suffix Array
- Assign Frequencies to the Cells of a GSM Network
- Cleaning the Apartment
- Advertisement Budget Allocation
- Assembling the phi X174 Genome from Error-Free Reads Using Overlap Graphs
- Assembling the phi X174 Genome from Error-Prone Reads Using Overlap Graphs