Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/m9rco/algorithm-php

๐Ÿญ๐Ÿญuniting the internal work in a way that is in PHP
https://github.com/m9rco/algorithm-php

arithmetic composer learning php php-library php5 php7 phper

Last synced: about 1 month ago
JSON representation

๐Ÿญ๐Ÿญuniting the internal work in a way that is in PHP

Awesome Lists containing this project

README

        

โ€‹

:whale:A collection of algorithms that are implemented in PHP:whale:



php













ไธญๆ–‡็‰ˆใ€€

## Simple structure,

```
โ”œโ”€โ”€Package
โ”‚ โ”œโ”€โ”€ Sort
โ”‚ โ”‚ โ”œโ”€โ”€ BubbleSort.php
โ”‚ โ”‚ โ”œโ”€โ”€ QuickSort.php
โ”‚ โ”‚ โ”œโ”€โ”€ ShellSort.php
โ”‚ โ”‚ โ”œโ”€โ”€ MergeSort.php
โ”‚ โ”‚ โ”œโ”€โ”€ InsertSort.php
โ”‚ โ”‚ โ””โ”€โ”€ SelectSort.php
โ”‚ โ”‚
โ”‚ โ”œโ”€โ”€ Query ๆŸฅๆ‰พ็ฏ‡
โ”‚ โ”‚ โ”œโ”€โ”€ BinaryQuery.php
โ”‚ โ”‚ โ”œโ”€โ”€ InseertQuery.php
โ”‚ โ”‚ โ”œโ”€โ”€ FibonacciQuery.php
โ”‚ โ”‚ โ”œโ”€โ”€ BFSQuery.php
โ”‚ โ”‚ โ”œโ”€โ”€ Kmp.php
โ”‚ โ”‚ โ”œโ”€โ”€ DijkstraQuery.php
โ”‚ โ”‚ โ””โ”€โ”€ QulickQuery.php
โ”‚ โ”‚
โ”‚ โ””โ”€โ”€ Other ๅ…ถไป–
โ”‚ โ”œโ”€โ”€ MonkeyKing.php
โ”‚ โ”œโ”€โ”€ DynamicProgramming.php
โ”‚ โ”œโ”€โ”€ Fibonacci.php
โ”‚ โ”œโ”€โ”€ StealingApples.php
โ”‚ โ”œโ”€โ”€ HanoiGames.php
โ”‚ โ”œโ”€โ”€ BidirectionalQueue.php
โ”‚ โ”œโ”€โ”€ ColorBricks.php
โ”‚ โ”œโ”€โ”€ GetCattle.php
โ”‚ โ”œโ”€โ”€ OnlyNumbers.php
โ”‚ โ”œโ”€โ”€ Interval.php
โ”‚ โ”œโ”€โ”€ Maze.php
โ”‚ โ”œโ”€โ”€ AntsClimb.php
โ”‚ โ”œโ”€โ”€ Encryption.php
โ”‚ โ”œโ”€โ”€ ElevatorDispatch.php
โ”‚ โ”œโ”€โ”€ kmp.php
โ”‚ โ”œโ”€โ”€ TraversalOfBinary.php
โ”‚ โ”œโ”€โ”€ PointInTriangle.php
โ”‚ โ””โ”€โ”€ BigSmallReplace.php
โ”‚ โ””โ”€โ”€ Knapsack.php
โ”‚ โ””โ”€โ”€ Solution.php
โ”‚ โ””โ”€โ”€ RotationSort.php
โ”‚ โ””โ”€โ”€ Square.php
โ”‚ โ””โ”€โ”€ Prim.php
โ”‚ โ””โ”€โ”€ CartesianProduct.php
โ”‚ โ””โ”€โ”€ Square.php
โ”‚ โ””โ”€โ”€ Judge.php
โ”‚ โ””โ”€โ”€ Factorial.php
| โ””โ”€โ”€ HashTable.php
| โ””โ”€โ”€ RotateSort.php
โ”‚
โ”œโ”€โ”€LICENSE
โ””โ”€โ”€README.md
```

## What to do๏ผŸ

```
To record their understanding algorithms, data structure, the process of simple comprehensive and detailed as possible, let the learning algorithm using flexible, refueling(เธ‡ โ€ขฬ€_โ€ขฬ)เธ‡
```

## logarithmic

log10100 It's equivalent to saying, "how many tens do you multiply?" the answer is, of course, two
so log10100=2๏ผŒThe logarithmic operation is the inverse of the power operation

| left | right |
| ------------------ | --------------------- |
| 23 = 8 | log28 = 3 |
| 24 = 16 | log216 = 4 |
| 25 = 32 | log232 = 5 |

If you don't, we won't wait for you

## The elapsed time

Take binary search for example, how much time can you save by using it? Simply look for the Numbers and if the list contains 100 Numbers, you need to guess 100 times.
In other words, the number of guesses is the same as the length of the list, which is called linear time, while binary search is different if the list contains 100 elements
It takes up to seven times, and if the list contains four billion digits, it should be guessed 32 times, while the running time of the subsearch is logarithmic time `O(log)`

## Big O notation

The big O notation is a special representation of how fast the algorithm can be. There's a diaosi. In fact, you often have to copy other people's code.
In this case, you know how fast these algorithms are

- The running time of the algorithm increases at different speeds
- For example, the difference between a simple find and a binary search

| element | Easy to find | Binary search |
| ------------- | ------------ | ------------- |
| 100 | 100ms | 7ms |
| 10000 | 10s | 14ms |
| 1 000 000 000 | 11day | 30ms |

- ` O ` said hair is pointed out that how fast algorithms, such as list contains ` n ` element, a simple search need to check each element, so you need to perform ` n ` time operations
Using large ` O ` said ` O (n) to make this operation `, binary search need to perform logn using large ` O ` said to`O(log n)`
- Some common big O runtime
- O(log n) ,It's also called log time, and this algorithm includes binary algorithms
- O(n),Also known as linear time, this algorithm includes simple lookups.
- O(n * log n) Quick sort
- O(n2),Selection sort
- O(n!) Factorial time
- Here is the point
- The speed of the algorithm is not the time, but the growth of operands
- When we talk about the speed of the algorithm, what we're talking about is how fast will it run as the input increases
- The running time of the algorithm is expressed in large O notation
- O(log n) is faster than O (n), and the more elements that need to be searched, the more the former is faster than the latter

## A simple comparison of recursion and loops๏ผš

1. From a procedural point of view, the recursion manifests itself as calling itself, and the loop does not have this form.
2. Recursive proceed from the ultimate goal of the problem, and gradually to a complex problem into a simple problem, and simple question solution and complicated problem, at the same time the presence of the benchmark, can eventually get a problem, is the reverse. And the circulation is from the simple question, step by step forward development, finally get the question, is positive.
3. Any cycle can be represented by recursion, but it is necessary to use the loop to achieve recursion (except for one-way recursion and tail recursion), and the stack structure must be introduced to stack the stack.
4.In general, non-recursive efficiency is higher than recursion. And recursive function calls are expensive and recursive times are limited by stack size.

## Progressive learning

1. Fork ๆˆ‘็š„้กน็›ฎๅนถๆไบคไฝ ็š„ `idea`
2. Pull Request
3. Merge

## ็บ ้”™

If you find something wrong, you can initiate a [issue](https://github.com/PuShaoWei/designPatterns-go/issues)or [pull request](https://github.com/PuShaoWei/designPatterns-go/pulls),I will correct it in time

> ่กฅๅ……:ๅ‘่ตทpull request็š„commit message่ฏทๅ‚่€ƒๆ–‡็ซ [Commit message ๅ’Œ Change log ็ผ–ๅ†™ๆŒ‡ๅ—](http://www.ruanyifeng.com/blog/2016/01/commit_message_change_log.html)

## Contributors

Thanks for the issue or pull request of the following friends:

- [hailwood ](https://github.com/hailwood)

- [zhangxuanru](https://github.com/zhangxuanru)

- [ifreesec](https://github.com/ifreesec)

- [openset](https://github.com/openset)

- [Neroxiezi](https://github.com/Neroxiezi)

## License

MIT