Skip to content

Commit

Permalink
Merge pull request #1 from AlgorithmsDafeMipt2024/main
Browse files Browse the repository at this point in the history
1
  • Loading branch information
dalnoboy75 authored Mar 24, 2024
2 parents 0afaec5 + e7f9663 commit 74ad1a1
Show file tree
Hide file tree
Showing 22 changed files with 292 additions and 1 deletion.
32 changes: 32 additions & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,35 @@ jobs:
- name: make
working-directory: ${{github.workspace}}/build
run: make

- name: Test task 01
working-directory: ${{github.workspace}}/build
run: ./task_01/task_01_tests

- name: Test task 02
working-directory: ${{github.workspace}}/build
run: ./task_02/task_02_tests

- name: Test task 03
working-directory: ${{github.workspace}}/build
run: ./task_03/task_03_tests

- name: Test task 04
working-directory: ${{github.workspace}}/build
run: ./task_04/task_04_tests

- name: Test task 05
working-directory: ${{github.workspace}}/build
run: ./task_05/task_05_tests

- name: Test task 06
working-directory: ${{github.workspace}}/build
run: ./task_06/task_06_tests

- name: Test task 07
working-directory: ${{github.workspace}}/build
run: ./task_07/task_07_tests

- name: Test task 08
working-directory: ${{github.workspace}}/build
run: ./task_08/task_08_tests
2 changes: 1 addition & 1 deletion task_01/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Задача 1

Дано целое число и массив целых чисел, нужно найти 2 числа из массива которые в сумме дадут заданное число
Дано целое число и отсортированый массив целых чисел, нужно найти 2 числа из массива которые в сумме дадут заданное число
39 changes: 39 additions & 0 deletions task_04/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
cmake_minimum_required(VERSION 3.10)

get_filename_component(PROJECT_NAME ${CMAKE_CURRENT_LIST_DIR} NAME)
string(REPLACE " " "_" PROJECT_NAME ${PROJECT_NAME})
project(${PROJECT_NAME} C CXX)

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

file(GLOB_RECURSE source_list "src/*.cpp" "src/*.hpp")
file(GLOB_RECURSE lib_source_list "../lib/src/*.cpp" "../lib/src/*.hpp")
file(GLOB_RECURSE main_source_list "src/main.cpp")
file(GLOB_RECURSE test_source_list "src/*.cpp")
file(GLOB_RECURSE test_list "src/*test.cpp")

list(REMOVE_ITEM test_source_list ${main_source_list})
list(REMOVE_ITEM source_list ${test_list})

include_directories(${PROJECT_NAME} PUBLIC src)
include_directories(${PROJECT_NAME} PUBLIC ../lib/src)

add_executable(${PROJECT_NAME} ${source_list})
target_link_libraries(${PROJECT_NAME} PUBLIC Utils)

# Locate GTest
enable_testing()
find_package(GTest REQUIRED)
include_directories(${GTEST_INCLUDE_DIRS})

# Link runTests with what we want to test and the GTest and pthread library
add_executable(${PROJECT_NAME}_tests ${test_source_list})
target_link_libraries(
${PROJECT_NAME}_tests
GTest::gtest_main
Utils
)

include(GoogleTest)
gtest_discover_tests(${PROJECT_NAME}_tests)
3 changes: 3 additions & 0 deletions task_04/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Задача на кучу

В данной задаче необходимо реализовать [кучу](https://ru.wikipedia.org/wiki/%D0%94%D0%B2%D0%BE%D0%B8%D1%87%D0%BD%D0%B0%D1%8F_%D0%BA%D1%83%D1%87%D0%B0), можно пользоваться std::vector
3 changes: 3 additions & 0 deletions task_04/src/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#include <iostream>

int main() { return 0; }
6 changes: 6 additions & 0 deletions task_04/src/test.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

#include <gtest/gtest.h>

TEST(TopologySort, Simple) {
ASSERT_EQ(1, 1); // Stack []
}
39 changes: 39 additions & 0 deletions task_05/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
cmake_minimum_required(VERSION 3.10)

get_filename_component(PROJECT_NAME ${CMAKE_CURRENT_LIST_DIR} NAME)
string(REPLACE " " "_" PROJECT_NAME ${PROJECT_NAME})
project(${PROJECT_NAME} C CXX)

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

file(GLOB_RECURSE source_list "src/*.cpp" "src/*.hpp")
file(GLOB_RECURSE lib_source_list "../lib/src/*.cpp" "../lib/src/*.hpp")
file(GLOB_RECURSE main_source_list "src/main.cpp")
file(GLOB_RECURSE test_source_list "src/*.cpp")
file(GLOB_RECURSE test_list "src/*test.cpp")

list(REMOVE_ITEM test_source_list ${main_source_list})
list(REMOVE_ITEM source_list ${test_list})

include_directories(${PROJECT_NAME} PUBLIC src)
include_directories(${PROJECT_NAME} PUBLIC ../lib/src)

add_executable(${PROJECT_NAME} ${source_list})
target_link_libraries(${PROJECT_NAME} PUBLIC Utils)

# Locate GTest
enable_testing()
find_package(GTest REQUIRED)
include_directories(${GTEST_INCLUDE_DIRS})

# Link runTests with what we want to test and the GTest and pthread library
add_executable(${PROJECT_NAME}_tests ${test_source_list})
target_link_libraries(
${PROJECT_NAME}_tests
GTest::gtest_main
Utils
)

include(GoogleTest)
gtest_discover_tests(${PROJECT_NAME}_tests)
7 changes: 7 additions & 0 deletions task_05/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Задача на сортировку

В данной задаче необходимо реализовать сортировку одним из эфективных алгоритмов

* Merge sort
* Quick sort
* Heap sort
3 changes: 3 additions & 0 deletions task_05/src/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#include <iostream>

int main() { return 0; }
6 changes: 6 additions & 0 deletions task_05/src/test.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

#include <gtest/gtest.h>

TEST(TopologySort, Simple) {
ASSERT_EQ(1, 1); // Stack []
}
39 changes: 39 additions & 0 deletions task_06/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
cmake_minimum_required(VERSION 3.10)

get_filename_component(PROJECT_NAME ${CMAKE_CURRENT_LIST_DIR} NAME)
string(REPLACE " " "_" PROJECT_NAME ${PROJECT_NAME})
project(${PROJECT_NAME} C CXX)

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

file(GLOB_RECURSE source_list "src/*.cpp" "src/*.hpp")
file(GLOB_RECURSE lib_source_list "../lib/src/*.cpp" "../lib/src/*.hpp")
file(GLOB_RECURSE main_source_list "src/main.cpp")
file(GLOB_RECURSE test_source_list "src/*.cpp")
file(GLOB_RECURSE test_list "src/*test.cpp")

list(REMOVE_ITEM test_source_list ${main_source_list})
list(REMOVE_ITEM source_list ${test_list})

include_directories(${PROJECT_NAME} PUBLIC src)
include_directories(${PROJECT_NAME} PUBLIC ../lib/src)

add_executable(${PROJECT_NAME} ${source_list})
target_link_libraries(${PROJECT_NAME} PUBLIC Utils)

# Locate GTest
enable_testing()
find_package(GTest REQUIRED)
include_directories(${GTEST_INCLUDE_DIRS})

# Link runTests with what we want to test and the GTest and pthread library
add_executable(${PROJECT_NAME}_tests ${test_source_list})
target_link_libraries(
${PROJECT_NAME}_tests
GTest::gtest_main
Utils
)

include(GoogleTest)
gtest_discover_tests(${PROJECT_NAME}_tests)
3 changes: 3 additions & 0 deletions task_06/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Задача на порядковые статистики

В данной задаче необходимо реализовать поиск n-ой порядковой статистики
3 changes: 3 additions & 0 deletions task_06/src/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#include <iostream>

int main() { return 0; }
6 changes: 6 additions & 0 deletions task_06/src/test.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

#include <gtest/gtest.h>

TEST(TopologySort, Simple) {
ASSERT_EQ(1, 1); // Stack []
}
39 changes: 39 additions & 0 deletions task_07/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
cmake_minimum_required(VERSION 3.10)

get_filename_component(PROJECT_NAME ${CMAKE_CURRENT_LIST_DIR} NAME)
string(REPLACE " " "_" PROJECT_NAME ${PROJECT_NAME})
project(${PROJECT_NAME} C CXX)

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

file(GLOB_RECURSE source_list "src/*.cpp" "src/*.hpp")
file(GLOB_RECURSE lib_source_list "../lib/src/*.cpp" "../lib/src/*.hpp")
file(GLOB_RECURSE main_source_list "src/main.cpp")
file(GLOB_RECURSE test_source_list "src/*.cpp")
file(GLOB_RECURSE test_list "src/*test.cpp")

list(REMOVE_ITEM test_source_list ${main_source_list})
list(REMOVE_ITEM source_list ${test_list})

include_directories(${PROJECT_NAME} PUBLIC src)
include_directories(${PROJECT_NAME} PUBLIC ../lib/src)

add_executable(${PROJECT_NAME} ${source_list})
target_link_libraries(${PROJECT_NAME} PUBLIC Utils)

# Locate GTest
enable_testing()
find_package(GTest REQUIRED)
include_directories(${GTEST_INCLUDE_DIRS})

# Link runTests with what we want to test and the GTest and pthread library
add_executable(${PROJECT_NAME}_tests ${test_source_list})
target_link_libraries(
${PROJECT_NAME}_tests
GTest::gtest_main
Utils
)

include(GoogleTest)
gtest_discover_tests(${PROJECT_NAME}_tests)
3 changes: 3 additions & 0 deletions task_07/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Задача на дерево поиска

В данной задаче необходимо реализовать дерево поиска
3 changes: 3 additions & 0 deletions task_07/src/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#include <iostream>

int main() { return 0; }
6 changes: 6 additions & 0 deletions task_07/src/test.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

#include <gtest/gtest.h>

TEST(TopologySort, Simple) {
ASSERT_EQ(1, 1); // Stack []
}
39 changes: 39 additions & 0 deletions task_08/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
cmake_minimum_required(VERSION 3.10)

get_filename_component(PROJECT_NAME ${CMAKE_CURRENT_LIST_DIR} NAME)
string(REPLACE " " "_" PROJECT_NAME ${PROJECT_NAME})
project(${PROJECT_NAME} C CXX)

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

file(GLOB_RECURSE source_list "src/*.cpp" "src/*.hpp")
file(GLOB_RECURSE lib_source_list "../lib/src/*.cpp" "../lib/src/*.hpp")
file(GLOB_RECURSE main_source_list "src/main.cpp")
file(GLOB_RECURSE test_source_list "src/*.cpp")
file(GLOB_RECURSE test_list "src/*test.cpp")

list(REMOVE_ITEM test_source_list ${main_source_list})
list(REMOVE_ITEM source_list ${test_list})

include_directories(${PROJECT_NAME} PUBLIC src)
include_directories(${PROJECT_NAME} PUBLIC ../lib/src)

add_executable(${PROJECT_NAME} ${source_list})
target_link_libraries(${PROJECT_NAME} PUBLIC Utils)

# Locate GTest
enable_testing()
find_package(GTest REQUIRED)
include_directories(${GTEST_INCLUDE_DIRS})

# Link runTests with what we want to test and the GTest and pthread library
add_executable(${PROJECT_NAME}_tests ${test_source_list})
target_link_libraries(
${PROJECT_NAME}_tests
GTest::gtest_main
Utils
)

include(GoogleTest)
gtest_discover_tests(${PROJECT_NAME}_tests)
3 changes: 3 additions & 0 deletions task_08/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Задача на хэш таблицу

В данной задаче необходимо реализовать хэш таблицу
3 changes: 3 additions & 0 deletions task_08/src/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#include <iostream>

int main() { return 0; }
6 changes: 6 additions & 0 deletions task_08/src/test.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

#include <gtest/gtest.h>

TEST(TopologySort, Simple) {
ASSERT_EQ(1, 1); // Stack []
}

0 comments on commit 74ad1a1

Please sign in to comment.