Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/s-rb/algorithms-patterns-exercises
Algorithms, data structures, implementations of some patterns, leetcode & other exercises
https://github.com/s-rb/algorithms-patterns-exercises
Last synced: 24 days ago
JSON representation
Algorithms, data structures, implementations of some patterns, leetcode & other exercises
- Host: GitHub
- URL: https://github.com/s-rb/algorithms-patterns-exercises
- Owner: s-rb
- Created: 2021-05-09T03:05:46.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-09-21T12:58:40.000Z (4 months ago)
- Last Synced: 2024-11-05T21:16:52.999Z (2 months ago)
- Language: Java
- Size: 561 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Algorithms and Data structures
Simple implementations of some algorithms and data structures## Algorithms:
* Binary search
* Bubble sort
* Merge sort
* Quick sort
* Rabin-Karp algorithm for searching substring
* Array Max Value (linear) - O(n)## Data structures:
- Single linked list
- Double linked list
- Binary tree# Design patters
Implementation of some popular design patterns:
* [Factory](src/main/java/ru/list/surkovr/patterns/factory)
* [AbstractFactory](src/main/java/ru/list/surkovr/patterns/abstractFactory)
* [Decorator](src/main/java/ru/list/surkovr/patterns/decorator)
* [Bridge](src/main/java/ru/list/surkovr/patterns/bridge)
* [Iterator](src/main/java/ru/list/surkovr/patterns/iterator)
* [Observer](src/main/java/ru/list/surkovr/patterns/observer)
* [Strategy](src/main/java/ru/list/surkovr/patterns/strategy)
* [Singleton](src/main/java/ru/list/surkovr/patterns/singleton)
* [Adapter](src/main/java/ru/list/surkovr/patterns/adapter)## Solving problems from the book Cracking the coding interview.
* [Does the string contain unique characters](src/main/java/ru/list/surkovr/exercises/arrays_and_strings/Task1stringUniqueChars.java)```/*
Complexity of some queries:
- Search for the minimum value in an array of numbers of length n, which is sorted in ascending order.
==> O(1), because we know that the minimum value is at the beginning and we can access it by index- Calculation of the average value in an array of numbers of length n.
==> O(n), since you need to access each number to add and then divide by the total in one step- Getting the length of an array of size n.
==> O(1) arrays when created have a known size that does not change- Given a list of n objects, each of which represents a bank account - ArrayList.
And there is a class and method with which you can get the total amount of transactions between the first and second account -
TransactionsCalculator.calculateTotalSum(Bill sourceBill, Bill destinationBill).
The algorithm should, using this method, calculate the total amount of transfers between all accounts from the list.
==> Add all the data between each pair of accounts in pairs - you will need (n-1)! operations. The complexity will be O(n)
*/