mariateodorapopescu / algorithmsbasicproblems

There is a collection of 4 small and basic algorithms problems/exercises using greedy and DP

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Algorithms Problem Set in C++

Welcome to the Algorithms Problem Set repository! Here, you'll find solutions to four intriguing problems implemented in C++. Each problem comes with a unique approach, and I've provided detailed explanations for better understanding. Let's dive into the challenges:

1. Ferry

Problem Description

You are tasked with finding the minimum cost to ferry all cars across the river using ferries with varying costs and capacities. The solution involves a binary search algorithm and a greedy approach.

Implementation

The code utilizes a binary search to find the optimal cost, considering the ferry's capacity and cost. It efficiently simulates ferry crossings using a greedy algorithm.

2. NoStory

Problem Description

In this problem, you'll implement a solution involving the manipulation of two arrays. The goal is to maximize the sum of the maximum values of the arrays, considering specific conditions.

Implementation

The algorithm uses a greedy approach, iteratively swapping the minimum from array A with the maximum from array B. The provided code is adapted for efficient execution.

3. Sushi

Problem Description

The task involves optimizing the execution time of a knapsack problem. You'll modify existing code to efficiently solve a problem related to choosing sushi plates based on weights and values.

Implementation

The resulting algorithm uses dynamic programming to find the maximum value while considering weights and values of sushi plates.

4. Semnale

Problem Description

This problem explores the generation of signals with specific patterns of 0s and 1s. Two types of signals are considered, and the goal is to count the number of signals with a given number of 0s and 1s.

Implementation

The solution involves a tridimensional matrix to efficiently count the signals based on their patterns. Detailed explanations for both types of signals are provided, and the code is adapted for practical use.

How to Use

Each problem's solution is contained in a separate folder. You can explore the code and comments within each file for a comprehensive understanding of the implementation.

Feel free to reach out if you have any questions or suggestions for improvement.

About

There is a collection of 4 small and basic algorithms problems/exercises using greedy and DP


Languages

Language:C++ 96.6%Language:Makefile 3.4%