diff --git a/Lab_1/Data_Structure.cpp b/Lab_1/Data_Structure.cpp deleted file mode 100644 index 16afe1c..0000000 --- a/Lab_1/Data_Structure.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "Data_Structure.h" diff --git a/Lab_1/Data_Structure.h b/Lab_1/Data_Structure.h deleted file mode 100644 index 68c2813..0000000 --- a/Lab_1/Data_Structure.h +++ /dev/null @@ -1,42 +0,0 @@ -//#include -//#include -// -//#pragma once -// -//struct Node { -// int data; -// Node* next; -//}; -// -//class Data_Structure -//{ -//private: -// Node* head; -// struct Node { -// int data; -// Node* next; -// }; -//public: -// Data_Structure(){ -// head = NULL; -// } -// void addNode(int val){ -// Node* newNode = new Node; -// newNode->data = val; -// newNode->next = head; -// head = newNode; -// -// -// } -// void printList() { -// Node* currentNode = head; -// while (currentNode->next != NULL) { -// printf("%d", currentNode->data); -// currentNode = currentNode->next; -// -// } -// -// -// } -//}; -// diff --git a/Lab_1/Lab_1.sln b/Lab_1/Lab_1.sln deleted file mode 100644 index 76a53c9..0000000 --- a/Lab_1/Lab_1.sln +++ /dev/null @@ -1,31 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 17 -VisualStudioVersion = 17.7.34024.191 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Lab_1", "Lab_1.vcxproj", "{B3B62C1B-E8D8-4038-8DFD-248406A48EE2}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|x64 = Debug|x64 - Debug|x86 = Debug|x86 - Release|x64 = Release|x64 - Release|x86 = Release|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {B3B62C1B-E8D8-4038-8DFD-248406A48EE2}.Debug|x64.ActiveCfg = Debug|x64 - {B3B62C1B-E8D8-4038-8DFD-248406A48EE2}.Debug|x64.Build.0 = Debug|x64 - {B3B62C1B-E8D8-4038-8DFD-248406A48EE2}.Debug|x86.ActiveCfg = Debug|Win32 - {B3B62C1B-E8D8-4038-8DFD-248406A48EE2}.Debug|x86.Build.0 = Debug|Win32 - {B3B62C1B-E8D8-4038-8DFD-248406A48EE2}.Release|x64.ActiveCfg = Release|x64 - {B3B62C1B-E8D8-4038-8DFD-248406A48EE2}.Release|x64.Build.0 = Release|x64 - {B3B62C1B-E8D8-4038-8DFD-248406A48EE2}.Release|x86.ActiveCfg = Release|Win32 - {B3B62C1B-E8D8-4038-8DFD-248406A48EE2}.Release|x86.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {FF15C0FB-D559-46A6-B4E8-E461B8F5C363} - EndGlobalSection -EndGlobal diff --git a/Lab_1/Lab_1.vcxproj b/Lab_1/Lab_1.vcxproj deleted file mode 100644 index 0d6ac74..0000000 --- a/Lab_1/Lab_1.vcxproj +++ /dev/null @@ -1,139 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - 17.0 - Win32Proj - {b3b62c1b-e8d8-4038-8dfd-248406a48ee2} - Lab1 - 10.0 - - - - Application - true - v143 - Unicode - - - Application - false - v143 - true - Unicode - - - Application - true - v143 - Unicode - - - Application - false - v143 - true - Unicode - - - - - - - - - - - - - - - - - - - - - - Level3 - true - WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - - - Console - true - - - - - Level3 - true - true - true - WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - - - Console - true - true - true - - - - - Level3 - true - _DEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - - - Console - true - - - - - Level3 - true - true - true - NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - - - Console - true - true - true - - - - - - - - - - - - - \ No newline at end of file diff --git a/Lab_1/Lab_1.vcxproj.filters b/Lab_1/Lab_1.vcxproj.filters deleted file mode 100644 index 6d47a77..0000000 --- a/Lab_1/Lab_1.vcxproj.filters +++ /dev/null @@ -1,30 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - - - Исходные файлы - - - Исходные файлы - - - - - Файлы заголовков - - - \ No newline at end of file diff --git a/Lab_1/Source.cpp b/Lab_1/Source.cpp deleted file mode 100644 index bbe0097..0000000 --- a/Lab_1/Source.cpp +++ /dev/null @@ -1,199 +0,0 @@ -/* - 4 - - - - - - , - , -*/ - -#include -#include -#include "Data_Structure.h" - -int unsorted_array[10] = { 2, 5, 1,8,3,4,7,6,9,0 }; -int arr[10] = { 2, 5, 1,8,3,4,7,6,9,0 }; -int n = 10; - -void Buble_sort() { - for (int i = 0; i < n; i++) { - for (int j = n - 1; j > i; j--) { - if (arr[j - 1] > arr[j]) { - int temp = arr[j]; - arr[j] = arr[j - 1]; - arr[j - 1] = temp; - } - } - } -} - - -void Merge(int arr[], int begin, int end) { - int mid = begin + (end - begin) / 2; - int i = begin; - int j = mid + 1; - int d[11] = { 0 }; - int k = 0; - - while (i <= mid && j <= end) { - if (arr[i] <= arr[j]) { - d[k] = arr[i]; - i++; - } - else { - d[k] = arr[j]; - j++; - } - k++; - } - while (i <= mid) { - d[k] = arr[i]; - k++; - i++; - } - while (j <= end) { - d[k] = arr[j]; - k++; - j++; - } - for (i = 0; i < k; i++) { - arr[begin + i] = d[i]; - } - -} - -void Merge_sort(int* arr, int left, int right) { - int temp = 0; - if (left < right) { - if (right - left == 1) { - if (arr[left] > arr[right]) { - temp = arr[left]; - arr[left] = arr[right]; - arr[right] = temp; - } - } - else { - Merge_sort(arr, left, (right - left) / 2); - Merge_sort(arr, left + (right - left) / 2 + 1, right); - Merge(arr, left, right); - } - } - -} - - -void Shake_sort() { - int direction = 0; - int left = arr[0]; - int left_index = 0; - int right = arr[n]; - int right_index = n; - for (int _ = 0; _ < n - 1; _++) { - if (direction == 0) { - for (int i = left_index; i < right_index - 1; i++) { - if (arr[i] > arr[i + 1]) { - int temp = arr[i]; - arr[i] = arr[i + 1]; - arr[i + 1] = temp; - } - } - if (right != arr[right_index]) { - for (int i = n; i > 0; i--) { - if (arr[i] == right) { - right_index = i; - } - } - } - direction = 1; - } - else { - for (int j = right_index; j > left_index; j--) { - if (arr[j] < arr[j - 1]) { - int temp1 = arr[j]; - arr[j] = arr[j - 1]; - arr[j - 1] = temp1; - } - } - if (left != arr[left_index]) { - for (int i = 0; i < n; i++) { - if (arr[i] == left) { - left_index = i; - } - } - } - } - direction = 0; - } - -} - -void print_list() { - for (int i = 0; i < n; i++) { - printf("%d ", arr[i]); - } - printf("\n"); -} - - - -struct Node { - int student_year; - int student_group; - struct Node* next; - - -}; - -struct Node* first = NULL; - - - -void s_addToHead(int year, int group) { - struct Node* NewNode = (struct Node*)malloc(sizeof(NewNode)); - NewNode->student_year = year; - NewNode->student_group = group; - NewNode->next = first; - - first = NewNode; - -} - -void s_deleteFromHead() { - struct Node* DelNode = first; - int val1 = DelNode->student_year; - int val2 = DelNode->student_group; - - first = first->next; - printf("****|PI-%d, %d| - Deleted\n", val2, val1); - -} - -void s_print() { - struct Node* i = first; - while (i) { - printf("|PI-%d, %d|\n", i->student_group, i->student_year); - i = i->next; - } - - -} - - -int main() { - s_addToHead(2020, 12); - s_addToHead(2021, 13); - s_addToHead(2022, 14); - s_addToHead(2024, 15); - s_print(); - printf("------------------------\n"); - s_deleteFromHead(); - s_print(); - - print_list(); - Shake_sort(); - //Merge_sort(arr, 0, n - 1); - print_list(); - //Data_structure newStructure; - - - return 0; -} \ No newline at end of file