Skip to content

Design and Analysis of Algorithms, Assignment - BS CS Degree Program

Notifications You must be signed in to change notification settings

byrafsha/algorithms-for-patterns

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Algorithms for Strings and Patterns

Design and Analysis of Algorithms, Assignment - BS CS Degree Program

This code was written as part of a course assignment for Design and Analysis of Algorithms course during my Bachelor's degree in Computer Science. We were given the choice to either code it in C++ or C. During this course, we executed and tested our code on Ubuntu Linux, directly on the terminal.

In order to compile and execute a CPP file on a Linux terminal, navigate to the directory where the code file is saved and then follow these steps in the terminal:

gcc filename.cpp -o filename-executable

This will create an executable file for your code, within your current directly. You can verify this by either navigating to your current directory in your files or by simply executing an "ls" command in the directory to show the files present there.

Once verified, you can run this executable file using the command:

./filename-executable


This project contains 4 different files, each providing a solution to a separate question statement for the course assignment.

pAq2.cpp is a suggestive improvement for string matching, to Naive search. I have found the Longest Palindronic Subsequence using Knuth Morris Pratt algorithm, for this question
pBq1.cpp is the implementation of KMP algorithm
pBq2.c is an algorithm for finding a pattern in a string using Rabin Karp algorithm
pBq4.cpp is Boyer Moore's Bad Character Heuristic algorithm for pattern matching

Here is the complete solved assignment: i170028_RafshaMazhar_E.pdf


Disclaimer: These may not be the best of the solutions to these problems out there and I am aware that there is always room for improvemet. These were coded by me, 3 years back, in early 2020, when I was still only halfway through my Bachelor's degree. I have only recently decided to start contributing to the open source community and start making an online portfolio so I thought a good way to start could be by publishing my older solutions.