Skip to content

Commit 09b839b

Browse files
committed
增加算法源代码
包括hello-algo
1 parent 20d3c02 commit 09b839b

File tree

5,146 files changed

+270004
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

5,146 files changed

+270004
-0
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
2+
charles kenny
3+
there’s all these platforms that let you built entrepreneureal ventures much more easily. the growth of things like crowdfunding have helped make entrepreneurship more accessible, led to tons of new start-ups. so there’s a lot of new methods for launching businesses and the cost of launching new businesses dropped at the same time.
4+
many millennials create start-ups - newly formed businesses intended to grow rapidly using a method called crowdfunding - getting the funding for their new business by asking large numbers of people on the internet to each give a little bit of money.
5+
rob
6+
ethan mollick
7+
so, charles mentions the problem that governments can be corrupt - act in morally wrong or illegal ways, often in return for money or power.
8+
have you got a ‘business brain’, sam? would you like to start you own business?
9+
it’s this working together than can raise people’s quality of life – level of personal satisfaction and comfort.
10+
Tarana Burke
11+
if you are working in a place with a corrupt and inefficient government, one of the best ways you can push development in your country is to try and make that problem a little bit better. it’s not something that any one individual can do, it has to be a collective effort, but the more we have young, committed, smart people who want to make the world a better place working in government, the more likely government is to start delivering the kind of services we need in order to ensure a high quality of life in that country.
12+
and of course, we’ll be learning some new vocabulary on the way.
13+
and one important goal is to improve the quality of life – the level of satisfaction and comfort that a person or group enjoys.
14+
the talent and passion that millennials put into starting their own business could instead be used to improve governments through collective effort - a group of people acting together to achieve a common goal.
15+
well, that’s the dream for many millennials - the name given to the current generation of young people aged between 24 and 38.
16+
ok. we’ll find out the later if you were right. now, whether it’s tv shows like ‘the apprentice’ or the big success of companies in california’s silicon valley, the last decade saw a huge growth in 20 and 30-year-olds starting their own businesses. bbc world service programme the why factor asked business professor, ethan mollick to explain how this situation came about…
17+
entrepreneurs see opportunities for products and services not being supplied by existing companies, so they create start-ups - newly formed businesses intended to grow rapidly by providing for a particular market gap.
18+
hmmm, i know millennials like starting businesses so i’ll say, b) earning £1 million in under a week.
19+
but first, it’s time for today’s quiz question. at 79 years old, muhammad yunus is hardly a millennial but he’s a hero to many young business people. in 2006 he won the nobel peace prize, but what for? was it for: a) offering microfinance to low-income businesses; b) starting the first business to earn £1m in under a week, or c) developing a progressive model of taxation.
20+
but it’s not only about making profits. millennials start-ups can help solve many of the developing world’s problems, instead of governments which may be corrupt - acting immorally or illegally for money or power.
21+
ethan lists some of the reasons why it’s now easier to become an entrepreneur - someone who starts their own business, often after seeing a new opportunity.
22+
bye!
23+
sam
24+
Georgina
25+
hello. this is 6 minute english from bbc learning english. i’m rob.
26+
some of the millennial generation are dissatisfied with the old ways of doing things, for example how big business uses data from social media and the negative impact of companies on society and the environment.
27+
something that muhammad yunus was doing.
28+
ah yes, that’s today’s quiz question. i asked you why muhammad yunus won the nobel prize in 2006.
29+
but while start-up success stories have made going into business a good option, for many millennials it’s not just about making money but also about being socially responsible and doing good. however, others argue that most big changes for the better have come from governments not millennial businesses. here, former world bank economist charles kenny cautions against overemphasising individual business over governments…
30+
i said that, b) he started the first business to earn £1m in under a week.
31+
but in fact it was a) offering microfinance to low-income businesses – a way for anyone, rich or poor, to run a business in a positive way.
32+
it sounds good, rob. i like the idea of being my own boss.
33+
today, we’ve been talking about why young people in the millennial generation want to be entrepreneurs – people who start their own business.
34+
what’s needed more than individual businessmen and women is collective effort - a group of people acting together to achieve a common goal.
35+
and i’m sam.
36+
in today’s programme, we’ll look at why millennials are so attracted to starting their own businesses and asking whether this really is the way to make the world a better place.
37+
one of the main problem to starting up your own business used to be getting the large amounts of money needed, but nowadays this can be solved with crowdfunding - getting the funding for a new business by asking a large number of people to give small amounts of money, usually via the internet.
38+
Sam
39+
that’s all from us today. but remember to join us again soon for more topical discussion and vocabulary. bye for now!
18.5 MB
Binary file not shown.

hello-algo/hello-algo-main.zip

53 MB
Binary file not shown.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
*.py linguist-language=Python
2+
*.cpp linguist-language=C++
3+
*.hpp linguist-language=C++
4+
*.java linguist-language=Java
5+
*.go linguist-language=Go
6+
*.swift linguist-language=Swift
7+
*.js linguist-language=JavaScript
8+
9+
*.c linguist-language=Other
10+
*.h linguist-language=Other
11+
*.cs linguist-language=Other
12+
*.zig linguist-language=Other
13+
*.rs linguist-language=Other
14+
*.ts linguist-language=Other
15+
*.dart linguist-language=Other
16+
*.kt linguist-language=Other
17+
18+
*.html linguist-detectable=false
19+
*.css linguist-detectable=false
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
If this pull request (PR) pertains to **Chinese-to-English translation**, please confirm that you have read the contribution guidelines and complete the checklist below:
2+
3+
- [ ] This PR represents the translation of a single, complete document, or contains only bug fixes.
4+
- [ ] The translation accurately conveys the original meaning and intent of the Chinese version. If deviations exist, I have provided explanatory comments to clarify the reasons.
5+
6+
If this pull request (PR) is associated with **coding or code transpilation**, please attach the relevant console outputs to the PR and complete the following checklist:
7+
8+
- [ ] I have thoroughly reviewed the code, focusing on its formatting, comments, indentation, and file headers.
9+
- [ ] I have confirmed that the code execution outputs are consistent with those produced by the reference code (Python or Java).
10+
- [ ] The code is designed to be compatible on standard operating systems, including Windows, macOS, and Ubuntu.
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# This starter workflow is for a CMake project running on multiple platforms. There is a different starter workflow if you just want a single platform.
2+
# See: https://github.com/actions/starter-workflows/blob/main/ci/cmake-single-platform.yml
3+
4+
name: C
5+
6+
on:
7+
push:
8+
branches: ["main"]
9+
paths: ["codes/c/**/*.c", "codes/c/**/*.h"]
10+
pull_request:
11+
branches: ["main"]
12+
paths: ["codes/c/**/*.c", "codes/c/**/*.h"]
13+
workflow_dispatch:
14+
15+
jobs:
16+
build:
17+
runs-on: ${{ matrix.os }}
18+
19+
strategy:
20+
# Set fail-fast to false to ensure that feedback is delivered for all matrix combinations. Consider changing this to true when your workflow is stable.
21+
fail-fast: true
22+
23+
# Set up a matrix to run the following 3 configurations:
24+
# 1. <Windows, Release, latest MSVC compiler toolchain on the default runner image, default generator>
25+
# 2. <Linux, Release, latest GCC compiler toolchain on the default runner image, default generator>
26+
# 3. <Linux, Release, latest Clang compiler toolchain on the default runner image, default generator>
27+
#
28+
# To add more build types (Release, Debug, RelWithDebInfo, etc.) customize the build_type list.
29+
matrix:
30+
os: [ubuntu-latest, windows-latest]
31+
build_type: [Release]
32+
c_compiler: [gcc, clang, cl]
33+
include:
34+
- os: windows-latest
35+
c_compiler: cl
36+
cpp_compiler: cl
37+
- os: ubuntu-latest
38+
c_compiler: gcc
39+
cpp_compiler: g++
40+
- os: ubuntu-latest
41+
c_compiler: clang
42+
cpp_compiler: clang++
43+
exclude:
44+
- os: windows-latest
45+
c_compiler: gcc
46+
- os: windows-latest
47+
c_compiler: clang
48+
- os: ubuntu-latest
49+
c_compiler: cl
50+
51+
steps:
52+
- uses: actions/checkout@v4
53+
54+
- name: Configure CMake
55+
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
56+
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
57+
run: >
58+
cmake -B ${{ github.workspace }}/codes/c/build
59+
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }}
60+
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }}
61+
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
62+
-S ${{ github.workspace }}/codes/c
63+
64+
- name: Build
65+
# Build your program with the given configuration. Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
66+
run: cmake --build ${{ github.workspace }}/codes/c/build --config ${{ matrix.build_type }}
67+
68+
- name: Test
69+
working-directory: ${{ github.workspace }}/codes/c/build
70+
# Execute tests defined by the CMake configuration. Note that --build-config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
71+
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
72+
run: ctest --build-config ${{ matrix.build_type }}
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# This starter workflow is for a CMake project running on multiple platforms. There is a different starter workflow if you just want a single platform.
2+
# See: https://github.com/actions/starter-workflows/blob/main/ci/cmake-single-platform.yml
3+
4+
name: C++
5+
6+
on:
7+
push:
8+
branches: ["main"]
9+
paths: ["codes/cpp/**/*.cpp", "codes/cpp/**/*.hpp"]
10+
pull_request:
11+
branches: ["main"]
12+
paths: ["codes/cpp/**/*.cpp", "codes/cpp/**/*.hpp"]
13+
workflow_dispatch:
14+
15+
jobs:
16+
build:
17+
runs-on: ${{ matrix.os }}
18+
19+
strategy:
20+
# Set fail-fast to false to ensure that feedback is delivered for all matrix combinations. Consider changing this to true when your workflow is stable.
21+
fail-fast: true
22+
23+
# Set up a matrix to run the following 3 configurations:
24+
# 1. <Windows, Release, latest MSVC compiler toolchain on the default runner image, default generator>
25+
# 2. <Linux, Release, latest GCC compiler toolchain on the default runner image, default generator>
26+
# 3. <Linux, Release, latest Clang compiler toolchain on the default runner image, default generator>
27+
#
28+
# To add more build types (Release, Debug, RelWithDebInfo, etc.) customize the build_type list.
29+
matrix:
30+
os: [ubuntu-latest, windows-latest]
31+
build_type: [Release]
32+
c_compiler: [gcc, clang, cl]
33+
include:
34+
- os: windows-latest
35+
c_compiler: cl
36+
cpp_compiler: cl
37+
- os: ubuntu-latest
38+
c_compiler: gcc
39+
cpp_compiler: g++
40+
- os: ubuntu-latest
41+
c_compiler: clang
42+
cpp_compiler: clang++
43+
exclude:
44+
- os: windows-latest
45+
c_compiler: gcc
46+
- os: windows-latest
47+
c_compiler: clang
48+
- os: ubuntu-latest
49+
c_compiler: cl
50+
51+
steps:
52+
- uses: actions/checkout@v4
53+
54+
- name: Configure CMake
55+
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
56+
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
57+
run: >
58+
cmake -B ${{ github.workspace }}/codes/cpp/build
59+
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }}
60+
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }}
61+
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
62+
-S ${{ github.workspace }}/codes/cpp
63+
64+
- name: Build
65+
# Build your program with the given configuration. Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
66+
run: cmake --build ${{ github.workspace }}/codes/cpp/build --config ${{ matrix.build_type }}
67+
68+
- name: Test
69+
working-directory: ${{ github.workspace }}/codes/cpp/build
70+
# Execute tests defined by the CMake configuration. Note that --build-config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
71+
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
72+
run: ctest --build-config ${{ matrix.build_type }}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# This workflow will install Dart SDK, run format, analyze and build with Dart
2+
3+
name: Dart
4+
5+
on:
6+
push:
7+
branches: ["main"]
8+
paths: ["codes/dart/**/*.dart"]
9+
pull_request:
10+
branches: ["main"]
11+
paths: ["codes/dart/**/*.dart"]
12+
workflow_dispatch:
13+
14+
permissions:
15+
contents: read
16+
17+
jobs:
18+
build:
19+
name: Dart ${{ matrix.dart-sdk }} on ${{ matrix.os }}
20+
runs-on: ${{ matrix.os }}
21+
strategy:
22+
matrix:
23+
os: [ubuntu-latest, macos-latest, windows-latest]
24+
dart-sdk: [stable]
25+
steps:
26+
- uses: actions/checkout@v4
27+
- name: Set up Dart ${{ matrix.dart-sdk }}
28+
uses: dart-lang/setup-dart@v1
29+
with:
30+
sdk: ${{ matrix.dart-sdk}}
31+
- name: Run format
32+
run: dart format codes/dart
33+
- name: Run analyze
34+
run: dart analyze codes/dart
35+
- name: Run build
36+
run: dart codes/dart/build.dart
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# This workflow will build a .NET project
2+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
3+
4+
name: .NET
5+
6+
on:
7+
push:
8+
branches: [ "main" ]
9+
paths: ["codes/csharp/**/*.cs"]
10+
pull_request:
11+
branches: [ "main" ]
12+
paths: ["codes/csharp/**/*.cs"]
13+
workflow_dispatch:
14+
15+
jobs:
16+
build:
17+
name: .NET ${{ matrix.dotnet-version }} on ${{ matrix.os }}
18+
runs-on: ${{ matrix.os }}
19+
defaults:
20+
run:
21+
working-directory: codes/csharp/
22+
strategy:
23+
matrix:
24+
os: [ubuntu-latest, macos-latest, windows-latest]
25+
dotnet-version: ["8.0.x"]
26+
27+
steps:
28+
- uses: actions/checkout@v4
29+
30+
- name: Setup .NET ${{ matrix.dotnet-version }}
31+
uses: actions/setup-dotnet@v3
32+
with:
33+
dotnet-version: ${{ matrix.dotnet-version }}
34+
- name: Restore dependencies
35+
run: dotnet restore hello-algo.csproj
36+
- name: Build
37+
run: dotnet build --no-restore hello-algo.csproj
38+
- name: Test with dotnet
39+
run: dotnet test hello-algo.csproj
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Go
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
paths: ["codes/go/**/*.go"]
7+
pull_request:
8+
branches: [ "main" ]
9+
paths: ["codes/go/**/*.go"]
10+
workflow_dispatch:
11+
12+
jobs:
13+
build:
14+
name: Go ${{ matrix.go-version }} on ${{ matrix.os }}
15+
runs-on: ${{ matrix.os }}
16+
defaults:
17+
run:
18+
working-directory: codes/go/
19+
strategy:
20+
matrix:
21+
os: [ubuntu-latest, macos-latest, windows-latest]
22+
go-version: ["1.19.x"]
23+
24+
steps:
25+
- uses: actions/checkout@v4
26+
27+
- name: Setup Go ${{ matrix.go-version }}
28+
uses: actions/setup-go@v3
29+
with:
30+
go-version: ${{ matrix.go-version }}
31+
- name: Check out code into the Go module directory
32+
run: go get -v -t -d ./...
33+
- name: Build
34+
run: go build -v ./...
35+
- name: Test with Go
36+
run: go test -v ./...
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# # This workflow will install OpenJDK and build the Java project
2+
# For more information see: https://github.com/actions/setup-java
3+
4+
name: Java
5+
6+
on:
7+
push:
8+
branches: [ "main" ]
9+
paths: ["codes/java/**/*.java"]
10+
pull_request:
11+
branches: [ "main" ]
12+
paths: ["codes/java/**/*.java"]
13+
workflow_dispatch:
14+
15+
jobs:
16+
build:
17+
runs-on: ubuntu-20.04
18+
strategy:
19+
matrix:
20+
java: [ '11', '17' ]
21+
name: Java ${{ matrix.Java }} sample
22+
steps:
23+
- uses: actions/checkout@v4
24+
- name: Setup java
25+
uses: actions/setup-java@v3
26+
with:
27+
distribution: 'temurin'
28+
java-version: ${{ matrix.java }}
29+
- run: javac -d codes/java/build codes/java/**/*.java
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: JavaScript
2+
3+
on:
4+
push:
5+
branches: ['main']
6+
paths: ['codes/javascript/**/*.js']
7+
pull_request:
8+
branches: ['main']
9+
paths: ['codes/javascript/**/*.js']
10+
workflow_dispatch:
11+
12+
jobs:
13+
build:
14+
runs-on: ${{ matrix.os }}
15+
strategy:
16+
matrix:
17+
os: [ubuntu-latest, macos-latest, windows-latest]
18+
steps:
19+
- uses: actions/checkout@v4
20+
- uses: actions/setup-node@v4
21+
with:
22+
node-version: 20.x
23+
- uses: denoland/setup-deno@v1
24+
with:
25+
deno-version: v1.x
26+
- name: Run JavaScript Code
27+
run: deno run -A codes/javascript/test_all.js

0 commit comments

Comments
 (0)