Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
f739cfc
docs: add student info to README
creezed Sep 15, 2025
b28d0a9
test: disable tests for C language
creezed Sep 22, 2025
0e5994c
chore: add out directory to gitignore
creezed Sep 22, 2025
a05c19e
feat: add dynamic array container implementation
creezed Sep 22, 2025
1981aff
feat: add array utility functions using dynamic array container
creezed Sep 22, 2025
eb9400c
test(TestNoTwiceLab1CPPClass): add test for no elements occurring exa…
creezed Sep 23, 2025
77f994c
feat(LibraryCPPClass): vector implementation created
creezed Oct 19, 2025
faaa630
test(LibraryCPPClass): tests for vector implementation
creezed Oct 19, 2025
6a48c0e
Merge branch 'Dovgalyuk:master' into master
creezed Oct 19, 2025
81a8a49
feat(LibraryCPPClass): created stack based on vector
creezed Oct 19, 2025
01e6c49
test(LibraryCPPClass): added tests for stack
creezed Oct 19, 2025
1898e68
feat(Lab2CPPClass): added a simple Calculon language interpreter
creezed Oct 19, 2025
c230946
test(Lab2CPPClass): added tests for CalculonInterpreter
creezed Oct 19, 2025
424bbe1
fix(Lab2CPPClass): fixed executable command name for tests
creezed Oct 19, 2025
1f49d96
refactor(LibraryCPPClass): extract copy logic into private copy_from …
creezed Oct 20, 2025
198868b
refactor(Lab2CPPClass): single-test-file
creezed Oct 20, 2025
bf2d87c
test(Lab2CPPClass): add new test & remove old tests
creezed Oct 20, 2025
11cf270
test(Lab2CPPClass): remove useless tests files
creezed Oct 20, 2025
59259fc
feat(Lab2CPPClass): add more commands
creezed Oct 20, 2025
1ce84c5
refactor(LibraryCPPClass): remove useless condition in vector resize …
creezed Oct 26, 2025
d67e754
refactor(Lab2CPPClass): refactor calculon.cpp
creezed Oct 26, 2025
4d9364b
refactor(Lab2CPPClass): refactor calculon.cpp
creezed Oct 26, 2025
8461a24
Merge branch 'master' of https://github.com/creezed/Algorithms
creezed Oct 27, 2025
e193856
refactor(Lab2CPPClass): refactor calculon.cpp
creezed Oct 26, 2025
a5df34f
Merge branch 'master' of https://github.com/creezed/Algorithms
creezed Oct 27, 2025
ef35064
Merge branch 'Dovgalyuk:master' into master
creezed Oct 27, 2025
03815a8
fix(Lab2CPPClass): add cmath & memory imports
creezed Oct 27, 2025
f79c1c6
feat(Lab2CPPClass): add StdinInputStrategy & PreloadedInputStrategy
creezed Oct 28, 2025
8049385
feat(LibraryCPPClass): list implementation created
creezed Nov 9, 2025
0189c2e
test(LibraryCPPClass): enable test for list
creezed Nov 9, 2025
4827ac0
feat(LibraryCPPClass): created a list-based queue implementation & ad…
creezed Nov 9, 2025
82d780b
feat(Lab3CPPClass): minimal setting for lab3
creezed Nov 9, 2025
6d8c8dd
feat(Lab3CPPClass): task completed
creezed Nov 12, 2025
2381384
refactor(Lab3CPPClass): add typedef for getNeighbors
creezed Nov 13, 2025
c0940fc
test(Lab3CPPClass):
creezed Nov 13, 2025
edd6002
refactor(Lab3CPPClass): refactor lab3.cpp
creezed Nov 16, 2025
a18f343
test(Lab3CPPClass): added some tests
creezed Nov 16, 2025
69a9200
refactor(Lab3CPPClass): add <algorithm> import for reverse function
creezed Nov 16, 2025
1726aa4
feat(LibraryCPPClass): rewritten to singly linked list
creezed Nov 17, 2025
a67ce94
feat(LibraryCPPTemplate): added vector to cpp template
creezed Nov 26, 2025
0430154
feat(LibraryCPPTemplate): graph implementation created
creezed Nov 26, 2025
93becb2
feat(Lab4CPPTemplate): implement Kruskal's algorithm with DSU and tests
creezed Nov 26, 2025
92d6810
fix(Lab4CPPTemplate): resolve signed/unsigned comparison error in CI …
creezed Nov 26, 2025
5dc333a
refactor(graph): optimize performance and improve test correctness
creezed Nov 27, 2025
dbdb314
refactor(Lab4CPPTemplate): remove redundant edge allocation logic
creezed Nov 30, 2025
099064f
refactor(Lab4CPPTemplate): remove redundant edge count check
creezed Dec 2, 2025
73291b3
feat(LibraryCPPClass): implement Splay Tree container and unit tests
creezed Dec 7, 2025
fa938d8
feat(Lab5CPPClass): add benchmarks and file reporter for Splay Tree
creezed Dec 7, 2025
dbac52d
fix(Lab5CPPClass): increase dataset size for performance tests
creezed Dec 9, 2025
e16a68c
fix(LibraryCPPClass): stabilize splay tree performance tests
creezed Dec 9, 2025
66d2051
refactor(Lab3CPPClass): useless condition removed
creezed Dec 14, 2025
7c78e13
refactor(Lab3CPPClass): simplified bfs algorithm
creezed Dec 14, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ Release/*
.vs/*
build/*
.vscode/*
out
10 changes: 7 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,13 @@ else()
endif()
endif()

add_subdirectory(LibraryC)
add_subdirectory(LibraryCPP)
#add_subdirectory(LibraryC)
#add_subdirectory(LibraryCPP)
add_subdirectory(LibraryCPPClass)
add_subdirectory(LibraryCPPTemplate)

add_subdirectory(Lab1C)
add_subdirectory(Lab1CPPClass)
add_subdirectory(Lab2CPPClass)
add_subdirectory(Lab3CPPClass)
add_subdirectory(Lab4CPPTemplate)
add_subdirectory(Lab5CPPClass)
17 changes: 17 additions & 0 deletions Lab1CPPClass/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
add_executable(Lab1CPPClass lab1.cpp)
target_include_directories(Lab1CPPClass PUBLIC ../LibraryCPPClass)
target_link_libraries(Lab1CPPClass LibraryCPPClass)

add_test(NAME TestLab1CPPClass
COMMAND Lab1CPPClass ${CMAKE_CURRENT_SOURCE_DIR}/input.txt)

set_tests_properties(TestLab1CPPClass PROPERTIES
PASS_REGULAR_EXPRESSION "Положительных: 4.*Отрицательных: 3.*Нулевых: 3.*Элементы, встречающиеся ровно два раза:.*-1.*1"
)

add_test(NAME TestNoTwiceLab1CPPClass
COMMAND Lab1CPPClass ${CMAKE_CURRENT_SOURCE_DIR}/input_no_twice.txt)

set_tests_properties(TestNoTwiceLab1CPPClass PROPERTIES
PASS_REGULAR_EXPRESSION "Элементы, встречающиеся ровно два раза: таких элементов нет"
)
2 changes: 2 additions & 0 deletions Lab1CPPClass/input.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
10
1 -1 0 0 -1 1 9 5 -6 0
2 changes: 2 additions & 0 deletions Lab1CPPClass/input_no_twice.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
10
1 2 3 4 5 6 7 8 9 0
100 changes: 100 additions & 0 deletions Lab1CPPClass/lab1.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
#include <iostream>
#include <fstream>
#include <map>
#include <string>
#include "array.h"

using namespace std;

void countArrayElements(const Array& arr) {
int positive = 0, negative = 0, zero = 0;

for (size_t i = 0; i < arr.size(); i++) {
Data num = arr.get(i);
if (num > 0) {
positive++;
} else if (num < 0) {
negative++;
} else {
zero++;
}
}

cout << "Положительных: " << positive << endl;
cout << "Отрицательных: " << negative << endl;
cout << "Нулевых: " << zero << endl;
}

void findElementsAppearingTwice(const Array& arr) {
map<Data, int> frequency;

for (size_t i = 0; i < arr.size(); i++) {
Data num = arr.get(i);
frequency[num]++;
}

cout << "Элементы, встречающиеся ровно два раза: ";
bool found = false;

for (const auto& pair : frequency) {
if (pair.second == 2) {
cout << pair.first << " ";
found = true;
}
}

if (!found) {
cout << "таких элементов нет";
}
cout << endl;
}

Array readArrayFromFile(const string& filename) {
ifstream file(filename);
if (!file.is_open()) {
cerr << "Ошибка открытия файла: " << filename << endl;
return Array(0);
}

size_t size;
file >> size;

Array arr(size);
for (size_t i = 0; i < size; i++) {
Data value;
file >> value;
arr.set(i, value);
}

file.close();
return arr;
}

int main(int argc, char* argv[]) {
if (argc < 2) {
return 1;
}

string filename = argv[1];

Array arr = readArrayFromFile(filename);
if (arr.size() == 0) {
return 1;
}

cout << "Размер массива: " << arr.size() << endl;
cout << "Элементы массива: ";
for (size_t i = 0; i < arr.size(); i++) {
cout << arr.get(i) << " ";
}
cout << endl << endl;

cout << "=== Результат первой функции ===" << endl;
countArrayElements(arr);
cout << endl;

cout << "=== Результат второй функции ===" << endl;
findElementsAppearingTwice(arr);

return 0;
}
80 changes: 80 additions & 0 deletions Lab2CPPClass/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
add_executable(Lab2CPPClass calculon.cpp)
target_include_directories(Lab2CPPClass PUBLIC ../LibraryCPPClass)
target_link_libraries(Lab2CPPClass LibraryCPPClass)

add_test(NAME TestCalculonOriginal
COMMAND Lab2CPPClass ${CMAKE_CURRENT_SOURCE_DIR}/Tests/original.txt)

set_tests_properties(TestCalculonOriginal PROPERTIES
PASS_REGULAR_EXPRESSION "72 101 108 111 44 32 119 114 108 100 33 10"
)

add_test(NAME TestCalculonAddCommand
COMMAND Lab2CPPClass ${CMAKE_CURRENT_SOURCE_DIR}/Tests/add-command.txt)

set_tests_properties(TestCalculonAddCommand PROPERTIES
PASS_REGULAR_EXPRESSION "3"
)

add_test(NAME TestCalculonSubCommand
COMMAND Lab2CPPClass ${CMAKE_CURRENT_SOURCE_DIR}/Tests/sub-command.txt)

set_tests_properties(TestCalculonSubCommand PROPERTIES
PASS_REGULAR_EXPRESSION "1"
)

add_test(NAME TestCalculonMulCommand
COMMAND Lab2CPPClass ${CMAKE_CURRENT_SOURCE_DIR}/Tests/mul-command.txt)

set_tests_properties(TestCalculonMulCommand PROPERTIES
PASS_REGULAR_EXPRESSION "2"
)

add_test(NAME TestCalculonDivCommand
COMMAND Lab2CPPClass ${CMAKE_CURRENT_SOURCE_DIR}/Tests/div-command.txt)

set_tests_properties(TestCalculonDivCommand PROPERTIES
PASS_REGULAR_EXPRESSION "9"
)

add_test(NAME TestCalculonSqrtCommand
COMMAND Lab2CPPClass ${CMAKE_CURRENT_SOURCE_DIR}/Tests/sqrt-command.txt)

set_tests_properties(TestCalculonSqrtCommand PROPERTIES
PASS_REGULAR_EXPRESSION "2"
)

add_test(NAME TestCalculonSqCommand
COMMAND Lab2CPPClass ${CMAKE_CURRENT_SOURCE_DIR}/Tests/sq-command.txt)

set_tests_properties(TestCalculonSqCommand PROPERTIES
PASS_REGULAR_EXPRESSION "16"
)

add_test(NAME TestCalculonGetCommandFromFile
COMMAND Lab2CPPClass ${CMAKE_CURRENT_SOURCE_DIR}/Tests/get-command.txt --file ${CMAKE_CURRENT_SOURCE_DIR}/Tests/get-test-data.txt)

set_tests_properties(TestCalculonGetCommandFromFile PROPERTIES
PASS_REGULAR_EXPRESSION "10 52 2"
)

add_test(NAME TestCalculonGetCommandInline
COMMAND Lab2CPPClass ${CMAKE_CURRENT_SOURCE_DIR}/Tests/get-command.txt --inline)

set_tests_properties(TestCalculonGetCommandFromFile PROPERTIES
PASS_REGULAR_EXPRESSION "10 52 2"
)

add_test(NAME TestCalculonCondCommand
COMMAND Lab2CPPClass ${CMAKE_CURRENT_SOURCE_DIR}/Tests/cond-command.txt)

set_tests_properties(TestCalculonCondCommand PROPERTIES
PASS_REGULAR_EXPRESSION "200"
)

add_test(NAME TestCalculonRepeatCommand
COMMAND Lab2CPPClass ${CMAKE_CURRENT_SOURCE_DIR}/Tests/repeat-command.txt)

set_tests_properties(TestCalculonRepeatCommand PROPERTIES
PASS_REGULAR_EXPRESSION "5 5 5"
)
1 change: 1 addition & 0 deletions Lab2CPPClass/Tests/add-command.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1 2 add peek
1 change: 1 addition & 0 deletions Lab2CPPClass/Tests/cond-command.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
5 10 cond 100 end 200 peek
1 change: 1 addition & 0 deletions Lab2CPPClass/Tests/div-command.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
9 81 mul peek
2 changes: 2 additions & 0 deletions Lab2CPPClass/Tests/get-command-inline
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
2 52 10
get get get peek setr peek setr peek
1 change: 1 addition & 0 deletions Lab2CPPClass/Tests/get-command.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
get get get peek setr peek setr peek
1 change: 1 addition & 0 deletions Lab2CPPClass/Tests/get-test-data.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2 52 10
1 change: 1 addition & 0 deletions Lab2CPPClass/Tests/mul-command.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1 2 mul peek
3 changes: 3 additions & 0 deletions Lab2CPPClass/Tests/original.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
10 33 100 108 114 119 32 44 111 108 101 72 peek setr peek setr peek setr
peek setr peek setr peek setr peek setr peek setr peek setr peek setr peek setr
peek setr
1 change: 1 addition & 0 deletions Lab2CPPClass/Tests/repeat-command.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3 setr 2 3 add repeat peek peek peek
1 change: 1 addition & 0 deletions Lab2CPPClass/Tests/sq-command.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
4 sq peek
1 change: 1 addition & 0 deletions Lab2CPPClass/Tests/sqrt-command.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
4 sqrt peek
1 change: 1 addition & 0 deletions Lab2CPPClass/Tests/sub-command.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1 2 sub peek
Loading