Skip to content

ahmedramadan01/algorithmsAndDataStructures

Repository files navigation

algorithmsAndDataStructure

This Algorithms are based on SanDiego Datastructures and Algorithms specialization on coursera

binary search

Implementing the binary search algorithm that allows searching very efficiently (even huge) lists, provided that the list is sorted.

binary search with Duplicates

Find the first occurence of an integer in the given sorted sequence of integers (possibly with duplicates)

car fueling

You are going to travel to another city that is located 𝑑 miles away from your home city. Your car can travel at most 𝑚 miles on a full tank and you start with a full tank. Along your way, there are gas stations at distances stop1, stop2, . . . , stop𝑛 from your home city. What is the minimum number of refills needed?

majority Element

Majority rule is a decision rule that selects the alternative which has a majority, that is, more than half the votes. Given a sequence of elements 𝑎1, 𝑎2, . . . , 𝑎𝑛, you would like to check whether it contains an element that appears more than 𝑛/2 times. O(nlogn) using Divide and conquer.

Maximum Pairwise Product

Find the maximum product of two distinct numbers in a sequence of non-negative integers.

change money using Dynamic programming

Find the minimum coins to change a given money.and you can choose also denominations.

edit_distance using Dynamic Programming

The edit distance between two strings is the minimum number of operations (insertions, deletions, and substitutions of symbols) to transform one string into another.It is a measure of similarity of two strings. Edit distance has applications, for example, in computational biology, natural language processing, and spell checking. Your goal in this problem is to compute the edit distance between two strings.

primitive calculator using dp

You are given a primitive calculator that can perform the following three operations with the current number 𝑥: multiply 𝑥 by 2, multiply 𝑥 by 3, or add 1 to 𝑥. Your goal is given a positive integer 𝑛, find the minimum number of operations needed to obtain the number 𝑛 starting from the number 1.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages