This commit is contained in:
2025-02-21 13:17:35 +01:00
commit e6bb2d584f
135 changed files with 141834 additions and 0 deletions

8
.idea/.gitignore generated vendored Normal file
View File

@@ -0,0 +1,8 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

1
.idea/.name generated Normal file
View File

@@ -0,0 +1 @@
ADS_Praktikum

2
.idea/Praktikum.iml generated Normal file
View File

@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<module classpath="CMake" type="CPP_MODULE" version="4" />

103
.idea/editor.xml generated Normal file
View File

@@ -0,0 +1,103 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="BackendCodeEditorSettings">
<option name="/Default/Housekeeping/GlobalSettingsUpgraded/IsUpgraded/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppClangFormat/EnableClangFormatSupport/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/EditorConfig/EnableClangFormatSupport/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_BINARY_EXPRESSIONS_CHAIN/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_CALLS_CHAIN/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_EXPRESSION/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_FOR_STMT/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTIPLE_DECLARATION/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_TERNARY/@EntryValue" value="ALIGN_ALL" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/BLANK_LINES_AROUND_CLASS_DEFINITION/@EntryValue" value="1" type="int" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/KEEP_BLANK_LINES_IN_DECLARATIONS/@EntryValue" value="2" type="int" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/KEEP_BLANK_LINES_IN_CODE/@EntryValue" value="2" type="int" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/KEEP_USER_LINEBREAKS/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INDENT_CASE_FROM_SWITCH/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INDENT_COMMENT/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INT_ALIGN_EQ/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SIMPLE_BLOCK_STYLE/@EntryValue" value="DO_NOT_CHANGE" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_COMMA_IN_TEMPLATE_ARGS/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_COMMA_IN_TEMPLATE_PARAMS/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_FOR_SEMICOLON/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_FOR_SEMICOLON/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_UNARY_OPERATOR/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_ARRAY_ACCESS_BRACKETS/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_CAST_EXPRESSION_PARENTHESES/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_EMPTY_INITIALIZER_BRACES/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_EMPTY_METHOD_PARENTHESES/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_INITIALIZER_BRACES/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPECIAL_ELSE_IF_TREATMENT/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_CAST_EXPRESSION_PARENTHESES/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_AFTER_BINARY_OPSIGN/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_BEFORE_TERNARY_OPSIGNS/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/TYPE_DECLARATION_BRACES/@EntryValue" value="END_OF_LINE" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/OTHER_BRACES/@EntryValue" value="END_OF_LINE" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/CASE_BLOCK_BRACES/@EntryValue" value="END_OF_LINE" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/BLANK_LINES_AROUND_FUNCTION_DECLARATION/@EntryValue" value="1" type="int" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/BLANK_LINES_AROUND_FUNCTION_DEFINITION/@EntryValue" value="1" type="int" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/PLACE_WHILE_ON_NEW_LINE/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/PLACE_ELSE_ON_NEW_LINE/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/PLACE_CATCH_ON_NEW_LINE/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/NAMESPACE_INDENTATION/@EntryValue" value="All" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_ARGUMENT/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_EXTENDS_LIST/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_PARAMETER/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_TYPE_ARGUMENT/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_TYPE_PARAMETER/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/BLANK_LINES_AROUND_DECLARATIONS/@EntryValue" value="0" type="int" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INDENT_ACCESS_SPECIFIERS_FROM_CLASS/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INDENT_CLASS_MEMBERS_FROM_ACCESS_SPECIFIERS/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/LINE_BREAK_AFTER_COLON_IN_MEMBER_INITIALIZER_LISTS/@EntryValue" value="ON_SINGLE_LINE" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/MEMBER_INITIALIZER_LIST_STYLE/@EntryValue" value="DO_NOT_CHANGE" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/PLACE_NAMESPACE_DEFINITIONS_ON_SAME_LINE/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_COLON_IN_BITFIELD_DECLARATOR/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_COLON_IN_BITFIELD_DECLARATOR/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_EXTENDS_COLON/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_EXTENDS_COLON/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_FOR_COLON/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_FOR_COLON/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_PTR_IN_DATA_MEMBER/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_PTR_IN_DATA_MEMBERS/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_PTR_IN_METHOD/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_PTR_IN_NESTED_DECLARATOR/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_REF_IN_DATA_MEMBER/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_REF_IN_DATA_MEMBERS/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_REF_IN_METHOD/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_PTR_IN_ABSTRACT_DECL/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_PTR_IN_DATA_MEMBER/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_PTR_IN_DATA_MEMBERS/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_PTR_IN_METHOD/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_REF_IN_ABSTRACT_DECL/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_REF_IN_DATA_MEMBER/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_REF_IN_DATA_MEMBERS/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_REF_IN_METHOD/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_TEMPLATE_ARGS/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_TEMPLATE_PARAMS/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BETWEEN_CLOSING_ANGLE_BRACKETS_IN_TEMPLATE_ARGS/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_EMPTY_TEMPLATE_PARAMS/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_TEMPLATE_ARGS/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_TEMPLATE_PARAMS/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_DECLARATION_PARENTHESES/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_EMPTY_BLOCKS/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_BEFORE_INVOCATION_LPAR/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_AFTER_INVOCATION_LPAR/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_BEFORE_INVOCATION_RPAR/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_BEFORE_DECLARATION_LPAR/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_AFTER_DECLARATION_LPAR/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_BEFORE_DECLARATION_RPAR/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_ARGUMENTS_STYLE/@EntryValue" value="WRAP_IF_LONG" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_PARAMETERS_STYLE/@EntryValue" value="WRAP_IF_LONG" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/BREAK_TEMPLATE_DECLARATION/@EntryValue" value="LINE_BREAK" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/NAMESPACE_DECLARATION_BRACES/@EntryValue" value="END_OF_LINE" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/FREE_BLOCK_BRACES/@EntryValue" value="END_OF_LINE" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INVOCABLE_DECLARATION_BRACES/@EntryValue" value="END_OF_LINE" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ANONYMOUS_METHOD_DECLARATION_BRACES/@EntryValue" value="END_OF_LINE" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INITIALIZER_BRACES/@EntryValue" value="END_OF_LINE_NO_SPACE" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INDENT_STYLE/@EntryValue" value="Space" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INDENT_SIZE/@EntryValue" value="4" type="int" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/CONTINUOUS_LINE_INDENT/@EntryValue" value="Double" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/TAB_WIDTH/@EntryValue" value="4" type="int" />
</component>
</project>

7
.idea/misc.xml generated Normal file
View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CMakePythonSetting">
<option name="pythonIntegrationState" value="YES" />
</component>
<component name="CMakeWorkspace" PROJECT_DIR="$PROJECT_DIR$" />
</project>

8
.idea/modules.xml generated Normal file
View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/Praktikum.iml" filepath="$PROJECT_DIR$/.idea/Praktikum.iml" />
</modules>
</component>
</project>

10
CMakeLists.txt Normal file
View File

@@ -0,0 +1,10 @@
cmake_minimum_required(VERSION 3.10)
project(ADS_Praktikum)
add_subdirectory(P1/ADS_P1_1_Ringpuffer)
add_subdirectory(P1/ADS_P1_2_Binaerbaum)
add_subdirectory(P2/ADS_P2_1_Sortieren)
add_subdirectory(P2/ADS_P2_2_Hashtable)
add_subdirectory(P3)
add_subdirectory(P4)

View File

@@ -0,0 +1,8 @@
cmake_minimum_required(VERSION 3.10)
project(P1_1_Ringpuffer)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
add_executable(P1_1_Ringpuffer main.cpp Ring.cpp RingNode.cpp RingTest.cpp)

107
P1/ADS_P1_1_Ringpuffer/Ring.cpp Executable file
View File

@@ -0,0 +1,107 @@
/*************************************************
* ADS Praktikum 1.1
* Ring.cpp
* Erweiterung um Hilfsfunktionen gestattet.
*************************************************/
// Ring .cpp
#include "Ring.h"
#include <iostream>
Ring::Ring() {
m_anker = nullptr;
m_countNodes = 0;
};
void Ring::addNewNode(std::string Beschreibung, std::string Data) {
RingNode* newNode = new RingNode(0, Beschreibung, Data);
// Fall 1 Ring ist leer
if (m_countNodes == 0) {
m_anker = newNode;
newNode->setNext(m_anker);
m_anker->setNext(newNode);
m_countNodes++;
}
// Fall 2 Ring ist nut teilweise voll
else if (m_countNodes != 6) {
RingNode* ptr = m_anker->getNext();
newNode->setNext(m_anker->getNext());
m_anker->setNext(newNode);
m_anker = newNode;
m_countNodes++;
if (m_countNodes == 1)
m_anker->setOldAge(m_anker->getOldAge() + 1);
else {
while (ptr != m_anker) {
ptr->setOldAge(ptr->getOldAge() + 1);
ptr = ptr->getNext();
}
}
}
// Fall 3 Ring ist voll
else if (m_countNodes == 6) {
RingNode* nodeAge5 = m_anker->getNext();
newNode->setNext(nodeAge5->getNext());
m_anker->setNext(newNode);
delete nodeAge5;
m_anker = newNode;
RingNode* ptr = m_anker->getNext();
while (ptr != m_anker) {
ptr->setOldAge(ptr->getOldAge() + 1);
ptr = ptr->getNext();
}
}
};
bool Ring::search(std::string Data) {
if (m_anker != nullptr) {
// Fängt beim letzten/ältesten Knoten in der Liste an
RingNode* ptr = m_anker->getNext();
while (ptr->getNext() != m_anker->getNext() && ptr->getSymbolicData() != Data)
ptr = ptr->getNext();
if (ptr->getSymbolicData() == Data)
return true;
else
return false;
}
else return false;
}
void Ring::printNode(std::string Data) {
if (search(Data)) {
// Fangen beim ältesten Knoten an
RingNode* ptr = m_anker->getNext();
// kein doppeltes Durchlaufen und Data stimmt nicht überein
while (ptr->getNext() != m_anker->getNext() && ptr->getSymbolicData() != Data)
ptr = ptr->getNext();
// die while Schleife wird abgebrochen werden, da Data übereinstimmt. Data muss vorhanden sein da if(search(data) == true)
std::cout << "+ Gefunden in Backup: ";
std::cout << "Alter " << ptr->getOldAge() << ", Beschreibung: " << ptr->getDescription() << ", Daten: " << ptr->getSymbolicData() << std::endl;
}
else
std::cout << "+ Datensatz konnte nicht gefunden werden." << std::endl;
}
void Ring::print() {
std::cout << std::endl;
// Zählt den Knoten der ausgegeben werden soll
for (int i = 0; i < m_countNodes; i++) {
RingNode* tempNode = m_anker;
// geht bis zu diesem
for (int j = 0; j < m_countNodes - i; j++) {
tempNode = tempNode->getNext();
}
std::cout << "Alter " << tempNode->getOldAge() << ", Beschreibung: " << tempNode->getDescription() << ", Daten: " << tempNode->getSymbolicData() << std::endl
<< "-------------------------------" << std::endl;
}
std::cout << std::endl;
};

27
P1/ADS_P1_1_Ringpuffer/Ring.h Executable file
View File

@@ -0,0 +1,27 @@
/*************************************************
* ADS Praktikum 1.1
* Ring.h
* Erweiterung um Hilfsfunktionen gestattet.
*************************************************/
// Ring .h
#pragma once
#include<string>
#include "catch.h"
#include"RingNode.h"
class Ring {
private:
int m_countNodes;
RingNode* m_anker;
friend int getOldAge();
public:
Ring();
void addNewNode(std::string Beschreibung, std::string Data);
bool search(std::string Data);
void printNode(std::string Data);
void print();
// friend Funktionen müssen unangetastet bleiben!
friend RingNode* get_anker(Ring& r);
friend int get_countNodes(Ring& r);
};

View File

@@ -0,0 +1,41 @@
/*************************************************
* ADS Praktikum 1.1
* RingNode.cpp
* Erweiterung um Hilfsfunktionen gestattet.
*************************************************/
#include "RingNode.h"
RingNode::RingNode(){};
int RingNode::getOldAge() {
return m_oldAge;
};
void RingNode::setOldAge(int value) {
m_oldAge = value;
};
std::string RingNode::getDescription() {
return m_description;
};
void RingNode::setDescription(std::string value) {
m_description = value;
};
std::string RingNode::getSymbolicData() {
return m_symbolicData;
};
void RingNode::setSymbolicData(std::string value) {
m_symbolicData = value;
};
RingNode* RingNode::getNext() {
return m_next;
};
void RingNode::setNext(RingNode* node) {
m_next = node;
};

View File

@@ -0,0 +1,27 @@
/*************************************************
* ADS Praktikum 1.1
* RingNode.h
* Erweiterung um Hilfsfunktionen gestattet.
*************************************************/
#pragma once
#include <string>
class RingNode {
private:
int m_oldAge;
std::string m_description;
std::string m_symbolicData;
RingNode* m_next;
public:
RingNode();
RingNode(int a, std::string d, std::string s) : m_oldAge { a }, m_description { d }, m_symbolicData { s }, m_next { nullptr } { };
int getOldAge();
void setOldAge(int);
std::string getDescription();
void setDescription(std::string);
std::string getSymbolicData();
void setSymbolicData(std::string);
RingNode* getNext();
void setNext(RingNode*);
};

View File

@@ -0,0 +1,162 @@
/*************************************************
* ADS Praktikum 1.1
* Unit-Testdatei
* Aenderungen fuers Praktikum untersagt!
*************************************************/
#include "Ring.h"
#include "RingNode.h"
#include "catch.h"
#include <string>
using namespace std;
// Friend-Methode fuer Testroutine
RingNode* get_anker(Ring& r)
{
return r.m_anker;
}
int get_countNodes(Ring& r)
{
return r.m_countNodes;
}
TEST_CASE("Ring Testing", "[Ring]")
{
Ring rloop;
SECTION("Hinzufuegen von Nodes und Suche - simple")
{
rloop.addNewNode("Alpha", "Data");
rloop.addNewNode("Beta", "Data");
rloop.addNewNode("Gamma", "Data");
REQUIRE(get_countNodes(rloop) == 3);
REQUIRE(rloop.search("Data") == true);
REQUIRE(rloop.search("FAIL") == false);
REQUIRE(rloop.search("Alpha") == false);
REQUIRE(rloop.search("Data") == true);
}
SECTION("Hinzufuegen von Nodes - Rotaionsgrenze")
{
rloop.addNewNode("Alpha", "Data1");
rloop.addNewNode("Beta", "Data2");
rloop.addNewNode("Gamma", "Data3");
rloop.addNewNode("Delta", "Data4");
rloop.addNewNode("Phi", "Data5");
rloop.addNewNode("Sept", "Data6");
rloop.addNewNode("Gamma", "Data7");
rloop.addNewNode("Gamma", "Data8");
rloop.addNewNode("Gamma", "Data9");
REQUIRE(get_countNodes(rloop) == 6);
REQUIRE(rloop.search("Data1") == false);
REQUIRE(rloop.search("Data2") == false);
REQUIRE(rloop.search("Data7") == true);
REQUIRE(rloop.search("Data5") == true);
}
SECTION("Hinzufuegen von Nodes - Rotaionsperformance")
{
for (int i = 0; i < 1024; i++)
{
string info = "Info" + to_string(i);
string data = "Data" + to_string(i);
rloop.addNewNode(info, data);
}
REQUIRE(get_countNodes(rloop) == 6);
REQUIRE(rloop.search("Data1") == false);
REQUIRE(rloop.search("Data2") == false);
REQUIRE(rloop.search("Data1020") == true);
REQUIRE(rloop.search("Data1023") == true);
}
SECTION("Ringarchitektur - Verkettungspruefung 1")
{
for (int i = 0; i < 3; i++)
{
string info = "Info" + to_string(i);
string data = "Data" + to_string(i);
rloop.addNewNode(info, data);
}
RingNode* ref = get_anker(rloop);
REQUIRE(get_countNodes(rloop) == 3);
REQUIRE(ref->getSymbolicData() == "Data2");
ref = ref->getNext();
REQUIRE(ref->getSymbolicData() == "Data0");
ref = ref->getNext();
REQUIRE(ref->getSymbolicData() == "Data1");
ref = ref->getNext();
REQUIRE(ref == get_anker(rloop));
}
SECTION("Ringarchitektur - Verkettungspruefung 2")
{
for (int i = 0; i < 10; i++)
{
string info = "Info" + to_string(i);
string data = "Data" + to_string(i);
rloop.addNewNode(info, data);
}
RingNode* ref = get_anker(rloop);
REQUIRE(get_countNodes(rloop) == 6);
REQUIRE(ref->getSymbolicData() == "Data9");
ref = ref->getNext();
REQUIRE(ref->getSymbolicData() == "Data4");
ref = ref->getNext();
REQUIRE(ref->getSymbolicData() == "Data5");
ref = ref->getNext();
REQUIRE(ref->getSymbolicData() == "Data6");
ref = ref->getNext();
REQUIRE(ref->getSymbolicData() == "Data7");
ref = ref->getNext();
REQUIRE(ref->getSymbolicData() == "Data8");
ref = ref->getNext();
REQUIRE(ref->getSymbolicData() == "Data9");
REQUIRE(ref == get_anker(rloop));
// Fail-Test:
// REQUIRE(get_anker(rloop)->getSymbolicData() == "Data4");
}
}
TEST_CASE("RingNode Testing", "[RingNode]")
{
SECTION("Get/Setter von RingNode - simple")
{
RingNode* node = new RingNode(1, "Info", "Data");
REQUIRE(node->getOldAge() == 1);
REQUIRE(node->getDescription() == "Info");
REQUIRE(node->getSymbolicData() == "Data");
REQUIRE(node->getNext() == nullptr);
node->setOldAge(5);
REQUIRE(node->getOldAge() == 5);
node->setDescription("newInfo");
REQUIRE(node->getDescription() == "newInfo");
node->setSymbolicData("newData");
REQUIRE(node->getSymbolicData() == "newData");
RingNode* node2 = new RingNode(2, "Info2", "Data2");
node->setNext(node2);
REQUIRE(node->getNext() == node2);
delete node;
delete node2;
}
}

14362
P1/ADS_P1_1_Ringpuffer/catch.h Executable file

File diff suppressed because it is too large Load Diff

75
P1/ADS_P1_1_Ringpuffer/main.cpp Executable file
View File

@@ -0,0 +1,75 @@
/*************************************************
* ADS Praktikum 1.1
* main.cpp
*
*************************************************/
#define CATCH_CONFIG_RUNNER
#include <iostream>
#include <string>
#include "Ring.h"
#include "catch.h"
using namespace std;
void print_menu() {
cout << "====================================" << endl
<< " SuperBackUp-Organizer over 9000, by. Son Goku" << endl
<< "====================================" << endl
<< "1) Backup anlegen" << endl
<< "2) Backup suchen" << endl
<< "3) Alle Backups ausgeben" << endl
<< "4) Programm beenden" << endl
<< "?> ";
}
int main() {
int result = Catch::Session().run();
Ring ring;
while (true) {
print_menu();
int engb;
cin >> engb;
switch (engb) {
case 1: {
cout << "+ Neuen Datensatz einfuegen" << endl
<< "Beschreibung ?> ";
string desc;
cin >> desc;
cout << "Daten ?> ";
string data;
cin >> data;
ring.addNewNode(desc, data);
cout << "+ Datensatz hinzugefuegt." << endl;
break;
}
case 2: {
cout << "+ Nach welchen Daten soll gesucht werden?" << endl
<< "?> ";
string to_find;
cin >> to_find;
ring.printNode(to_find);
break;
}
case 3:
ring.print();
break;
case 4:
return result;
default:
cout << "Invalid selection!" << endl;
}
}
system("Pause");
return result;
}

View File

@@ -0,0 +1,8 @@
cmake_minimum_required(VERSION 3.10)
project(P1_2_Binaerbaum)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
add_executable(P1_2_Binaerbaum main.cpp Tree.cpp TreeNode.cpp TreeTest.cpp)

View File

@@ -0,0 +1,18 @@
A;70;0;0
A;20;0;0
A;90;0;0
A;10;0;0
A;60;0;0
A;80;0;0
A;91;0;0
A;40;0;0
A;84;0;0
A;95;0;0
A;30;0;0
A;50;0;0
A;82;0;0
A;86;0;0
A;93;0;0
A;96;0;0
A;92;0;0
A;94;0;0
1 A 70 0 0
2 A 20 0 0
3 A 90 0 0
4 A 10 0 0
5 A 60 0 0
6 A 80 0 0
7 A 91 0 0
8 A 40 0 0
9 A 84 0 0
10 A 95 0 0
11 A 30 0 0
12 A 50 0 0
13 A 82 0 0
14 A 86 0 0
15 A 93 0 0
16 A 96 0 0
17 A 92 0 0
18 A 94 0 0

333
P1/ADS_P1_2_Binaerbaum/Tree.cpp Executable file
View File

@@ -0,0 +1,333 @@
/*************************************************
* ADS Praktikum 1.2
* Tree.cpp
* Erweiterung um Hilfsfunktionen gestattet.
*************************************************/
#include "Tree.h"
#include "TreeNode.h"
#include <iomanip>
#include <iostream>
#include <queue>
using namespace std;
Tree::Tree() {
currentNodeChronologcalID = 0;
}
Tree::~Tree() {
while (m_anker != nullptr) {
deleteNode(m_anker->getNodeOrderID());
}
}
TreeNode* Tree::getAnker() {
return m_anker;
}
void Tree::setAnker(TreeNode* node) {
m_anker = node;
}
void Tree::addNode(string Name, int Age, double Income, int PostCode) {
TreeNode* newNode = new TreeNode { Age + int(Income) + PostCode , currentNodeChronologcalID++, Name, Age, Income, PostCode };
TreeNode* ptr = getAnker();
TreeNode* tmp = nullptr;
/*
* Allg. Baumaufbau
* Anker
* klein -> groß
*/
// bis zum passenden Parentknoten traversieren
while (ptr != nullptr) {
tmp = ptr;
// wenn NodeID > ptrID dann rechts sonst links
// Dublikate?
newNode->getNodeOrderID() > ptr->getNodeOrderID() ?
ptr = ptr->getRight() : ptr = ptr->getLeft();
}
if (getAnker() == nullptr)
setAnker(newNode);
// wenn NodeID > tmpID dann rechts sonst links
else newNode->getNodeOrderID() > tmp->getNodeOrderID() ?
tmp->setRight(newNode) : tmp->setLeft(newNode);
}
bool Tree::deleteNode(int delNodeID) {
// Baum ist leer
if (!getAnker())
return false;
// Loeschen von Nodes - ab Wurzel
if (getAnker()->getNodeOrderID() == delNodeID) {
// 1. Fall: der Baum bestehet aus 1 Knoten.
if (!getAnker()->getRight() && !getAnker()->getLeft()) {
delete getAnker();
setAnker(nullptr);
cout << "+ Datensatz wurde gelöscht.\n";
return true;
}
// 2. Fall: Wurzel, mit einem Nachfolger
else if ((getAnker()->getRight() && !getAnker()->getLeft()) || (!getAnker()->getRight() && getAnker()->getLeft())) {
TreeNode* tmp = getAnker();
// Nachfolger wird Anker
getAnker()->getRight() ?
setAnker(getAnker()->getRight()) : setAnker(getAnker()->getLeft());
delete tmp;
cout << "+ Datensatz wurde gelöscht.\n";
return true;
}
// 3. Fall: Wurzel, mit zwei Nachfolger
else if (getAnker()->getRight() && getAnker()->getLeft()) {
TreeNode* minimumRTB = getAnker()->getRight();
TreeNode* minimumParent = nullptr;
// Minimum von RTB suchen.
while (minimumRTB->getLeft() != nullptr) {
minimumParent = minimumRTB;
minimumRTB = minimumRTB->getLeft();
}
// Minimum von RTB gefunden
if (minimumParent != nullptr) {
minimumParent->setLeft(minimumRTB->getRight());
minimumRTB->setLeft(getAnker()->getLeft());
minimumRTB->setRight(getAnker()->getRight());
}
// Minimum von RTB ist RTB-Wurzel (RTB->left == nullptr)
else
minimumRTB->setLeft(getAnker()->getLeft());
delete getAnker();
setAnker(minimumRTB);
cout << "+ Datensatz wurde gelöscht.\n";
return true;
}
}
// Loeschen von Nodes - Node != Wurzel
else {
// zu loeschende Node und Parent_Node
TreeNode* ptr = getAnker();
TreeNode* parent = getAnker();
// suche zuloeschenden Node
while ((ptr->getRight() || ptr->getLeft()) && ptr->getNodeOrderID() != delNodeID && ptr) {
parent = ptr;
delNodeID < ptr->getNodeOrderID() ?
ptr = ptr->getLeft() : ptr = ptr->getRight();
}
// 1. Fall Loeschen von Nodes - ohne Nachfolger
if (!ptr->getRight() && !ptr->getLeft()) {
parent->getNodeOrderID() < ptr->getNodeOrderID() ?
parent->setRight(nullptr) : parent->setLeft(nullptr);
delete ptr;
cout << "+ Datensatz wurde gelöscht.\n";
return true;
}
// 2. Fall Loeschen von Nodes - mit einem Nachfolger
else if ((!ptr->getRight() && ptr->getLeft()) || (ptr->getRight() && !ptr->getLeft())) {
if (parent->getNodeOrderID() < ptr->getNodeOrderID())
ptr->getRight() ?
parent->setRight(ptr->getRight()) : parent->setRight(ptr->getLeft());
else
ptr->getRight() ?
parent->setLeft(ptr->getRight()) : parent->setLeft(ptr->getLeft());
delete ptr;
cout << "+ Datensatz wurde gelöscht.\n";
return true;
}
// 3. Fall Loeschen von Nodes - mit zwei Nachfolger
if (ptr->getRight() != nullptr && ptr->getLeft() != nullptr) {
TreeNode* minimumRTB = ptr->getRight();
TreeNode* minimumParent = nullptr;
//Minumum von RTB suchen.
while (minimumRTB->getLeft() != nullptr) {
minimumParent = minimumRTB;
minimumRTB = minimumRTB->getLeft();
}
//Minimum von RTB gefunden
if (minimumParent != nullptr) {
minimumParent->setLeft(minimumRTB->getRight());
minimumRTB->setLeft(ptr->getLeft());
minimumRTB->setRight(ptr->getRight());
}
//Minimum von RTB ist RTB-Wurzel (RTB->left == nullptr)
else
minimumRTB->setLeft(ptr->getLeft());
//verknuepfe parent von zu loeschende Node
parent->getNodeOrderID() < ptr->getNodeOrderID() ?
parent->setRight(minimumRTB) :
parent->setLeft(minimumRTB);
delete ptr;
cout << "+ Datensatz wurde gelöscht.\n";
return true;
}
}
return false;
}
bool Tree::searchNode(std::string name) {
// Baum muss vorhanden sein
if (getAnker() != nullptr) {
bool found = false;
TreeNode* ptr = getAnker();
TreeNode* node;
cout << endl <<
"ID | Name | Alter | Einkommen | PLZ | OrderID\n"
"---+------------+-------+-----------+-------+--------\n";
queue<TreeNode*> q;
q.push(ptr);
while (!q.empty()) {
node = q.front();
q.pop();
if (node->getName() == name) {
printNode(node);
found = true;
// break; // damit werden alle Knoten mit dem Namen ausgegeben
}
if (node->getLeft() != nullptr)
q.push(node->getLeft());
if (node->getRight() != nullptr)
q.push(node->getRight());
}
if (!found)
cout << "--------------- Kein Eintrag vorhanden --------------" << endl;
return found;
}
else
return false;
}
void Tree::printNode(TreeNode* node) {
cout << setw(3) << node->getNodeChronologicalID() << '|' << setw(12) << node->getName() << '|'
<< setw(7) << node->getAge() << '|' << setw(11) << node->getIncome() << '|'
<< setw(7) << node->getPostCode() << '|' << setw(8) << node->getNodeOrderID() << endl;
}
void Tree::printLevelOrder() {
TreeNode* root = getAnker();
// 2 Queues instanzieren
std::queue<TreeNode*> q;
std::queue<int> nq;
cout << endl <<
"ID | Name | Alter | Einkommen | PLZ | OrderID\n"
"---+------------+-------+-----------+-------+--------\n";
if (root == nullptr) {
cout << "--------------- Kein Eintrag vorhanden --------------" << endl;
return;
}
// Wurzelknoten und Startniveau in die Queues pushen
q.push(root);
nq.push(0);
// vorheriges Niveau merken bzw. den Niveauwechsel irgendwie mitbekommen
int prev_niveau = -1;
int niveau;
// Schleife
while (!q.empty()) {
// Entnahme aus den Queues und loeschen
TreeNode* ptr = q.front();
q.pop();
niveau = nq.front();
nq.pop();
// Ausgabe Niveauwechsel
if (prev_niveau != niveau) {
std::cout << std::endl << "Niveau " << niveau << ": " << endl;
prev_niveau = niveau;
}
// Ausgabe des Knotens
printNode(ptr);
// Linker Nachfolgeknoten in die Queues
if (ptr->getLeft() != nullptr) {
q.push(ptr->getLeft());
nq.push(niveau + 1);
}
// Rechter Nachfolgeknoten in die Queues
if (ptr->getRight() != nullptr) {
q.push(ptr->getRight());
nq.push(niveau + 1);
}
}
}
void Tree::printPreOrder(TreeNode* ptr) {
if (ptr != nullptr) {
printNode(ptr);
printPreOrder(ptr->getLeft());
printPreOrder(ptr->getRight());
}
}
void Tree::printPostOrder(TreeNode* ptr) {
if (ptr != nullptr) {
printPreOrder(ptr->getLeft());
printPreOrder(ptr->getRight());
printNode(ptr);
}
}
void Tree::printInOrder(TreeNode* ptr) {
if (ptr != nullptr) {
printPreOrder(ptr->getLeft());
printNode(ptr);
printPreOrder(ptr->getRight());
}
}
void Tree::printAll() {
if (getAnker() != nullptr) {
string ausgabeFormat;
cout << "Ausgabereihenfolge ?> ";
cin >> ausgabeFormat;
TreeNode* ptr = getAnker();
cout << endl <<
"ID | Name | Alter | Einkommen | PLZ | OrderID\n"
"---+------------+-------+-----------+-------+--------\n";
if (ausgabeFormat == "pre")
printPreOrder(getAnker());
else if (ausgabeFormat == "post")
printPostOrder(getAnker());
else if (ausgabeFormat == "in")
printInOrder(getAnker());
else
cout << "falsches Formatkürzel";
}
else
cout << "--------------- Kein Eintrag vorhanden --------------\n";
}

35
P1/ADS_P1_2_Binaerbaum/Tree.h Executable file
View File

@@ -0,0 +1,35 @@
/*************************************************
* ADS Praktikum 1.2
* Tree.h
* Erweiterung um Hilfsattribute und -funktionen gestattet, wenn erforderlich.
*************************************************/
#pragma once
#include "TreeNode.h"
#include "catch.h"
#include <string>
using namespace std;
class Tree {
private:
TreeNode* m_anker = nullptr;
int currentNodeChronologcalID = 0;
public:
Tree();
~Tree();
void addNode(std::string Name, int Age, double Income, int PostCode);
bool deleteNode(int NodeOrderID);
bool searchNode(std::string Name);
void printAll();
void printNode(TreeNode* node);
void printPreOrder(TreeNode* ptr);
void printPostOrder(TreeNode* ptr);
void printInOrder(TreeNode* ptr);
void printLevelOrder();
TreeNode* getAnker();
void setAnker(TreeNode* _anker);
// friend-Funktionen sind für die Tests erforderlich und müssen unangetastet
// bleiben!
friend TreeNode* get_anker(Tree& TN);
};

View File

@@ -0,0 +1,86 @@
/*************************************************
* ADS Praktikum 1.2
* TreeNode.cpp
* Erweiterung um Hilfsfunktionen gestattet.
*************************************************/
#include "TreeNode.h"
#include <iostream>
#include <string>
TreeNode::TreeNode(int nNodePos,
int id,
string name,
int alter,
double einkommen,
int plz) {
this->m_NodeOrderID = nNodePos;
this->m_NodeChronologicalID = id;
this->m_Name = name;
this->m_Age = alter;
this->m_Income = einkommen;
this->m_PostCode = plz;
this->m_left = nullptr;
this->m_right = nullptr;
}
int TreeNode::getNodeOrderID() const {
return m_NodeOrderID;
}
int TreeNode::getNodeChronologicalID() const {
return m_NodeChronologicalID;
}
string TreeNode::getName() const {
return m_Name;
}
int TreeNode::getAge() const {
return m_Age;
}
double TreeNode::getIncome() const {
return m_Income;
}
int TreeNode::getPostCode() const {
return m_PostCode;
}
TreeNode* TreeNode::getLeft() {
return m_left;
}
TreeNode* TreeNode::getRight() {
return m_right;
}
void TreeNode::setNodeOrderID(int noID) {
m_NodeOrderID = noID;
}
void TreeNode::setName(string name) {
m_Name = name;
}
void TreeNode::setAge(int age) {
m_Age = age;
}
void TreeNode::setIncome(double income) {
m_Income = income;
}
void TreeNode::setPostCode(int postcode) {
m_PostCode = postcode;
}
void TreeNode::setLeft(TreeNode* node) {
m_left = node;
}
void TreeNode::setRight(TreeNode* node) {
m_right = node;
}
void print();

View File

@@ -0,0 +1,44 @@
/*************************************************
* ADS Praktikum 1.2
* TreeNode.h
* Erweiterung um Hilfsattribute und -funktionen gestattet, wenn erforderlich.
*************************************************/
#pragma once
#include <string>
using namespace std;
class TreeNode {
private:
int m_NodeOrderID;
int m_NodeChronologicalID;
string m_Name;
int m_Age;
double m_Income;
int m_PostCode;
TreeNode* m_left = nullptr;
TreeNode* m_right = nullptr;
public:
TreeNode(int, int, string, int, double, int);
int getNodeOrderID() const;
int getNodeChronologicalID() const;
string getName() const;
int getAge() const;
double getIncome() const;
int getPostCode() const;
TreeNode* getLeft();
TreeNode* getRight();
void setNodeOrderID(int noID);
void setName(string name);
void setAge(int age);
void setIncome(double income);
void setPostCode(int postcode);
void setLeft(TreeNode* node);
void setRight(TreeNode* node);
void print();
};

View File

@@ -0,0 +1,315 @@
/*************************************************
* ADS Praktikum 1.1
* Unit-Testdatei
* Stand: 12.04.2024
*
*************************************************
* Änderungen untersagt!
*************************************************/
#include "Tree.h"
#include "TreeNode.h"
#include "catch.h"
#include <iostream>
#include <string>
using namespace std;
// Friend-Methode fuer Testroutine
TreeNode* get_anker(Tree& Tr)
{
return Tr.m_anker;
}
/***********************************************
* Testroutine des Baums:
* - Einfaches Hinzufuegen und Suchen
* - Loeschen in unterscheidlicher Ausprägung
* + Loeschen ohne Nachfolger
* + Loeschen mit einem Nachfolger
* + Loeschen mit zwei Nachfolger
* + Loeschen der Wurzel
* - Hinzufuegen vieler Nodes als Grossbaum
*/
TEST_CASE("Tree Testing", "[TREE]")
{
Tree* nTree = new Tree();
SECTION("Hinzufuegen von Nodes und Suche - simple")
{
nTree->addNode("Mayer", 20, 0, 0);
nTree->addNode("Mayer2", 10, 0, 0);
nTree->addNode("Mayer3", 30, 0, 0);
nTree->addNode("Mayer4", 40, 0, 0);
nTree->addNode("Mayer5", 35, 0, 0);
nTree->addNode("Mayer6", 25, 0, 0);
nTree->addNode("Mayer7", 26, 0, 0);
REQUIRE(nTree->searchNode("Mayer") == true);
REQUIRE(nTree->searchNode("Mayer7") == true);
REQUIRE(nTree->searchNode("Mayer6") == true);
REQUIRE(nTree->searchNode("Mayer5") == true);
REQUIRE(nTree->searchNode("Mayer4") == true);
REQUIRE(nTree->searchNode("Mayer3") == true);
REQUIRE(nTree->searchNode("Mayer2") == true);
REQUIRE(nTree->searchNode("Mueller") == false);
REQUIRE(nTree->searchNode("Mayer99") == false);
}
SECTION("Loeschen von Nodes - ohne Nachfolger")
{
nTree->addNode("Mayer", 20, 0, 0);
nTree->addNode("Mayer2", 10, 0, 0);
nTree->addNode("Mayer3", 30, 0, 0);
nTree->addNode("Mayer4", 40, 0, 0);
nTree->addNode("Mayer5", 35, 0, 0);
nTree->addNode("Mayer6", 25, 0, 0);
nTree->addNode("Mayer7", 26, 0, 0);
nTree->addNode("Mayer8", 8, 0, 0);
REQUIRE(nTree->searchNode("Mayer8") == true);
TreeNode* tnanker = get_anker(*nTree);
nTree->deleteNode(8);
REQUIRE(tnanker->getLeft()->getLeft() == nullptr);
}
SECTION("Loeschen von Nodes - mit einem Nachfolger")
{
nTree->addNode("Mayer", 20, 0, 0);
nTree->addNode("Mayer2", 10, 0, 0);
nTree->addNode("Mayer3", 30, 0, 0);
nTree->addNode("Mayer4", 40, 0, 0);
nTree->addNode("Mayer5", 35, 0, 0);
nTree->addNode("Mayer6", 25, 0, 0);
nTree->addNode("Mayer7", 26, 0, 0);
nTree->addNode("Mayer8", 8, 0, 0);
nTree->addNode("Mayer9", 7, 0, 0);
REQUIRE(nTree->searchNode("Mayer8") == true);
REQUIRE(nTree->searchNode("Mayer9") == true);
TreeNode* tnanker = get_anker(*nTree);
// linke Seite
nTree->deleteNode(8);
REQUIRE(tnanker->getLeft()->getLeft() != nullptr);
REQUIRE(tnanker->getLeft()->getRight() == nullptr);
REQUIRE(tnanker->getLeft()->getLeft()->getNodeOrderID() == 7);
nTree->deleteNode(7);
REQUIRE(tnanker->getLeft()->getLeft() == nullptr);
REQUIRE(tnanker->getLeft()->getRight() == nullptr);
REQUIRE(tnanker->getLeft()->getNodeOrderID() == 10);
REQUIRE(nTree->searchNode("Mayer8") == false);
REQUIRE(nTree->searchNode("Mayer9") == false);
// rechte Seite
nTree->addNode("Mayer8", 8, 0, 0);
nTree->addNode("Mayer9", 9, 0, 0);
REQUIRE(nTree->searchNode("Mayer8") == true);
REQUIRE(nTree->searchNode("Mayer9") == true);
nTree->deleteNode(8);
REQUIRE(tnanker->getLeft()->getLeft() != nullptr);
REQUIRE(tnanker->getLeft()->getLeft()->getNodeOrderID() == 9);
nTree->deleteNode(9);
REQUIRE(tnanker->getLeft()->getLeft() == nullptr);
REQUIRE(tnanker->getLeft()->getNodeOrderID() == 10);
REQUIRE(nTree->searchNode("Mayer8") == false);
REQUIRE(nTree->searchNode("Mayer9") == false);
}
SECTION("Loeschen von Nodes - mit zwei Nachfolger")
{
nTree->addNode("Mayer", 20, 0, 0);
nTree->addNode("Mayer2", 10, 0, 0);
nTree->addNode("Mayer3", 30, 0, 0);
nTree->addNode("Mayer4", 40, 0, 0);
nTree->addNode("Mayer5", 35, 0, 0);
nTree->addNode("Mayer6", 25, 0, 0);
nTree->addNode("Mayer7", 26, 0, 0);
TreeNode* tnanker = get_anker(*nTree);
REQUIRE(tnanker->getNodeOrderID() == 20);
REQUIRE(tnanker->getRight()->getNodeOrderID() == 30);
REQUIRE(tnanker->getRight()->getLeft()->getNodeOrderID() == 25);
REQUIRE(tnanker->getRight()->getLeft()->getRight()->getNodeOrderID() ==
26);
REQUIRE(tnanker->getRight()->getRight()->getLeft()->getNodeOrderID() ==
35);
nTree->deleteNode(30);
REQUIRE(tnanker->getNodeOrderID() == 20);
REQUIRE(tnanker->getRight()->getNodeOrderID() == 35);
REQUIRE(tnanker->getRight()->getRight()->getNodeOrderID() == 40);
REQUIRE(tnanker->getRight()->getRight()->getLeft() == nullptr);
REQUIRE(tnanker->getRight()->getRight()->getRight() == nullptr);
REQUIRE(tnanker->getRight()->getLeft()->getNodeOrderID() == 25);
REQUIRE(tnanker->getRight()->getLeft()->getRight()->getNodeOrderID() ==
26);
REQUIRE(tnanker->getRight()->getLeft()->getLeft() == nullptr);
nTree->deleteNode(35);
REQUIRE(tnanker->getNodeOrderID() == 20);
REQUIRE(tnanker->getRight()->getNodeOrderID() == 40);
REQUIRE(tnanker->getRight()->getLeft()->getNodeOrderID() == 25);
}
SECTION("Loeschen von Nodes - ab Wurzel")
{
nTree->addNode("Mayer", 20, 0, 0);
nTree->addNode("Mayer2", 10, 0, 0);
nTree->addNode("Mayer3", 30, 0, 0);
nTree->addNode("Mayer4", 40, 0, 0);
nTree->addNode("Mayer5", 35, 0, 0);
nTree->addNode("Mayer6", 25, 0, 0);
nTree->addNode("Mayer7", 26, 0, 0);
TreeNode* tnanker = get_anker(*nTree); // Initiale Übergrabe des Ankers
/*
Lösche den Baum schrittweise durch entfernen der Wurzel
*/
REQUIRE(tnanker->getNodeOrderID() == 20);
nTree->deleteNode(20);
tnanker = get_anker(
*nTree); // Anker hat sich geändert, neue Übergabe erfoderlich
REQUIRE(tnanker->getNodeOrderID() == 25);
REQUIRE(tnanker->getRight()->getNodeOrderID() == 30);
REQUIRE(tnanker->getRight()->getLeft()->getNodeOrderID() == 26);
REQUIRE(tnanker->getRight()->getRight()->getNodeOrderID() == 40);
nTree->deleteNode(25);
tnanker = get_anker(
*nTree); // Anker hat sich geändert, neue Übergabe erfoderlich
REQUIRE(tnanker->getNodeOrderID() == 26);
REQUIRE(tnanker->getRight()->getNodeOrderID() == 30);
REQUIRE(tnanker->getRight()->getLeft() == nullptr);
REQUIRE(tnanker->getRight()->getRight()->getNodeOrderID() == 40);
nTree->deleteNode(26);
tnanker = get_anker(
*nTree); // Anker hat sich geändert, neue Übergabe erfoderlich
REQUIRE(tnanker->getNodeOrderID() == 30);
REQUIRE(tnanker->getRight()->getNodeOrderID() == 40);
REQUIRE(tnanker->getRight()->getLeft()->getNodeOrderID() == 35);
REQUIRE(tnanker->getRight()->getRight() == nullptr);
nTree->deleteNode(30);
tnanker = get_anker(
*nTree); // Anker hat sich geändert, neue Übergabe erfoderlich
REQUIRE(tnanker->getNodeOrderID() == 35);
REQUIRE(tnanker->getRight()->getNodeOrderID() == 40);
REQUIRE(tnanker->getRight()->getLeft() == nullptr);
REQUIRE(tnanker->getRight()->getRight() == nullptr);
nTree->deleteNode(35);
tnanker = get_anker(
*nTree); // Anker hat sich geändert, neue Übergabe erfoderlich
REQUIRE(tnanker->getNodeOrderID() == 40);
REQUIRE(tnanker->getRight() == nullptr);
REQUIRE(tnanker->getLeft()->getNodeOrderID() == 10);
nTree->deleteNode(40);
tnanker = get_anker(
*nTree); // Anker hat sich geändert, neue Übergabe erfoderlich
REQUIRE(tnanker->getNodeOrderID() == 10);
REQUIRE(tnanker->getRight() == nullptr);
REQUIRE(tnanker->getLeft() == nullptr);
nTree->deleteNode(10);
tnanker = get_anker(
*nTree); // Anker hat sich geändert, neue Übergabe erfoderlich
REQUIRE(tnanker == nullptr);
}
SECTION("Hinzufuegen von Nodes - Erzeuge Grossbaum")
{
for (int i = 0; i < 124; i++)
{
string info = "Name-" + to_string(i);
// Random Income und PostCode
double r = rand() + 1;
int PostCode = rand() + 1;
nTree->addNode(info, 0, r, PostCode);
}
nTree->printAll();
nTree->printLevelOrder();
std::cout << "========================================" << endl;
std::cout << "Testausgabe des Grossbaums abgeschlossen" << endl;
}
}
/***********************************************
* Testroutine des Knotens:
* - Einfaches pruefen der Getter und Setter in Ausführung
*/
TEST_CASE("TreeNode Testing", "[TREENODE]")
{
Tree* smallTree = new Tree();
smallTree->addNode("Herzog", 20, 0, 0);
TreeNode* ref = get_anker(*smallTree);
SECTION("Getter von TreeNode - simple")
{
REQUIRE(ref->getName() == "Herzog");
REQUIRE(ref->getAge() == 20);
REQUIRE(ref->getIncome() == 0);
REQUIRE(ref->getLeft() == nullptr);
REQUIRE(ref->getRight() == nullptr);
REQUIRE(ref->getNodeChronologicalID() == 0);
REQUIRE(ref->getNodeOrderID() == 20);
REQUIRE(ref->getPostCode() == 0);
}
SECTION("Setter von TreeNode - simple")
{
ref->setAge(22);
REQUIRE(ref->getAge() == 22);
ref->setIncome(1000);
REQUIRE(ref->getIncome() == 1000);
ref->setLeft(nullptr);
REQUIRE(ref->getLeft() == nullptr);
ref->setRight(nullptr);
REQUIRE(ref->getRight() == nullptr);
ref->setName("Kaiser");
REQUIRE(ref->getName() == "Kaiser");
ref->setPostCode(1000);
REQUIRE(ref->getPostCode() == 1000);
}
delete smallTree;
}
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// http://www.hashemall.com/
// Zeile 1-311 hat den SHA 256 Hashwert:
// 2AD58F06D997AD8B7AABE694372CBEDF31F718B975E1F71A87C360B0DFA2B469

18182
P1/ADS_P1_2_Binaerbaum/catch.h Executable file

File diff suppressed because it is too large Load Diff

128
P1/ADS_P1_2_Binaerbaum/main.cpp Executable file
View File

@@ -0,0 +1,128 @@
/*************************************************
* ADS Praktikum 1.2
* main.cpp
*
*************************************************/
#define CATCH_CONFIG_RUNNER
#include "Tree.h"
#include "catch.h"
#include <iostream>
using namespace std;
///////////////////////////////////////
// Hilfsmethoden fürs Menü hier:
/***************************
** Vorgegebene Funktion **
***************************
"mainscreen_addTreeCSV"
Importiert CSV Datei in bestehenden Baum.
Bei Aufruf in der main() Methode, muss der Pointer auf den Anker des Baums, als Parameter übergeben werden.
Es wird die im gleichen Verzeichnis liegende Datei "ExportZielanalyse.csv" geladen.
****************************/
void mainscreen_addTreeCSV(Tree*& ref) {
char j;
cout << "+ Moechten Sie die Daten aus der Datei ExportZielanalyse.csv "
"importieren(j / n) ? >";
cin >> j;
if (j == 'j') {
ifstream csvread;
csvread.open("ExportZielanalyse.csv", ios::in);
if (!csvread.is_open()) {
cout << "Fehler beim Lesen!" << endl;
return;
}
else {
string name, age, postcode, income;
while (!csvread.eof()) {
getline(csvread, name, ';');
getline(csvread, age, ';');
getline(csvread, income, ';');
getline(csvread, postcode, '\n');
ref->addNode(name, stoi(age), stod(income), stoi(postcode));
}
csvread.close();
}
cout << "+ Daten wurden dem Baum hinzugefuegt." << endl;
}
}
int main() {
int result = Catch::Session().run();
Tree* Baum = new Tree();
int engb;
while(true){
cout << "====================================\n"
"1) Datensatz einfuegen, manuell\n"
"2) Datensatz einfuegen, CSV Datei\n"
"3) Datensatz loeschen\n"
"4) Suchen\n"
"5) Datenstruktur anzeigen (pre, post, in)\n"
"6) Level-Order anzeigen\n"
"7) Beenden\n"
"?> ";
cin >> engb;
switch (engb) {
case 1: {
string name;
int alter;
double einkommen;
int plz;
cout << "+ Bitte geben Sie die den Datensatz ein\n"
"Name ?> ";
cin >> name;
cout << "Alter ?> ";
cin >> alter;
cout << "Einkommen ?> ";
cin >> einkommen;
cout << "PLZ ?> ";
cin >> plz;
Baum->addNode(name, alter, einkommen, plz);
cout << "+ Ihr Datensatz wurde eingefuegt" << endl;
break;
}
case 2: {
mainscreen_addTreeCSV(Baum);
break;
}
case 3: {
int nodeOrderID;
cout << "+ Bitte geben Sie den zu loeschenden Datensatz an\n"
"OrderID ?> ";
cin >> nodeOrderID;
Baum->deleteNode(nodeOrderID);
break;
}
case 4: {
string name;
cout << "+ Bitte geben Sie den zu suchenden Datensatz an\n"
"Name ?> ";
cin >> name;
cout << "+ Fundstellen:\n";
Baum->searchNode(name);
break;
}
case 5: {
Baum->printAll();
break;
}
case 6: {
Baum->printLevelOrder();
break;
}
case 7:{
return 0;
}
}
};
system("PAUSE");
return 0;
}

BIN
P1/ADS_Praktikum_1.pdf Executable file

Binary file not shown.

120
P1/unit_tests.cpp Executable file
View File

@@ -0,0 +1,120 @@
/*************************************************
* ADS Praktikum 2
* Unit-Testdatei
* Stand: 20.05.2024
*
*************************************************
* Änderungen untersagt!
*************************************************/
#include <vector>
#include "/home/safak/SynologyDrive/UNI/2. Semester/52106 ADS/ADS-Praktika/P2/ADS_P2_2_Hashtable/catch.h"
#include "/home/safak/SynologyDrive/UNI/2. Semester/52106 ADS/ADS-Praktika/P2/ADS_P2_2_Hashtable/hashtable.h"
std::vector<int> V{98, 44, 30, 22, 64, 63, 11, 23, 8, 18};
TEST_CASE("HashTable", "[HASHTABLE]") {
SECTION("Hashing 10 elements - Size: 20 : Rehashing") {
HashTable H(20,0.6,1);
for (unsigned int i = 0; i < V.size(); i++)
{
H.insert(V.at(i));
}
H.insert(15);
H.insert(16);
H.insert(21);
H.insert(22);
if (H.getSize() > 0) {
REQUIRE(H.at(3) == 44);
REQUIRE(H.at(8) == 8);
REQUIRE(H.at(11) == 11);
REQUIRE(H.at(15) == 15);
REQUIRE(H.at(16) == 98);
REQUIRE(H.at(17) == 16);
REQUIRE(H.at(18) == 18);
REQUIRE(H.at(21) == 21);
REQUIRE(H.at(22) == 22);
REQUIRE(H.at(23) == 63);
REQUIRE(H.at(24) == 64);
REQUIRE(H.at(25) == 22);
REQUIRE(H.at(26) == 23);
REQUIRE(H.at(30) == 30);
}
REQUIRE(H.getSize() == 41);
REQUIRE(H.getCollisionCount() == 8);
REQUIRE(H.getElements() == 14);
}
SECTION("Hashing 10 elements - quadratisch Sondieren - Size: 15 : Rehashing") {
HashTable H(15, 0.6, 2);
for (unsigned int i = 0; i < V.size(); i++)
{
H.insert(V.at(i));
}
H.insert(15);
H.insert(16);
H.insert(21);
H.insert(22);
if (H.getSize() > 0) {
REQUIRE(H.at(1) == 63);
REQUIRE(H.at(2) == 64);
REQUIRE(H.at(5) == 98);
REQUIRE(H.at(8) == 8);
REQUIRE(H.at(11) == 11);
REQUIRE(H.at(13) == 44);
REQUIRE(H.at(15) == 15);
REQUIRE(H.at(16) == 16);
REQUIRE(H.at(18) == 18);
REQUIRE(H.at(21) == 21);
REQUIRE(H.at(22) == 22);
REQUIRE(H.at(23) == 23);
REQUIRE(H.at(26) == 22);
REQUIRE(H.at(30) == 30);
}
REQUIRE(H.getSize() == 31);
REQUIRE(H.getCollisionCount() == 2);
REQUIRE(H.getElements() == 14);
}
SECTION("Hashing 10 elements - doppeltes Hashing- Size: 15 : Rehashing") {
HashTable H(15, 0.6, 3);
for (unsigned int i = 0; i < V.size(); i++)
{
H.insert(V.at(i));
}
H.insert(15);
H.insert(16);
H.insert(21);
H.insert(22);
if (H.getSize() > 0) {
REQUIRE(H.at(1) == 63);
REQUIRE(H.at(2) == 64);
REQUIRE(H.at(5) == 98);
REQUIRE(H.at(8) == 8);
REQUIRE(H.at(11) == 11);
REQUIRE(H.at(13) == 44);
REQUIRE(H.at(15) == 15);
REQUIRE(H.at(16) == 16);
REQUIRE(H.at(18) == 18);
REQUIRE(H.at(21) == 21);
REQUIRE(H.at(22) == 22);
REQUIRE(H.at(23) == 23);
REQUIRE(H.at(29) == 22);
REQUIRE(H.at(30) == 30);
}
REQUIRE(H.getSize() == 31);
REQUIRE(H.getCollisionCount() == 1);
REQUIRE(H.getElements() == 14);
}
}
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

View File

@@ -0,0 +1,13 @@
cmake_minimum_required(VERSION 3.10)
project(P2_1_Sortieren)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Add an executable with the above sources
find_package(OpenMP REQUIRED)
if(OpenMP_CXX_FOUND)
add_executable(P2_1_Sortieren main.cpp sorting.cpp unit_tests.cpp)
target_link_libraries(P2_1_Sortieren OpenMP::OpenMP_CXX)
endif()

Binary file not shown.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,12 @@
reset
set autoscale x
set autoscale y
set xlabel "n [-]"
set ylabel "t [s]"
set key top left
plot \
"quicksort.txt" with linespoints title 'Quicksort',\
"mergesort.txt" with linespoints title 'Mergesort',\
"shellsort_2n.txt" with linespoints title 'Shellsort',\
"heapsort.txt" with linespoints title 'Heapsort',\

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

18182
P2/ADS_P2_1_Sortieren/catch.h Executable file

File diff suppressed because it is too large Load Diff

233
P2/ADS_P2_1_Sortieren/main.cpp Executable file
View File

@@ -0,0 +1,233 @@
#define CATCH_CONFIG_RUNNER
#include "catch.h"
#include <iostream>
#include <omp.h>
#include <chrono>
#include "sorting.h"
using namespace std;
//benchmark functions
void benchmark_quicksort();
void benchmark_mergesort();
void benchmark_heapsort();
void benchmark_shellsort_2n();
int main(int argc, char** argv) {
Catch::Session().run();
std::cout << "\nPress Enter to run measurement" << std::endl;
std::cin.get();
benchmark_quicksort();
benchmark_mergesort();
benchmark_heapsort();
benchmark_shellsort_2n();
return 0;
}
//executes benchmark for quicksort
void benchmark_quicksort() {
//file stream
ofstream quicksort_measurement;
quicksort_measurement.open("quicksort.txt", ios::out | ios::app);
//benchmark parameters / variables
double dtime;
int n_start = 1000;
int n_step = 1000;
int n_end = 1000000;
vector<int> V;
//actual benchmark loop
for (int n = n_start; n <= n_end; n += n_step) {
//"progress bar"
std::cout << "Running Quicksort with n: " << n << std::endl;
std::chrono::nanoseconds messwerte;
for (int i = 0; i < 10; i++) {
//generate n random integers
sorting::randomizeVector(V, n);
//start measurement
std::chrono::steady_clock::time_point begin = std::chrono::steady_clock::now();
//execzute sorting algorithm
sorting::QuickSort(V, 0, V.size() - 1);
//stop time
std::chrono::steady_clock::time_point end = std::chrono::steady_clock::now();
auto dtime = end - begin;
messwerte += dtime;
}
auto mittelwert = messwerte.count() * 0.1;
//write to file
quicksort_measurement << n << "\t" << setprecision(10) << scientific << mittelwert << endl;
}
//close file handle
quicksort_measurement.close();
}
void benchmark_mergesort() {
//file stream
ofstream mergesort_measurement;
mergesort_measurement.open("mergesort.txt", ios::out | ios::app);
//benchmark parameters / variables
//double dtime;
int n_start = 1000;
int n_step = 1000;
int n_end = 1000000;
vector<int> V;
vector<int> temp_array;
//actual benchmark loop
for (int n = n_start; n <= n_end; n += n_step) {
//"progress bar"
std::cout << "Running Mergesort with n: " << n << std::endl;
std::chrono::nanoseconds messwerte;
for (int i = 0; i < 10; i++) {
//generate n random integers
sorting::randomizeVector(V, n);
//start measurement
std::chrono::steady_clock::time_point begin = std::chrono::steady_clock::now();
//execzute sorting algorithm
sorting::MergeSort(V, temp_array, 0, V.size() - 1);
//stop time
std::chrono::steady_clock::time_point end = std::chrono::steady_clock::now();
auto dtime = end - begin;
messwerte += dtime;
}
auto mittelwert = messwerte.count() * 0.1;
//write to file
mergesort_measurement << n << "\t" << setprecision(10) << scientific << mittelwert << endl;
}
//close file handle
mergesort_measurement.close();
}
void benchmark_heapsort() {
//file stream
ofstream heapsort_measurement;
heapsort_measurement.open("heapsort.txt", ios::out | ios::app);
//benchmark parameters / variables
//double dtime;
int n_start = 1000;
int n_step = 1000;
int n_end = 1000000;
vector<int> V;
//actual benchmark loop
for (int n = n_start; n <= n_end; n += n_step) {
//"progress bar"
std::cout << "Running Heapsort with n: " << n << std::endl;
std::chrono::nanoseconds messwerte;
for (int i = 0; i < 10; i++) {
//generate n random integers
sorting::randomizeVector(V, n);
//start measurement
std::chrono::steady_clock::time_point begin = std::chrono::steady_clock::now();
//execzute sorting algorithm
sorting::HeapSort(V, V.size());
//stop time
std::chrono::steady_clock::time_point end = std::chrono::steady_clock::now();
auto dtime = end - begin;
messwerte += dtime;
}
auto mittelwert = messwerte.count() * 0.1;
//write to file
heapsort_measurement << n << "\t" << setprecision(10) << scientific << mittelwert << endl;
}
//close file handle
heapsort_measurement.close();
}
void benchmark_shellsort_2n() {
//file stream
ofstream shellsort_measurement;
shellsort_measurement.open("shellsort_2n.txt", ios::out | ios::app);
//benchmark parameters / variables
//double dtime;
int n_start = 1000;
int n_step = 1000;
int n_end = 1000000;
vector<int> V;
//actual benchmark loop
for (int n = n_start; n <= n_end; n += n_step) {
//"progress bar"
std::cout << "Running Shellsort with n: " << n << std::endl;
std::chrono::nanoseconds messwerte;
for (int i = 0; i < 10; i++) {
//generate n random integers
sorting::randomizeVector(V, n);
//start measurement
std::chrono::steady_clock::time_point begin = std::chrono::steady_clock::now();
//execzute sorting algorithm
sorting::ShellSort_2n(V, V.size());
//stop time
std::chrono::steady_clock::time_point end = std::chrono::steady_clock::now();
auto dtime = end - begin;
messwerte += dtime;
}
auto mittelwert = messwerte.count() * 0.1;
//write to file
shellsort_measurement << n << "\t" << setprecision(10) << scientific << mittelwert << endl;
}
//close file handle
shellsort_measurement.close();
}

234
P2/ADS_P2_1_Sortieren/sorting.cpp Executable file
View File

@@ -0,0 +1,234 @@
#include "sorting.h"
namespace sorting {
void swap(int* input, int* tmp) {
int t = *input;
*input = *tmp;
*tmp = t;
}
//************
// QuickSort *
//************
int partition(vector<int>& a, int low, int high) {
int pivot = a[high]; // pivot/ das Element an der höchsten Stelle
int i = (low - 1); // Index des Elements an der niedrigsten Stellen
// vom niedrigsten zum höchsten Element durchgehen
for (int j = low; j < high; j++) {
// aktuelles Element kleiner als Pivot?
if (a[j] < pivot) {
i++; // index des kleineren Elements erhöhen
std::swap(a[i], a[j]);
}
}
std::swap(a[i + 1], a[high]);
return (i + 1);
}
void QuickSort(vector<int>& arr, int left, int right) {
if (left < right) {
int pi = partition(arr, left, right);
QuickSort(arr, left, pi - 1);
QuickSort(arr, pi + 1, right);
}
}
//************
// MergeSort *
//************
void Merge(vector<int>& a, vector<int>& b, int low, int pivot, int high) {
int left, right, pos;
left = low;
pos = low;
right = pivot + 1;
// Mische die Teilfolge in tmp
while (left <= pivot && right <= high) {
if (a[left] < a[right]) {
b[pos++] = a[left++];
}
else {
b[pos++] = a[right++];
}
}
// falls rechts fertig übernehme Rest von links
while (left <= pivot) {
b[pos++] = a[left++];
}
// links fertig übernehme Rest von rechts
while (right <= high) {
b[pos++] = a[right++];
}
//-------------
// kopiere tmp in input zurück
for (left = low; left < pos; left++)
a[left] = b[left];
}
void MergeSort(vector<int>& a, vector<int>& b, int low, int high) {
int mid;
// Aufteilen wenn l<h
if (low < high) {
mid = (low + high) / 2;
MergeSort(a, b, low, mid);
MergeSort(a, b, mid + 1, high);
// nach dem teilen
Merge(a, b, low, mid, high);
}
}
void natMerge(std::vector<int>& a, std::vector<int>& b, int left, int middle, int right) {
int i = left, j = middle + 1, k = left;
while (i <= middle && j <= right) {
if (a[i] <= a[j]) {
b[k++] = a[i++];
}
else {
b[k++] = a[j++];
}
}
while (i <= middle) {
b[k++] = a[i++];
}
while (j <= right) {
b[k++] = a[j++];
}
for (i = left; i <= right; i++) {
a[i] = b[i];
}
}
void natMergeSort(std::vector<int>& a, std::vector<int>& b) {
int n = a.size();
int left, middle, right;
while (true) {
left = 0;
bool merged = false;
while (left < n) {
middle = left;
while (middle < n - 1 && a[middle] <= a[middle + 1]) {
middle++;
}
if (middle == n - 1) {
break;
}
right = middle + 1;
while (right < n - 1 && a[right] <= a[right + 1]) {
right++;
}
Merge(a, b, left, middle, right);
merged = true;
left = right + 1;
}
if (!merged) {
break;
}
}
}
//************
// Heapsort *
//************
void heapify(vector<int>& a, int n, int i) {
int largest = i; // Initialize largest as root
int l = 2 * i + 1; // left child = 2*i + 1
int r = 2 * i + 2; // right child = 2*i + 2
// If left child is larger than root
if (l < n && a[l] > a[largest])
largest = l;
// If right child is larger than largest so far
if (r < n && a[r] > a[largest])
largest = r;
// If largest is not root
if (largest != i) {
swap(&a[i], &a[largest]);
// Recursively heapify the affected sub-tree
heapify(a, n, largest);
}
}
void HeapSort(vector<int>& a, int n) {
// create Heap
for (int i = n / 2 - 1; i >= 0; i--)
heapify(a, n, i);
for (int i = n - 1; i >= 0; i--) {
// Move current root to end
swap(&a[0], &a[i]);
// reduce heap
heapify(a, i, 0);
}
}
//************
// Shellsort *
//************
// Hier soll Hibbard implementiert werden
void ShellSort_2n(vector<int>& a, int n) {
int N = a.size();
int h = 1;
while (h < N / 3) {
h = 2 * h + 1; // Hibbard-Folge
}
// Schleife über die Abstandsfolge
while (h >= 1) {
// Insertion Sort von Elementen mit Abstand gap
for (int i = h; i < N; i++) {
int tmp = a[i];
int j = i;
while (j >= h && tmp < a[j - h]) {
a[j] = a[j - h];
j -= h;
}
a[j] = tmp;
}
h /= 2;
// Elemente sind im Abstand gap sortiert
}
}
void ShellSort_3n(vector<int>& a, int n) {
int N = a.size();
int h = 1;
while (h < N / 3) {
h = 3 * h + 1; // Hibbard-Folge
}
while (h >= 1) {
for (int i = h; i < N; i++) {
int tmp = a[i];
int j = i;
while (j >= h && a[j - h] > tmp) {
a[j] = a[j - h];
j -= h;
}
a[j] = tmp;
}
h /= 3;
}
}
void randomizeVector(vector<int>& array, int n) {
array.resize(n);
for (unsigned int i = 0; i < array.size(); i++)
array[i] = rand() % 1000000;
}
}

47
P2/ADS_P2_1_Sortieren/sorting.h Executable file
View File

@@ -0,0 +1,47 @@
#ifndef _SORTING_H_
#define _SORTING_H_
#include <vector>
#include <iostream>
#include <string>
using namespace std;
namespace sorting {
//************
// QuickSort *
//************
void QuickSort(vector<int> &arr, int left, int right);
//************
// MergeSort *
//************
void Merge(vector<int> &a, vector<int> &b,int low, int pivot, int high);
void MergeSort(vector<int> &a, vector<int> &b, int low, int high);
//************************
// Natuerliche Mergesort *
//************************
void natMerge(vector<int>& a, vector<int>& b, int low, int pivot, int high);
void natMergeSort(vector<int> &a, vector<int> &b);
//************
// Heapsort *
//************
void HeapSort(vector<int> &a, int n);
//************
// Shellsort *
//************
void ShellSort_2n(vector<int> &a, int n);
void ShellSort_3n(vector<int>& a, int n);
//*******************
// Helper functions *
//*******************
void randomizeVector(vector<int> &array, int n);
}
#endif

View File

@@ -0,0 +1,141 @@
/*************************************************
* ADS Praktikum 2
* Unit-Testdatei
* Stand: 02.05.2024
*
*************************************************
* Änderungen untersagt!
*************************************************/
#include <vector>
#include "catch.h"
#include "sorting.h"
std::vector<int> V{ 98, 44, 30, 22, 64, 63, 11, 23, 8, 18 };
TEST_CASE("Quicksort", "[QUICKSORT]") {
SECTION("sorting 10 elements - simple") {
std::vector<int> a(V);
sorting::QuickSort(a, 0, a.size() - 1);
REQUIRE(a.at(0) == 8);
REQUIRE(a.at(1) == 11);
REQUIRE(a.at(2) == 18);
REQUIRE(a.at(3) == 22);
REQUIRE(a.at(4) == 23);
REQUIRE(a.at(5) == 30);
REQUIRE(a.at(6) == 44);
REQUIRE(a.at(7) == 63);
REQUIRE(a.at(8) == 64);
REQUIRE(a.at(9) == 98);
}
}
TEST_CASE("ShellSort", "[SHELLSORT]") {
SECTION("sorting 10 elements - simple with 2n") {
std::vector<int> b(V);
sorting::ShellSort_2n(b, b.size());
REQUIRE(b.at(0) == 8);
REQUIRE(b.at(1) == 11);
REQUIRE(b.at(2) == 18);
REQUIRE(b.at(3) == 22);
REQUIRE(b.at(4) == 23);
REQUIRE(b.at(5) == 30);
REQUIRE(b.at(6) == 44);
REQUIRE(b.at(7) == 63);
REQUIRE(b.at(8) == 64);
REQUIRE(b.at(9) == 98);
}
SECTION("sorting 10 elements - simple with 3n") {
std::vector<int> b(V);
sorting::ShellSort_3n(b, b.size()); //////////
REQUIRE(b.at(0) == 8);
REQUIRE(b.at(1) == 11);
REQUIRE(b.at(2) == 18);
REQUIRE(b.at(3) == 22);
REQUIRE(b.at(4) == 23);
REQUIRE(b.at(5) == 30);
REQUIRE(b.at(6) == 44);
REQUIRE(b.at(7) == 63);
REQUIRE(b.at(8) == 64);
REQUIRE(b.at(9) == 98);
}
}
TEST_CASE("HeapSort", "[HEAPSORT]") {
SECTION("sorting 10 elements - simple") {
std::vector<int> c(V);
sorting::HeapSort(c, c.size());
REQUIRE(c.at(0) == 8);
REQUIRE(c.at(1) == 11);
REQUIRE(c.at(2) == 18);
REQUIRE(c.at(3) == 22);
REQUIRE(c.at(4) == 23);
REQUIRE(c.at(5) == 30);
REQUIRE(c.at(6) == 44);
REQUIRE(c.at(7) == 63);
REQUIRE(c.at(8) == 64);
REQUIRE(c.at(9) == 98);
}
}
TEST_CASE("MergeSort", "[MERGESORT]") {
SECTION("sorting 10 elements - simple") {
std::vector<int> d(V);
std::vector<int> tmp;
tmp.resize(d.size());
sorting::MergeSort(d, tmp, 0, d.size() - 1);
REQUIRE(d.at(0) == 8);
REQUIRE(d.at(1) == 11);
REQUIRE(d.at(2) == 18);
REQUIRE(d.at(3) == 22);
REQUIRE(d.at(4) == 23);
REQUIRE(d.at(5) == 30);
REQUIRE(d.at(6) == 44);
REQUIRE(d.at(7) == 63);
REQUIRE(d.at(8) == 64);
REQUIRE(d.at(9) == 98);
}
}
TEST_CASE("NatMergeSort", "[MERGESORT]") {
SECTION("sorting 10 elements - simple") {
std::vector<int> d(V);
std::vector<int> tmp;
tmp.resize(d.size());
sorting::natMergeSort(d, tmp);
REQUIRE(d.at(0) == 8);
REQUIRE(d.at(1) == 11);
REQUIRE(d.at(2) == 18);
REQUIRE(d.at(3) == 22);
REQUIRE(d.at(4) == 23);
REQUIRE(d.at(5) == 30);
REQUIRE(d.at(6) == 44);
REQUIRE(d.at(7) == 63);
REQUIRE(d.at(8) == 64);
REQUIRE(d.at(9) == 98);
}
}
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

View File

@@ -0,0 +1,21 @@
# Set the minimum required version of CMake
cmake_minimum_required(VERSION 3.11)
# Set the project name and specify the C++ as the project language
project(P2_2_Hashtable)
# Specify the C++ standard
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# set(SOURCE_DIR "ADS/ADS-Praktika/P1/")
add_executable(P2_2_Hashtable main.cpp hashtable.cpp unit_tests.cpp)
# Include directories for the target
# target_include_directories(Hashtable PRIVATE ${SOURCE_DIR})
# Find and link OpenMP
find_package(OpenMP REQUIRED)
if(OpenMP_CXX_FOUND)
target_link_libraries(P2_2_Hashtable PRIVATE OpenMP::OpenMP_CXX)
endif()

18182
P2/ADS_P2_2_Hashtable/catch.h Executable file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,172 @@
#include "hashtable.h"
#include <iostream>
#include <cmath> // Für std::ceil
using namespace std;
HashTable::HashTable(int size, double threshhold, int methode) {
hashTable = new vector<int>(size, -1);
this->size = size;
this->threshhold_rehashing = threshhold;
this->m_sondierMethode = methode;
this->elements = 0;
this->collisionCount = 0;
}
HashTable::~HashTable() {
this->size = 0;
this->elements = 0;
this->collisionCount = 0;
this->hashTable->clear();
delete hashTable;
}
int get_next_prime(int x) {
x = x + 1;
bool found = true;
while (true) {
found = true;
for (int i = 2; i <= sqrt(x); i++) {
if (x % i == 0) {
found = false;
break;
}
}
if (found) {
return x;
}
x += 1;
}
}
int get_last_prime(int x) {
x = x - 1;
bool found = true;
while (true) {
found = true;
for (int i = 2; i <= sqrt(x); i++) {
if (x % i == 0) {
found = false;
break;
}
}
if (found) {
return x;
}
x -= 1;
}
}
// Berechnung des Hashwertes
int HashTable::hashValue(int item) {
switch (m_sondierMethode) {
case (1): {
// Lineares Sondieren
int i = 0;
int index = (item + i) % getSize();
while (hashTable->at(index) != -1) {
collisionCount++;
i++;
index = (item + i) % getSize();
}
return index;
}
case (2): {
// Quadr. Sondieren
int i = 0;
int index = (item + (i * i)) % getSize();
while (hashTable->at(index) != -1) {
collisionCount++;
i++;
index = (item + (i * i)) % getSize();
}
return index;
}
case (3): {
// Doppeltes Hashing
int R = get_last_prime(getSize());
int i = 0;
int index = (item + i * (R - (item % R))) % getSize();
while (hashTable->at(index) != -1) {
collisionCount++;
i++;
index = (item + i * (R - (item % R))) % getSize();
}
return index;
}
default: {
break;
}
}
return -1;
}
void HashTable::rehashing() {
int newSize = get_next_prime(2 * getSize());
if (newSize < 1000) {
vector<int>* newTable = new vector<int>(newSize, -1);
collisionCount = 0;
for (int i = 0; i < getSize(); i++) {
if (hashTable->at(i) != -1) {
int newIndex = hashTable->at(i) % newSize;
int j = 0;
while (newTable->at(newIndex) != -1) {
j++;
collisionCount++;
// Neue Hash Funktion für das Rehashing
// h(k_i) = k_i mod neueGröße
newIndex = (newIndex + j) % newSize;
}
newTable->at(newIndex) = hashTable->at(i);
}
}
hashTable = newTable;
size = newSize;
}
else
return;
}
int HashTable::insert(int item) {
elements++;
double resizeLimit = getSize() * threshhold_rehashing;
if (getElements() >= resizeLimit) {
rehashing();
}
int index = hashValue(item);
hashTable->at(index) = item;
return index;
}
int HashTable::at(int i) {
return hashTable->at(i);
}
int HashTable::getCollisionCount() {
return this->collisionCount;
}
int HashTable::getSize() {
return this->size;
}
int HashTable::getElements() {
return this->elements;
}

View File

@@ -0,0 +1,35 @@
#ifndef _HASHTABLE_H_
#define _HASHTABLE_H_
#include <vector>
#include <math.h>
using namespace std;
class HashTable {
public:
HashTable(int size, double threshold=0.6, int methode=2); // Konstruktor
~HashTable(); // Destruktor
int insert(int item); // fuegt ein Element der Hashtabelle hinzu
int at(int i); // Liefert das i-te Element der Hashtabelle zurueck
int getCollisionCount(); // Liefert die Anzahl der Kollisionen zurueck
int getSize(); // Liefert die Groesse der Hashtabelle zurueck
int getElements(); // Liefert die Anzahl der Elemente der Hashtabelle zurueck
void print(); // Ausgabe der Hashtable ind er Form:
// [0] -> 1
// .....
private:
int size; // Groesse der HashTable
int elements; // Anz. d. Elemente in HashTable
int collisionCount; // Anz. d. Kollisionen beim Einfuegen
double threshhold_rehashing; // Schwellwert fuers rehashing (size/elements)
int m_sondierMethode; // Sondier Methode 1 - linear, 2 - quadratisch, 3 - doppeltes Hashing
vector<int>* hashTable; // HashTable
int hashValue(int item); // calculate hash value
void rehashing(); // rehashing
};
// Helper Funktion:
int get_next_Prime(int a); // Gibt zu einer natuerlichen Zahl a, die naechstgroessere Primzahl zurueck
int get_last_Prime(int a); // Gibt zu einer natuerlichen Zahl a, die naechstkleienre Primzahl zurueck
#endif

30
P2/ADS_P2_2_Hashtable/main.cpp Executable file
View File

@@ -0,0 +1,30 @@
#define CATCH_CONFIG_RUNNER
#include "catch.h"
#include <iostream>
#include "hashtable.h"
#include <cstdlib> // Für rand() und srand()
#include <ctime> // Für time()
int main() {
Catch::Session().run();
// Initialisiere den Zufallsgenerator
srand(static_cast<unsigned int>(time(0)));
int option = 1;
while (0 < option && option < 4) {
std::cout << "Wählen Sie die Sondierungsmethode : \n1 - linear\n2 - quadratisch\n3 - Doppeltes Hashing\n> ";
std::cin >> option;
HashTable H(1000, 0.6, option);
for (int i = 0; i < 200; ++i) {
int randomValue = 1000 + rand() % 501;
H.insert(randomValue);
}
std::cout << "Anzahl der Kollisionen: " << H.getCollisionCount() << std::endl;
}
system("pause");
return 0;
}

View File

@@ -0,0 +1,120 @@
/*************************************************
* ADS Praktikum 2
* Unit-Testdatei
* Stand: 20.05.2024
*
*************************************************
* Änderungen untersagt!
*************************************************/
#include <vector>
#include "catch.h"
#include "hashtable.h"
std::vector<int> V{98, 44, 30, 22, 64, 63, 11, 23, 8, 18};
TEST_CASE("HashTable", "[HASHTABLE]") {
SECTION("Hashing 10 elements - Size: 20 : Rehashing") {
HashTable H(20,0.6,1);
for (unsigned int i = 0; i < V.size(); i++)
{
H.insert(V.at(i));
}
H.insert(15);
H.insert(16);
H.insert(21);
H.insert(22);
if (H.getSize() > 0) {
REQUIRE(H.at(3) == 44);
REQUIRE(H.at(8) == 8);
REQUIRE(H.at(11) == 11);
REQUIRE(H.at(15) == 15);
REQUIRE(H.at(16) == 98);
REQUIRE(H.at(17) == 16);
REQUIRE(H.at(18) == 18);
REQUIRE(H.at(21) == 21);
REQUIRE(H.at(22) == 22);
REQUIRE(H.at(23) == 63);
REQUIRE(H.at(24) == 64);
REQUIRE(H.at(25) == 22);
REQUIRE(H.at(26) == 23);
REQUIRE(H.at(30) == 30);
}
REQUIRE(H.getSize() == 41);
REQUIRE(H.getCollisionCount() == 8);
REQUIRE(H.getElements() == 14);
}
SECTION("Hashing 10 elements - quadratisch Sondieren - Size: 15 : Rehashing") {
HashTable H(15, 0.6, 2);
for (unsigned int i = 0; i < V.size(); i++)
{
H.insert(V.at(i));
}
H.insert(15);
H.insert(16);
H.insert(21);
H.insert(22);
if (H.getSize() > 0) {
REQUIRE(H.at(1) == 63);
REQUIRE(H.at(2) == 64);
REQUIRE(H.at(5) == 98);
REQUIRE(H.at(8) == 8);
REQUIRE(H.at(11) == 11);
REQUIRE(H.at(13) == 44);
REQUIRE(H.at(15) == 15);
REQUIRE(H.at(16) == 16);
REQUIRE(H.at(18) == 18);
REQUIRE(H.at(21) == 21);
REQUIRE(H.at(22) == 22);
REQUIRE(H.at(23) == 23);
REQUIRE(H.at(26) == 22);
REQUIRE(H.at(30) == 30);
}
REQUIRE(H.getSize() == 31);
REQUIRE(H.getCollisionCount() == 2);
REQUIRE(H.getElements() == 14);
}
SECTION("Hashing 10 elements - doppeltes Hashing- Size: 15 : Rehashing") {
HashTable H(15, 0.6, 3);
for (unsigned int i = 0; i < V.size(); i++)
{
H.insert(V.at(i));
}
H.insert(15);
H.insert(16);
H.insert(21);
H.insert(22);
if (H.getSize() > 0) {
REQUIRE(H.at(1) == 63);
REQUIRE(H.at(2) == 64);
REQUIRE(H.at(5) == 98);
REQUIRE(H.at(8) == 8);
REQUIRE(H.at(11) == 11);
REQUIRE(H.at(13) == 44);
REQUIRE(H.at(15) == 15);
REQUIRE(H.at(16) == 16);
REQUIRE(H.at(18) == 18);
REQUIRE(H.at(21) == 21);
REQUIRE(H.at(22) == 22);
REQUIRE(H.at(23) == 23);
REQUIRE(H.at(29) == 22);
REQUIRE(H.at(30) == 30);
}
REQUIRE(H.getSize() == 31);
REQUIRE(H.getCollisionCount() == 1);
REQUIRE(H.getElements() == 14);
}
}
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

BIN
P2/ADS_Praktikum_2.pdf Executable file

Binary file not shown.

BIN
P3/ADS_Praktikum_3.pdf Executable file

Binary file not shown.

12
P3/CMakeLists.txt Executable file
View File

@@ -0,0 +1,12 @@
# Set the minimum required version of CMake
cmake_minimum_required(VERSION 3.11)
# Set the project name and specify the C++ as the project language
project(P3_Binaerbaum)
# Specify the C++ standard
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Add an executable with the above sources
add_executable(P3_Binaerbaum main.cpp Tree.cpp TreeNode.cpp TreeTest.cpp)

18
P3/ExportZielanalyse.csv Executable file
View File

@@ -0,0 +1,18 @@
A;70;0;0
A;20;0;0
A;90;0;0
A;10;0;0
A;60;0;0
A;80;0;0
A;91;0;0
A;40;0;0
A;84;0;0
A;95;0;0
A;30;0;0
A;50;0;0
A;82;0;0
A;86;0;0
A;93;0;0
A;96;0;0
A;92;0;0
A;94;0;0
1 A 70 0 0
2 A 20 0 0
3 A 90 0 0
4 A 10 0 0
5 A 60 0 0
6 A 80 0 0
7 A 91 0 0
8 A 40 0 0
9 A 84 0 0
10 A 95 0 0
11 A 30 0 0
12 A 50 0 0
13 A 82 0 0
14 A 86 0 0
15 A 93 0 0
16 A 96 0 0
17 A 92 0 0
18 A 94 0 0

485
P3/Tree.cpp Executable file
View File

@@ -0,0 +1,485 @@
//
// Tree.cpp
// ADS P3
//
#include "Tree.h"
#include "TreeNode.h"
#include <iomanip>
#include <iostream>
#include <string>
#include <queue>
Tree::Tree() : m_anker{ nullptr }, m_currentNodeChronologicalID{ 0 } {}
Tree::~Tree() {
deleteAll(m_anker);
}
void Tree::deleteAll(TreeNode* _anker) {
if (_anker != nullptr) {
deleteAll(_anker->getLeft());
deleteAll(_anker->getRight());
delete _anker;
}
return;
}
bool Tree::isLeaf(TreeNode* _node) {
if (!_node->getLeft() && !_node->getRight())
return true;
return false;
}
void Tree::balance(TreeNode* node) {
TreeNode* ptr = node;
TreeNode* par = ptr->getParent();
while (par) {
// parent & ptr sind rot
if (ptr->getRed() && par->getRed()) {
// Knoten ist links von parent
if (par->getLeft() == ptr) {
// parent ist links von grandparent
if (par->getParent()->getLeft() == par)
rotateTreeRight(par->getParent(), par);
// PP
// P
// ptr
else {
rotateTreeRight(par, ptr);
rotateTreeLeft(ptr->getParent(), ptr);
}
}
// Knoten ist rechts von parent
else {
// parent ist rechts von grandparent
if (par->getParent()->getRight() == par)
rotateTreeLeft(par->getParent(), par);
// PP
// p
// ptr
else {
rotateTreeLeft(par, ptr);
rotateTreeRight(ptr->getParent(), ptr);
}
}
}
ptr = par;
par = ptr->getParent();
}
return;
}
bool Tree::split4Node(TreeNode* node) {
TreeNode* left = node->getLeft();
TreeNode* right = node->getRight();
if (!node || node->getRed() || !left || !right)
return false;
else {
if (left->getRed() && right->getRed()) {
left->setRed(false);
right->setRed(false);
if (node != m_anker)
node->setRed(true);
return true;
}
}
return false;
}
void Tree::height() {
int proof = proofRBCriterion(m_anker);
if (proof == -1)
std::cout << "Error proofRBCriterion()" << std::endl;
else {
std::cout << std::endl
<< "Root has height: " << proof << std::endl;
}
}
int Tree::proofRBCriterion() {
return proofRBCriterion(this->m_anker);
}
int Tree::proofRBCriterion(TreeNode* node) {
if (!node)
return 0; // -1, da nicht existend
int left = proofRBCriterion(node->getLeft());
int right = proofRBCriterion(node->getRight());
// Fall 1: nur ein Nachfolger
if ((!node->getRight() && node->getLeft()) || (!node->getLeft() && node->getRight())) {
// Nachfolger ist rechts
if (node->getRight()) {
if (node->getRight()->getRed()) // roter Nachfolger ist auf dem selben Nivau
return right;
else // schwarzer Nachfolger ist ein Niveau tiefer
return ++right;
}
// Nachfolger ist links
else {
if (node->getLeft()->getRed()) // roter Nachfolger ist auf dem selben Nivau
return left;
else // schwarzer Nachfolger ist ein Niveau tiefer
return ++left;
}
}
// Fall 2-4: mit zwei Nachfolgern
else if (node->getRight() && node->getLeft()) {
// Fall 2: ein Nachfolger ist rot
if ((node->getLeft()->getRed() && !node->getRight()->getRed()) || (!node->getLeft()->getRed() && node->getRight()->getRed())) {
if (node->getLeft()->getRed() && left == right + 1) // links ist rot
return left;
else if (node->getRight()->getRed() && right == left + 1) // rechts ist rot
return right;
else // Fehler in der Zählung
return -1;
}
// Fall 3: beide Nachfolger sind rot => 4er Knoten
if (node->getLeft()->getRed() && node->getRight()->getRed()) {
if (left == right) // beide müssen auf dem selben Niveu sein
return left;
else // Fehler in der Zählung
return -1;
}
// Fall 5: beide Nachfolger sind schwarz
else {
if (left == right) // beide müssen auf dem selben Niveu sein
return ++left;
else
return -1;
}
}
// Fall 5: keine Nachfolger
else
return 0;
}
bool Tree::rotateTreeRight(TreeNode* _parent, TreeNode* _child) {
_parent->setLeft(_child->getRight());
if (_child->getRight())
_child->getRight()->setParent(_parent);
_child->setParent(_parent->getParent());
if (!_parent->getParent())
m_anker = _child;
else if (_parent == _parent->getParent()->getLeft())
_parent->getParent()->setLeft(_child);
else
_parent->getParent()->setRight(_child);
_child->setRight(_parent);
_child->setRed(false);
_parent->setParent(_child);
_parent->setRed(true);
return true;
}
bool Tree::rotateTreeLeft(TreeNode* _parent, TreeNode* _child) {
_parent->setRight(_child->getLeft());
if (_child->getLeft())
_child->getLeft()->setParent(_parent);
_child->setParent(_parent->getParent());
if (!_parent->getParent()) {
m_anker = _child;
}
else if (_parent == _parent->getParent()->getLeft()) {
_parent->getParent()->setLeft(_child);
}
else
_parent->getParent()->setRight(_child);
_child->setLeft(_parent);
_child->setRed(false);
_parent->setParent(_child);
_parent->setRed(true);
return true;
}
bool Tree::searchNode(std::string _name) {
bool found = false;
helpSearch(m_anker, _name, found);
if (!found)
std::cout << "+ Datensatz nicht gefunden." << std::endl;
return found;
}
void Tree::helpSearch(TreeNode* _anker, std::string _name, bool& _found) {
if (_anker != nullptr) {
if (_anker->getName() == _name) {
_found = true;
std::cout << "+ Fundstelle:";
printerHeader();
_anker->print();
}
helpSearch(_anker->getLeft(), _name, _found);
helpSearch(_anker->getRight(), _name, _found);
}
return;
}
bool Tree::addNode(std::string _name, int _age, double _income, int _postCode) {
TreeNode* leaf = new TreeNode(0, m_currentNodeChronologicalID, _name, _income, _postCode, _age);
m_currentNodeChronologicalID++;
if (m_anker == nullptr) {
leaf->setRed(false);
m_anker = leaf;
return true;
}
TreeNode* ptr = m_anker;
TreeNode* par = ptr;
while (ptr != nullptr) {
par = ptr;
split4Node(ptr);
if (leaf->getNodeOrderID() < ptr->getNodeOrderID())
ptr = ptr->getLeft();
else
ptr = ptr->getRight();
}
if (leaf->getNodeOrderID() < par->getNodeOrderID())
par->setLeft(leaf);
else
par->setRight(leaf);
leaf->setParent(par);
m_anker->setRed(false);
balance(leaf);
return true;
}
// Print Funktionen
void Tree::printAll() {
printerHeader();
printer(m_anker);
std::cout << "-----+-------------+-----+----------+----------+--------+" << std::endl;
height();
}
void Tree::printer(TreeNode* node) {
if (!node)
return;
node->print();
printer(node->getLeft());
printer(node->getRight());
return;
}
void Tree::printLevel(TreeNode* _anker) {
if (!_anker)
return;
if (!_anker->getRed())
_anker->print();
if (_anker->getLeft()) {
if (_anker->getLeft()->getRed())
_anker->getLeft()->print();
}
if (_anker->getRight()) {
if (_anker->getRight()->getRed())
_anker->getRight()->print();
}
printLevel(_anker->getLeft());
printLevel(_anker->getRight());
}
void Tree::printLevelOrder() {
std::cout << "Ausgabe in LevelOrder als Binaer Baum" << std::endl;
printerHeader();
printLevel(m_anker);
std::cout << "-----+-------------+-----+----------+----------+--------+" << std::endl;
std::cout << "Ausgabe in LevelOrder als 234-Tree: " << std::endl;
print234Tree();
height();
}
void Tree::printLevelOrder(int niveau) {
print234Tree(niveau);
}
void Tree::print234Tree() {
if (!m_anker)
return;
int niv = 0;
std::queue<int> nivQ;
std::queue<TreeNode*> nodeQ;
nodeQ.push(m_anker);
nivQ.push(niv);
std::cout << "Niveau " << niv << ":";
TreeNode* ptr;
int nivOut;
while (!nodeQ.empty()) {
ptr = nodeQ.front();
nivOut = nivQ.front();
nodeQ.pop();
nivQ.pop();
if (niv < nivOut) {
std::cout << std::endl
<< "Niveau " << nivOut << ":";
niv++;
}
std::cout << " (";
if (ptr->getLeft()) {
TreeNode* left = ptr->getLeft();
if (left->getRed()) {
if (left->getLeft()) {
nodeQ.push(left->getLeft());
nivQ.push(left->depth() + 1);
}
if (left->getRight()) {
nodeQ.push(left->getRight());
nivQ.push(left->depth() + 1);
}
left->printOrderID();
}
else {
nodeQ.push(left);
nivQ.push(left->depth());
}
}
ptr->printOrderID();
if (ptr->getRight()) {
TreeNode* right = ptr->getRight();
if (right->getRed()) {
if (right->getLeft()) {
nodeQ.push(right->getLeft());
nivQ.push(right->depth() + 1);
}
if (right->getRight()) {
nodeQ.push(right->getRight());
nivQ.push(right->depth() + 1);
}
right->printOrderID();
}
else {
nodeQ.push(right);
nivQ.push(right->depth());
}
}
std::cout << ")";
}
}
void Tree::print234Tree(int niveau) {
if (!m_anker)
return;
int niv = 0;
std::queue<int> nivQ;
std::queue<TreeNode*> nodeQ;
nodeQ.push(m_anker);
nivQ.push(niv);
TreeNode* ptr;
int nivOut;
while (!nodeQ.empty()) {
ptr = nodeQ.front();
nivOut = nivQ.front();
nodeQ.pop();
nivQ.pop();
if (niveau + 1 == nivOut)
return;
if (niv < nivOut) {
if (nivOut == niveau)
std::cout << std::endl << "Niveau " << niveau << ":";
niv++;
}
if (niv == niveau && niveau == 0)
std::cout << std::endl << "Niveau " << niveau << ":";
if (niv == niveau)
std::cout << " (";
if (ptr->getLeft()) {
TreeNode* left = ptr->getLeft();
if (left->getRed()) {
if (left->getLeft()) {
nodeQ.push(left->getLeft());
nivQ.push(left->depth() + 1);
}
if (left->getRight()) {
nodeQ.push(left->getRight());
nivQ.push(left->depth() + 1);
}
if (niv == niveau)
left->printOrderID();
}
else {
nodeQ.push(left);
nivQ.push(left->depth());
}
}
if (niv == niveau)
ptr->printOrderID();
if (ptr->getRight()) {
TreeNode* right = ptr->getRight();
if (right->getRed()) {
if (right->getLeft()) {
nodeQ.push(right->getLeft());
nivQ.push(right->depth() + 1);
}
if (right->getRight()) {
nodeQ.push(right->getRight());
nivQ.push(right->depth() + 1);
}
if (niv == niveau)
right->printOrderID();
}
else {
nodeQ.push(right);
nivQ.push(right->depth());
}
}
if (niv == niveau)
std::cout << ")";
}
std::cout << std::endl << std::endl;
}
void Tree::printerHeader() {
std::cout << std::endl;
std::cout.width(5);
std::cout << "ID"
<< "|";
std::cout.width(13);
std::cout << "Name"
<< "|";
std::cout.width(5);
std::cout << "Age"
<< "|";
std::cout.width(10);
std::cout << "Income"
<< "|";
std::cout.width(10);
std::cout << "PostCode"
<< "|";
std::cout.width(8);
std::cout << "OrderID"
<< "|" << std::endl;
std::cout << "-----+-------------+-----+----------+----------+--------+" << std::endl;
}

49
P3/Tree.h Executable file
View File

@@ -0,0 +1,49 @@
//
// Tree.hpp
// ADS P3
//
#pragma once
#include "TreeNode.h"
#include <string>
class Tree {
private:
TreeNode* m_anker;
int m_currentNodeChronologicalID;
void deleteAll(TreeNode* _anker);
bool isLeaf(TreeNode* _node);
void balance(TreeNode* _node);
bool split4Node(TreeNode* _node);
void height();
bool rotateTreeRight(TreeNode*, TreeNode*);
bool rotateTreeLeft(TreeNode*, TreeNode*);
void helpSearch(TreeNode* _anker, std::string _name, bool& _found);
void printerHeader();
void printer(TreeNode* _anker);
void printLevel(TreeNode* _anker);
public:
Tree();
~Tree();
int proofRBCriterion();
int proofRBCriterion(TreeNode*);
bool addNode(std::string _name, int _age, double _income, int _postCode);
bool searchNode(std::string _name);
void printAll(void);
void print234Tree();
void print234Tree(int niveau);
void printLevelOrder();
void printLevelOrder(int niveau);
// friend-Funktionen sind für die Tests erforderlich und müssen unangetastet
// bleiben!
friend TreeNode* get_anker(Tree& TN);
};

67
P3/TreeNode.cpp Executable file
View File

@@ -0,0 +1,67 @@
//
// TreeNode.cpp
// ADS P3
//
#include "TreeNode.h"
#include <iostream>
#include <string>
TreeNode::TreeNode(int _nodeOrderID, int _nodeChronologicalID, std::string _name, double _income, int _postCode, int _age) :
m_NodeChronologicalID{ _nodeChronologicalID },
m_Name{ _name },
m_Age{ _age },
m_Income{ _income },
m_PostCode{ _postCode },
red{ true } {
m_NodeOrderID = m_Age + m_PostCode + int(m_Income);
m_left = nullptr;
m_right = nullptr;
m_parent = nullptr;
}
TreeNode::~TreeNode() {
}
void TreeNode::print() {
std::cout.width(5);
std::cout << this->getNodeChronologicalID() << "|";
std::cout.width(13);
std::cout << this->getName() << "|";
std::cout.width(5);
std::cout << this->getAge() << "|";
std::cout.width(10);
std::cout << this->getIncome() << "|";
std::cout.width(10);
std::cout << this->getPostCode() << "|";
std::cout.width(8);
std::cout << this->getNodeOrderID() << "|" << std::endl;
}
void TreeNode::printOrderID() {
std::cout << " " << m_NodeOrderID << " ";
}
void TreeNode::setRed(bool _red) {
if (this != nullptr)
red = _red;
return;
}
bool TreeNode::getRed() {
if (this)
return red;
else
return false;
}
int TreeNode::depth() {
TreeNode* ptr = this;
int depth = 0;
while (ptr != nullptr) {
if (!ptr->getRed()) depth++;
ptr = ptr->getParent();
}
return depth - 1;
}

63
P3/TreeNode.h Executable file
View File

@@ -0,0 +1,63 @@
//
// TreeNode.hpp
// ADS P3
//
#pragma once
#include <string>
using namespace std;
class TreeNode {
private:
int m_NodeOrderID;
int m_NodeChronologicalID;
std::string m_Name;
int m_Age;
double m_Income;
int m_PostCode;
TreeNode* m_left;
TreeNode* m_right;
TreeNode* m_parent;
bool red;
public:
TreeNode(int, int, std::string, double, int, int _age = 1);
~TreeNode();
int getNodeOrderID() { return m_NodeOrderID; }
void setNodeOderID(int _id) { m_NodeOrderID = _id; }
int getNodeChronologicalID() { return m_NodeChronologicalID; }
void setNodeChronologicalID(int _id) { m_NodeChronologicalID = _id; }
std::string getName() { return m_Name; }
void setName(std::string _name) { m_Name = _name; }
int getAge() { return m_Age; }
void setAge(int _age) { m_Age = _age; }
double getIncome() { return m_Income; }
void setIncome(double _income) { m_Income = _income; }
int getPostCode() { return m_PostCode; }
void setPostCode(int _postCode) { m_PostCode = _postCode; }
bool getRed();
void setRed(bool _red);
TreeNode* getLeft() { return m_left; }
void setLeft(TreeNode* _left) { m_left = _left; }
TreeNode* getRight() { return m_right; }
void setRight(TreeNode* _right) { m_right = _right; }
TreeNode* getParent() { return m_parent; }
void setParent(TreeNode* _parent) { m_parent = _parent; }
int depth();
void printOrderID();
void print();
};

484
P3/TreeTest.cpp Executable file

File diff suppressed because one or more lines are too long

18182
P3/catch.h Executable file

File diff suppressed because it is too large Load Diff

107
P3/main.cpp Executable file
View File

@@ -0,0 +1,107 @@
//
// main.cpp
// ADS P3
//
#define CATCH_CONFIG_RUNNER
#include "Tree.h"
#include "catch.h"
#include <iostream>
#include <fstream>
void mainscreen_addTreeCSV(Tree*& ref) {
char response;
cout << "+ Moechten Sie die Daten aus der Datei ExportZielanalyse.csv "
"importieren(j / n) \n?> ";
cin >> response;
if (response == 'j') {
ifstream csvread;
csvread.open("../ExportZielanalyse.csv", ios::in);
if (!csvread.is_open()) {
cout << "Fehler beim Lesen!" << endl;
return;
}
else {
string name, age, postcode, income;
while (!csvread.eof()) {
getline(csvread, name, ';');
getline(csvread, age, ';');
getline(csvread, income, ';');
getline(csvread, postcode, '\n');
ref->addNode(name, stoi(age), stod(income), stoi(postcode));
}
csvread.close();
}
cout << "+ Daten wurden dem Baum hinzugefuegt." << endl;
}
}
int main() {
int result = Catch::Session().run();
Tree* m_Baum = new Tree();
int engb;
while (true) {
cout << "====================================\n"
"1) Datensatz einfuegen, manuell\n"
"2) Datensatz einfuegen, CSV Datei\n"
"3) Suchen\n"
"4) Ausgabe in Levelorder\n"
"5) Ausgabe in Levelorder (mit Niveauauswahl)\n"
"6) Beenden\n"
"?> ";
cin >> engb;
switch (engb) {
case 1: {
string name;
int alter, plz;
double einkommen;
cout << "\n+ Bitte geben Sie die den Datensatz ein"
"\nName \n?> ";
cin >> name;
cout << "\nAlter \n?> ";
cin >> alter;
cout << "\nEinkommen \n?> ";
cin >> einkommen;
cout << "\nPLZ \n?> ";
cin >> plz;
m_Baum->addNode(name, alter, einkommen, plz);
cout << "\n+ Ihr Datensatz wurde eingefuegt" << endl;
break;
}
case 2: {
mainscreen_addTreeCSV(m_Baum);
break;
}
case 3: {
string name;
cout << "+ Bitte geben Sie den zu suchenden Datensatz an\n"
"Name ?> ";
cin >> name;
cout << "+ Fundstellen:\n";
m_Baum->searchNode(name);
break;
}
case 4: {
m_Baum->printLevelOrder();
break;
}
case 5: {
int niveau;
cout << "\n+ Bitte geben Sie das Niveau ein"
"\nNiveau \n?> ";
cin >> niveau;
m_Baum->print234Tree(niveau);
break;
}
case 6: {
return 0;
}
}
};
return 0;
}

BIN
P4/ADS_Praktikum_4.pdf Executable file

Binary file not shown.

12
P4/CMakeLists.txt Executable file
View File

@@ -0,0 +1,12 @@
# Set the minimum required version of CMake
cmake_minimum_required(VERSION 3.11)
# Set the project name and specify the C++ as the project language
project(P4_Graph)
# Specify the C++ standard
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Add an executable with the above sources
add_executable(P4_Graph main.cpp DijkstraSP.cpp EdgeWeightedDigraph.cpp EdgeWeightedGraph.cpp GraphTest.cpp KruskalMST.cpp PrimMST.cpp)

95
P4/DijkstraSP.cpp Executable file
View File

@@ -0,0 +1,95 @@
#include <assert.h>
#include <float.h>
#include <algorithm>
#include "DijkstraSP.h"
/**
* F<>ge eine Kante mit minimalen Kosten hinzu, die von einem
* Baumknoten zu einem Nicht-Baumknoten verl<72>uft und deren
* Ziel w dem Startknoten s am n<>chsten ist.
*
* \param[in] G Kantengewichteter-Digraph
* \param[in] v Zielknoten
*/
void DijkstraSP::relax(EdgeWeightedDigraph G, int v) {
std::vector<DirectedEdge> edges = G[v]; //adjazente Knoten zum Knoten v
for (DirectedEdge e: edges) {
int w = e.to();
if (distToVect[w] > distToVect[v] + e.weight()) {
distToVect[w] = distToVect[v] + e.weight();
edgeTo[w] = e;
if (pq.contains(w))
pq.change(w, distToVect[v]);
else
pq.push(w, distToVect[w]);
}
}
}
/**
* Fuert den Dijkstra Algorithmus von s, im Graph G aus.
*
* \param[in] G Kantengewichteter-Digraph
* \param[in] s Startknoten
*/
DijkstraSP::DijkstraSP(EdgeWeightedDigraph G, int s) {
//Initialisiere distToVect mit "unendlich"
distToVect.resize(G.getV());
for (int v = 0; v < G.getV(); v++) {
distToVect[v] = DBL_MAX;
}
//Setze die Kosten f<>r Startknoten auf 0
distToVect[s] = 0.0;
pq.push(s, 0.0);
//F?ge immer eine Kante mit minimalen Pfadkosten zu s hinzu
while (!pq.empty()) {
int min_node = pq.top().value;
pq.pop();
//F?ge immer eine Kante mit minimalen Pfadkosten zu s der PQ hinzu
relax(G, min_node);
}
}
/**
* Gibt die Distanz von s zum Knoten v zurueck
*
* \param[in] v Zielknoten
* \return Summe der Gewichte auf dem Pfad zu v
*/
double DijkstraSP::distTo(int v) const {
return distToVect[v];
}
/**
* Gibt zurueck ob es einen Pfad zu v von s aus gibt
*
* \param[in] v Zielknoten
* \return true, wenn es einen Pfad von s nach v gibt, sonst false
*/
bool DijkstraSP::hasPathTo(int v) const {
if (distToVect[v] == DBL_MAX)
return false;
return true;
}
/**
* Gibt den Pfad von s nach v als Vektor zurueck
*
* \param[in] v Zielknoten
* \return Vektor mit allen Kanten des Pfades von s nach v
*/
std::vector<DirectedEdge> DijkstraSP::pathTo(int v) {
std::vector<DirectedEdge> path;
DirectedEdge e = edgeTo[v];
while (true) {
path.push_back(e);
if (edgeTo.count(e.from()) > 0) {
e = edgeTo[e.from()];
} else break;
}
std::reverse(path.begin(), path.end());
return path;
}

25
P4/DijkstraSP.h Executable file
View File

@@ -0,0 +1,25 @@
#pragma once
#include <vector>
#include <queue>
#include <map>
#include "EdgeWeightedDigraph.h"
#include "PriorityQueue.h"
class DijkstraSP {
private:
std::map<int, DirectedEdge> edgeTo;
std::vector<double> distToVect;
Utils::PriorityQueue<int> pq;
void relax(EdgeWeightedDigraph G, int v);
public:
DijkstraSP() {
};
DijkstraSP(EdgeWeightedDigraph G, int s);
double distTo(int v) const; // Abst<73>nde vom Startvertex zu v
bool hasPathTo(int v) const; // <20>berpr<70>ft die existens eines Pfades
std::vector<DirectedEdge> pathTo(int v); // Kanten des k<>rzsesten Weges
};

163
P4/EdgeWeightedDigraph.cpp Executable file
View File

@@ -0,0 +1,163 @@
#include <assert.h>
#include <iomanip>
#include <vector>
#include <fstream>
#include <string>
#include "EdgeWeightedDigraph.h"
/**
* Gibt zurueck ob der Knoten v ein gueltiger Knoten im Graph ist
*
* \param[in] v Knoten
* \return Gueltigkeit des Knoten
*/
bool EdgeWeightedDigraph::validateVertex(int v) const {
return v >= 0 && v < this->V;
}
/**
* Gibt eine Fehlermeldung aus, wenn der Knoten v im Graph nicht gueltig ist
*
* \param[in] v Knoten
*/
void EdgeWeightedDigraph::validateVertexWithError(int v) const {
assert(("Vertex is out of bounds!", this->validateVertex(v)));
}
/**
* Erstellt einen Kantengewichteten-Gaph mit V Knoten
*
* \param[in] V Anzahl der Knoten
*/
EdgeWeightedDigraph::EdgeWeightedDigraph(int V)
: V{V}
, E{0} {
adj.resize(V);
}
/**
* Erstellt einen Kantengewichteten-Gaph anhand der Kantenliste in fname
*
* \param[in] fname Dateiname der Kantenliste
*/
EdgeWeightedDigraph::EdgeWeightedDigraph(std::string filename) {
std::ifstream infile(filename);
int tmp_e = 0;
infile >> this->V >> tmp_e;
this->E = 0;
this->adj.resize(this->V, std::vector<DirectedEdge>());
int v, w;
double weight;
while (infile >> v >> w >> weight) {
this->add(DirectedEdge(v, w, weight));
}
assert(("Missing edges!", tmp_e == this->E));
}
/**
* Fuegt die Kante e zum Graphen hinzu
*
* \param[in] e Kante
*/
void EdgeWeightedDigraph::add(DirectedEdge e) {
this->validateVertexWithError(e.from());
this->validateVertexWithError(e.to());
this->adj[e.from()].push_back(e);
this->E++;
}
/**
* Gibt die Anzahl der Knoten zurueck
*
* \return Anzahl der Knoten
*/
int EdgeWeightedDigraph::getV() const {
return this->V;
}
/**
* Gibt die Anzahl der Kanten zurueck
*
* \return Anzahl der Kanten
*/
int EdgeWeightedDigraph::getE() const {
return this->E;
}
/**
* Liefert alle benachbarten Kanten zu v
*
* \param[in] v Knoten von dem aus gesucht wird
* \return Vektor mit allen benachbarten Kanten
*/
std::vector<std::vector<DirectedEdge> > EdgeWeightedDigraph::getAdj() const {
return this->adj;
}
/**
* Liefert alle benachbarten Kanten zu v
*
* \param[in] v Knoten von dem aus gesucht wird
* \return Vektor mit allen benachbarten Kanten
*/
std::vector<DirectedEdge> EdgeWeightedDigraph::getAdj(int v) const {
std::vector<DirectedEdge> neighbors;
for (auto const &n: adj[v]) {
neighbors.push_back(n);
}
return neighbors;
}
/**
* Gibt alle Kanten im Graph zurueck
*
* \return Vektor mit allen Kanten im Graph
*/
std::vector<DirectedEdge> EdgeWeightedDigraph::edges() const {
std::vector<DirectedEdge> list;
for (int v = 0; v < this->V; v++) {
for (DirectedEdge e: this->adj[v]) {
list.push_back(e);
}
}
return list;
}
bool EdgeWeightedDigraph::del_Edge(DirectedEdge e) {
int from = e.from();
int to = e.to();
// ?berpr?fen, ob die Knoten g?ltig sind
if (!validateVertex(from) || !validateVertex(to)) {
return false;
}
// Suchen und Entfernen der Kante aus der Adjazenzliste des Ausgangsknotens
std::vector<DirectedEdge> &adj_from = adj[from];
for (auto it = adj_from.begin(); it != adj_from.end(); ++it) {
if (*it == e) {
adj_from.erase(it);
E--; // Verringern der Gesamtzahl der Kanten
return true;
}
}
// Kante wurde nicht gefunden
return false;
}
/**
* Gibt die Kantenliste eines Knoten v zurueck
*
* \param[in] v Knoten
* \return Vektor mit den Kanten vom Knoten v
*/
const std::vector<DirectedEdge> EdgeWeightedDigraph::operator[](int from) const {
return this->adj[from];
}

56
P4/EdgeWeightedDigraph.h Executable file
View File

@@ -0,0 +1,56 @@
#pragma once
#include <vector>
#include <string>
class DirectedEdge {
private:
int _from; // Startknoten
int _to; // Endknoten
double _weight; // Gewicht der Kante
public:
DirectedEdge()
: _from{0}
, _to{0}
, _weight{0} {
}
DirectedEdge(int from, int to, double weight)
: _weight{weight}
, _from{from}
, _to{to} {
}
double weight() const { return _weight; }
int from() const { return _from; }
int to() const { return _to; }
};
inline bool operator==(const DirectedEdge &lhs, const DirectedEdge &rhs) { return lhs.weight() == rhs.weight(); }
inline bool operator!=(const DirectedEdge &lhs, const DirectedEdge &rhs) { return !operator==(lhs, rhs); }
inline bool operator<(const DirectedEdge &lhs, const DirectedEdge &rhs) { return lhs.weight() < rhs.weight(); }
inline bool operator>(const DirectedEdge &lhs, const DirectedEdge &rhs) { return operator<(rhs, lhs); }
inline bool operator<=(const DirectedEdge &lhs, const DirectedEdge &rhs) { return !operator>(lhs, rhs); }
inline bool operator>=(const DirectedEdge &lhs, const DirectedEdge &rhs) { return !operator<(lhs, rhs); }
class EdgeWeightedDigraph {
private:
int V; // Anzahl Knoten von G
int E; // Anzahl Kanten von G
std::vector<std::vector<DirectedEdge> > adj; // Adjazenzliste
bool validateVertex(int v) const;
void validateVertexWithError(int v) const;
public:
EdgeWeightedDigraph(int V); // Leeren Digraphen mit v Knoten erstellen
EdgeWeightedDigraph(std::string filename); // Graph einlesen aus Textdatei
void add(DirectedEdge e); // gerichtete Kante hinzuf<75>gen
int getV() const; // liefert Anzahl Knoten
int getE() const; // liefert Anzahl der Kanten
std::vector<std::vector<DirectedEdge> > getAdj() const; // liefert die gestamte Kantenliste
std::vector<DirectedEdge> getAdj(int v) const; // liefert Array der adjazenten Kanten zu v
std::vector<DirectedEdge> edges() const; // alle Kanten dieses Graphen
const std::vector<DirectedEdge> operator[](int v) const;
bool del_Edge(DirectedEdge e); // L<>scht eine Kante
};

197
P4/EdgeWeightedGraph.cpp Executable file
View File

@@ -0,0 +1,197 @@
#include "EdgeWeightedGraph.h"
#include <fstream>
#include <assert.h>
#include <iostream>
/**
* Erstellt einen Kantengewichteten-Gaph mit V Knoten
*
* \param[in] V Anzahl der Knoten
*/
EdgeWeightedGraph::EdgeWeightedGraph(int V)
: V{V}
, E{0} {
adj.resize(V);
}
/**
* Erstellt einen Kantengewichteten-Gaph anhand der Kantenliste in fname
*
* \param[in] fname Dateiname der Kantenliste
*/
EdgeWeightedGraph::EdgeWeightedGraph(std::string filename) {
std::ifstream infile(filename);
int tmp_e = 0;
infile >> this->V >> tmp_e;
this->E = 0;
this->adj.resize(this->V, std::vector<Edge>());
int v, w;
double weight;
while (infile >> v >> w >> weight) {
this->add(Edge(v, w, weight));
}
assert(("Missing edges!", tmp_e == this->E));
}
/**
* Erstellt einen Kantengewichteten-Gaph mit V Knoten und den Kanten in edges
*
* \param[in] V Anzahl der Knoten
* \param[in] E Kantenliste
*/
EdgeWeightedGraph::EdgeWeightedGraph(int V, std::vector<Edge> E) {
this->V = V;
this->adj.resize(V);
for (Edge e: E) {
this->add(e);
}
}
/**
* Gibt zurueck ob der Knoten v ein gueltiger Knoten im Graph ist
*
* \param[in] v Knoten
* \return Gueltigkeit des Knoten
*/
bool EdgeWeightedGraph::validateVertex(int v) const {
return v >= 0 && v < this->V;
}
/**
* Gibt eine Fehlermeldung aus, wenn der Knoten v im Graph nicht gueltig ist
*
* \param[in] v Knoten
*/
void EdgeWeightedGraph::validateVertexWithError(int v) const {
assert(("Vertex is out of bounds!", this->validateVertex(v)));
}
/**
* Gibt die Anzahl der Knoten zurueck
*
* \return Anzahl der Knoten
*/
int EdgeWeightedGraph::getV() const {
return this->V;
}
/**
* Gibt die Anzahl der Kanten zurueck
*
* \return Anzahl der Kanten
*/
int EdgeWeightedGraph::getE() const {
return this->E;
}
/**
* Fuegt die Kante e zum Graphen hinzu
*
* \param[in] e neue Kante
*/
void EdgeWeightedGraph::add(Edge e) {
this->validateVertexWithError(e.either());
this->validateVertexWithError(e.other(e.either()));
this->adj[e.either()].push_back(e);
this->adj[e.other(e.either())].push_back(e);
this->E++;
}
/**
* Liefert alle benachbarten Kanten zu v
*
* \param[in] v Knoten von dem aus gesucht wird
* \return Vektor mit allen benachbarten Kanten
*/
std::vector<Edge> EdgeWeightedGraph::getAdj(int v) const {
std::vector<Edge> neighbors;
for (auto const &n: adj[v]) {
neighbors.push_back(n);
}
return neighbors;
}
std::vector<std::vector<Edge> > EdgeWeightedGraph::getAdj() const {
return this->adj;
}
/**
* Gibt alle Kanten im Graph zurueck
*
* \return Vektor mit allen Kanten im Graph
*/
std::vector<Edge> EdgeWeightedGraph::edges() const {
std::vector<Edge> edgeList;
for (int v = 0; v < this->V; v++) {
int selfLoops = 0;
for (Edge e: this->adj[v]) {
if (e.other(v) > v) {
edgeList.push_back(e);
}
// add only one copy of each self loop (self loops will be consecutive)
else if (e.other(v) == v) {
if (selfLoops % 2 == 0) edgeList.push_back(e);
selfLoops++;
}
}
}
return edgeList;
}
bool EdgeWeightedGraph::del_Edge(Edge e) {
int v = e.either();
int w = e.other(v);
// Überprüfen, ob die Knoten gültig sind
if (!validateVertex(v) || !validateVertex(w)) {
return false;
}
bool removed = false;
// Entfernen der Kante von v zu w
std::vector<Edge> &adj_v = adj[v];
for (auto it = adj_v.begin(); it != adj_v.end(); ++it) {
if (*it == e) {
adj_v.erase(it);
removed = true;
break;
}
}
// Entfernen der Kante von w zu v (falls es sich nicht um eine Schlinge handelt)
if (v != w) {
std::vector<Edge> &adj_w = adj[w];
for (auto it = adj_w.begin(); it != adj_w.end(); ++it) {
if (*it == e) {
adj_w.erase(it);
break;
}
}
}
// Wenn die Kante entfernt wurde, verringern wir die Kantenanzahl
if (removed) {
E--;
}
return removed;
}
/**
* Gibt die verbunden Knoten eines Knoten v zurueck
*
* \param[in] v Knoten
* \return Verbundene Knoten des Knoten v
*/
const std::vector<Edge> EdgeWeightedGraph::operator[](int v) const {
this->validateVertexWithError(v);
return this->adj[v];
}

60
P4/EdgeWeightedGraph.h Executable file
View File

@@ -0,0 +1,60 @@
#pragma once
#include <string>
#include <vector>
#include <iomanip>
class Edge {
private:
int _either; // ein Knoten der Kante
int _other; // der andere Knoten der Kante
double _weight; // Kantengewicht
public:
Edge(int either, int other, double weight)
: _either{either}
, _other{other}
, _weight{weight} {
}
double weight() const { return _weight; } // Gewicht dieser Kante
int either() const { return _either; } // einer der beiden Knoten
int other(int vertex) const {
// der von "vertex" verschiedene Knoten
if (vertex == _either) return _other;
else if (vertex == _other) return _either;
else throw new std::invalid_argument("Illegal endpoint");
}
};
inline bool operator==(const Edge &lhs, const Edge &rhs) { return lhs.weight() == rhs.weight(); }
inline bool operator!=(const Edge &lhs, const Edge &rhs) { return !operator==(lhs, rhs); }
inline bool operator<(const Edge &lhs, const Edge &rhs) { return lhs.weight() < rhs.weight(); }
inline bool operator>(const Edge &lhs, const Edge &rhs) { return operator<(rhs, lhs); }
inline bool operator<=(const Edge &lhs, const Edge &rhs) { return !operator>(lhs, rhs); }
inline bool operator>=(const Edge &lhs, const Edge &rhs) { return !operator<(lhs, rhs); }
class EdgeWeightedGraph {
private:
int V; // Anzahl Knoten von G
int E; // Anzahl Kanten von G
std::vector<std::vector<Edge> > adj; // Adjazenzliste
bool validateVertex(int v) const;
void validateVertexWithError(int v) const;
public:
EdgeWeightedGraph(int V); // Leeren Graph mit v Knoten erstellen
EdgeWeightedGraph(std::string filename); // Graph einlesen aus Textdatei
EdgeWeightedGraph(int V, std::vector<Edge> E);
void add(Edge e); // f<>gt Kante e dem Graphen hinzu
int getV() const; // liefert Anzahl Knoten
int getE() const; // liefert Anzahl der Kanten
std::vector<Edge> getAdj(int v) const; // liefert Array der adjazenten Kanten zu v
std::vector<std::vector<Edge> > getAdj() const;
std::vector<Edge> edges() const; // alle Kanten dieses Graphen
bool del_Edge(Edge e);
const std::vector<Edge> operator[](int v) const;
};

417
P4/GraphTest.cpp Executable file
View File

@@ -0,0 +1,417 @@
/*************************************************
* ADS Praktikum 5
* Unit-Testdatei
* Stand: 01.06.2021
*
*************************************************
* Änderungen untersagt!
*************************************************/
#include "catch.hpp"
#include <string>
#include <iostream>
#include "EdgeWeightedGraph.h"
#include "EdgeWeightedDigraph.h"
#include "DijkstraSP.h"
#include "KruskalMST.h"
#include "PrimMST.h"
namespace Graphsearch {
bool DFS(const EdgeWeightedGraph& G, int v, std::vector<bool>& marked, std::vector<int>& edgeTo);
bool BFS(const EdgeWeightedGraph& G, int v, std::vector<bool>& marked, std::vector<int>& edgeTo);
}
/***********************************************
* Testroutine des Graphen:
- Adjazenzlisten
- Tiefensuche mit zusammenhängenden Graphen
- Tiefensuche mit nicht zusammenhängenden Graphen
- Breitensuche mit zusammenhängenden Graphen
- Breitensuche mit nicht zusammenhängenden Graphen
- Prim mit bestimmten Ergebnissen
- Kruskal mit bestimmten Ergebnissen
- Dijkstra
*/
TEST_CASE("Graph Test: Adjazenzliste") {
EdgeWeightedGraph G1("graph1.txt");
EdgeWeightedGraph G2("graph2.txt");
EdgeWeightedGraph G3("graph3.txt");
SECTION("Adjazenzliste des ersten Graphen (graph1.txt)") {
REQUIRE(G1.getV() == 7);
REQUIRE(G1.getE() == 11);
auto adj = G1.getAdj();
REQUIRE(adj[0][0].either() == 0);
REQUIRE(adj[0][0].other(0) == 1);
REQUIRE(adj[0][0].weight() == 7.0);
REQUIRE(adj[4][3].either() == 4);
REQUIRE(adj[4][3].other(4) == 5);
REQUIRE(adj[4][3].weight() == 8.0);
}
SECTION("Adjazenzliste des zweiten Graphen (graph2.txt)") {
REQUIRE(G2.getV() == 20);
REQUIRE(G2.getE() == 60);
auto adj = G2.getAdj();
REQUIRE(adj[0][0].either() == 0);
REQUIRE(adj[0][0].other(0) == 1);
REQUIRE(adj[0][0].weight() == 6.0);
REQUIRE(adj[13][5].either() == 13);
REQUIRE(adj[13][5].other(13) == 19);
REQUIRE(adj[13][5].weight() == 25.0);
}
SECTION("Adjazenzliste des dritten Graphen (graph3.txt)") {
REQUIRE(G2.getV() == 20);
REQUIRE(G2.getE() == 60);
auto adj = G2.getAdj();
REQUIRE(adj[0][0].either() == 0);
REQUIRE(adj[0][0].other(0) == 1);
REQUIRE(adj[0][0].weight() == 6.0);
REQUIRE(adj[13][5].either() == 13);
REQUIRE(adj[13][5].other(13) == 19);
REQUIRE(adj[13][5].weight() == 25.0);
}
}
TEST_CASE("Graph Test: Tiefensuche (DFS)") {
EdgeWeightedGraph G1("graph1.txt");
EdgeWeightedGraph G2("graph2.txt");
EdgeWeightedGraph G3("graph3.txt");
std::vector<bool> marked;
std::vector<int> edgeTo;
SECTION("Tiefensuche mit erstem Graphen (graph1.txt") {
marked.resize(42, false); // Dummy values, damit die unit-Tests mit
edgeTo.resize(42, -1); // der Vorlage durchlaufen ohne Programmabsturz
for (int i = 0; i < G1.getV(); i++) {
bool connected = Graphsearch::DFS(G1, i, marked, edgeTo);
REQUIRE(connected == true);
}
// edgeTo-Array der Tiefensuche mit Startknoten 0 testen
Graphsearch::DFS(G1, 0, marked, edgeTo);
REQUIRE(edgeTo.size() == G1.getV());
REQUIRE(marked.size() == G1.getV());
REQUIRE(edgeTo[0] == -1);
REQUIRE(edgeTo[1] == 0);
REQUIRE(edgeTo[2] == 1);
REQUIRE(edgeTo[3] == 4);
REQUIRE(edgeTo[4] == 2);
REQUIRE(edgeTo[5] == 3);
REQUIRE(edgeTo[6] == 5);
}
SECTION("Tiefensuche mit zweiten Graphen (graph2.txt)") {
marked.resize(42, false); // Dummy values, damit die unit-Tests mit
edgeTo.resize(42, -1); // der Vorlage durchlaufen ohne Programmabsturz
for (int i = 0; i < G2.getV(); i++) {
bool connected = Graphsearch::DFS(G2, i, marked, edgeTo);
REQUIRE(connected == true);
}
Graphsearch::DFS(G2, 0, marked, edgeTo);
REQUIRE(edgeTo.size() == G2.getV());
REQUIRE(marked.size() == G2.getV());
REQUIRE(edgeTo[0] == -1);
REQUIRE(edgeTo[1] == 0);
REQUIRE(edgeTo[7] == 4);
REQUIRE(edgeTo[8] == 9);
REQUIRE(edgeTo[19] == 13);
}
SECTION("Tiefensuche mit dritten Graphen (graph3.txt)") {
marked.resize(42, false); // Dummy values, damit die unit-Tests mit
edgeTo.resize(42, -1); // der Vorlage durchlaufen ohne Programmabsturz
for (int i = 0; i < G3.getV(); i++) {
bool connected = Graphsearch::DFS(G3, i, marked, edgeTo);
REQUIRE(connected == false);
}
Graphsearch::DFS(G3, 0, marked, edgeTo);
REQUIRE(edgeTo.size() == G3.getV());
REQUIRE(marked.size() == G3.getV());
REQUIRE(marked[0] == true);
REQUIRE(marked[4] == true);
REQUIRE(marked[18] == true);
Graphsearch::DFS(G3, 1, marked, edgeTo);
REQUIRE(edgeTo.size() == G3.getV());
REQUIRE(marked.size() == G3.getV());
REQUIRE(marked[0] == false);
REQUIRE(marked[4] == false);
REQUIRE(marked[18] == false);
}
}
TEST_CASE("Graph Test: Breitensuche (BFS)") {
EdgeWeightedGraph G1("graph1.txt");
EdgeWeightedGraph G2("graph2.txt");
EdgeWeightedGraph G3("graph3.txt");
std::vector<bool> marked;
std::vector<int> edgeTo;
SECTION("Breitensuche mit erstem Graphen (graph1.txt") {
marked.resize(42, false); // Dummy values, damit die unit-Tests mit
edgeTo.resize(42, -1); // der Vorlage durchlaufen ohne Programmabsturz
for (int i = 0; i < G1.getV(); i++) {
bool connected = Graphsearch::BFS(G1, i, marked, edgeTo);
REQUIRE(connected == true);
}
// edgeTo-Array der Breitensuche mit Startknoten 0 testen
Graphsearch::BFS(G1, 0, marked, edgeTo);
REQUIRE(edgeTo.size() == G1.getV());
REQUIRE(marked.size() == G1.getV());
REQUIRE(edgeTo[0] == -1);
REQUIRE(edgeTo[1] == 0);
REQUIRE(edgeTo[2] == 1);
REQUIRE(edgeTo[3] == 0);
REQUIRE(edgeTo[4] == 1);
REQUIRE(edgeTo[5] == 3);
REQUIRE(edgeTo[6] == 4);
}
SECTION("Breitensuche mit zweiten Graphen (graph2.txt)") {
marked.resize(42, false); // Dummy values, damit die unit-Tests mit
edgeTo.resize(42, -1); // der Vorlage durchlaufen ohne Programmabsturz
for (int i = 0; i < G2.getV(); i++) {
bool connected = Graphsearch::BFS(G2, i, marked, edgeTo);
REQUIRE(connected == true);
}
// edgeTo-Array der Breitensuche mit Startknoten 0 testen
Graphsearch::BFS(G2, 0, marked, edgeTo);
REQUIRE(edgeTo.size() == G2.getV());
REQUIRE(marked.size() == G2.getV());
REQUIRE(edgeTo[0] == -1);
REQUIRE(edgeTo[1] == 0);
REQUIRE(edgeTo[2] == 3);
REQUIRE(edgeTo[6] == 16);
REQUIRE(edgeTo[11] == 4);
REQUIRE(edgeTo[15] == 4);
REQUIRE(edgeTo[19] == 0);
}
SECTION("Breitensuche mit dritten Graphen (graph3.txt)") {
marked.resize(42, false); // Dummy values, damit die unit-Tests mit
edgeTo.resize(42, -1); // der Vorlage durchlaufen ohne Programmabsturz
for (int i = 0; i < G3.getV(); i++) {
bool connected = Graphsearch::BFS(G3, i, marked, edgeTo);
REQUIRE(edgeTo.size() == G3.getV());
REQUIRE(marked.size() == G3.getV());
REQUIRE(connected == false);
// Hinweis: Die Knoten {0,4,18} bilden einen Teilgraphen
if (i == 0 || i == 4 || i == 18) {
REQUIRE(marked[0] == true);
REQUIRE(marked[4] == true);
REQUIRE(marked[18] == true);
}
else {
REQUIRE(marked[0] == false);
REQUIRE(marked[4] == false);
REQUIRE(marked[18] == false);
}
}
}
}
TEST_CASE("Graph Test: Prim") {
EdgeWeightedGraph G1("graph1.txt");
EdgeWeightedGraph G2("graph2.txt");
EdgeWeightedGraph G3("graph3.txt");
SECTION("Prim mit erstem Graph (graph1.txt)") {
for (int i = 0; i < G1.getV(); i++) {
PrimMST prim(G1, i);
REQUIRE(prim.weight() == 39.0);
auto edges = prim.edges();
REQUIRE(edges.size() == 6);
std::vector<Edge> mst;
mst.push_back(Edge(0, 3, 5.0));
mst.push_back(Edge(2, 4, 5.0));
mst.push_back(Edge(3, 5, 6.0));
mst.push_back(Edge(1, 4, 7.0));
mst.push_back(Edge(0, 1, 7.0));
mst.push_back(Edge(4, 6, 9.0));
// Testen ob alle Edes des MST exitieren
for (auto const& e : edges) {
REQUIRE(std::find(mst.begin(), mst.end(), e) != mst.end());
}
}
}
SECTION("Prim mit zweitem Graph (graph2.txt)") {
for (int i = 0; i < G2.getV(); i++) {
PrimMST prim(G2, i);
REQUIRE(prim.weight() == 150.0);
auto edges = prim.edges();
REQUIRE(edges.size() == 19);
}
}
SECTION("Prim mit drittem Graphen (graph3.txt)") {
// Graph 3 mit Strartknoten 0
PrimMST prim_0(G3, 0);
REQUIRE(prim_0.weight() == 16.0);
// Graph 3 mit Strartknoten 16
PrimMST prim_16(G3, 16);
REQUIRE(prim_16.weight() == 168.0);
}
}
TEST_CASE("Graph Test: Kruskal") {
EdgeWeightedGraph G1("graph1.txt");
EdgeWeightedGraph G2("graph2.txt");
EdgeWeightedGraph G3("graph3.txt");
SECTION("Kruskal mit erstem Graph (graph1.txt)") {
KruskalMST kruskal(G1);
REQUIRE(kruskal.weight() == 39.0);
auto edges = kruskal.edges();
REQUIRE(edges.size() == 6);
std::vector<Edge> mst;
mst.push_back(Edge(0, 3, 5.0));
mst.push_back(Edge(2, 4, 5.0));
mst.push_back(Edge(3, 5, 6.0));
mst.push_back(Edge(1, 4, 7.0));
mst.push_back(Edge(0, 1, 7.0));
mst.push_back(Edge(4, 6, 9.0));
// Testen ob alle Edes des MST exitieren
for (auto const& e : edges) {
REQUIRE(std::find(mst.begin(), mst.end(), e) != mst.end());
}
}
SECTION("Kruskal mit zweitem Graph (graph2.txt)") {
KruskalMST kruskal(G2);
REQUIRE(kruskal.weight() == 150.0);
REQUIRE(kruskal.edges().size() == 19);
}
SECTION("Kruskal mit drittem Graph (graph3.txt)") {
KruskalMST kruskal(G3);
REQUIRE(kruskal.weight() == 184.0);
REQUIRE(kruskal.edges().size() == 18);
}
}
TEST_CASE("Graph Test: Dijkstra") {
EdgeWeightedDigraph G1_directed("graph1.txt");
EdgeWeightedDigraph G2_directed("graph2.txt");
EdgeWeightedDigraph G3_directed("graph3.txt");
int start, target;
SECTION("Dijkstra beim ersten Graph - 0 nach 6 (graph1.txt)") {
start = 0;
target = 6;
DijkstraSP dsp(G1_directed, start);
auto path = dsp.pathTo(target);
REQUIRE(dsp.distTo(target) == 22.0);
REQUIRE(path.size() == 3);
REQUIRE(path[0] == DirectedEdge(0, 3, 5.0));
REQUIRE(path[1] == DirectedEdge(3, 5, 6.0));
REQUIRE(path[2] == DirectedEdge(5, 6, 11.0));
}
SECTION("Dijkstra beim ersten Graph - 2 nach 6 (graph1.txt)") {
start = 2;
target = 6;
DijkstraSP dsp(G1_directed, start);
auto path = dsp.pathTo(target);
REQUIRE(dsp.distTo(target) == 14.0);
REQUIRE(path.size() == 2);
REQUIRE(path[0] == DirectedEdge(2, 4, 5.0));
REQUIRE(path[1] == DirectedEdge(4, 6, 9.0));
}
SECTION("Dijkstra beim zweiten Graph - 0 nach 6 (graph2.txt)") {
start = 0;
target = 6;
DijkstraSP dsp(G2_directed, start);
auto path = dsp.pathTo(target);
REQUIRE(dsp.distTo(target) == 91.0);
REQUIRE(path.size() == 3);
REQUIRE(path[0] == DirectedEdge(0, 4, 47.0));
REQUIRE(path[1] == DirectedEdge(4, 5, 36.0));
REQUIRE(path[2] == DirectedEdge(5, 6, 8.0));
}
SECTION("Dijkstra beim zweiten Graph - 3 nach 9 (graph2.txt)") {
start = 3;
target = 9;
DijkstraSP dsp(G2_directed, start);
auto path = dsp.pathTo(target);
REQUIRE(dsp.distTo(target) == 122.0);
REQUIRE(path.size() == 4);
REQUIRE(path[0] == DirectedEdge(3, 4, 46.0));
REQUIRE(path[1] == DirectedEdge(4, 5, 36.0));
REQUIRE(path[2] == DirectedEdge(5, 6, 8.0));
REQUIRE(path[3] == DirectedEdge(6, 9, 32.0));
}
SECTION("Dijkstra beim dritten Graph - 0 nach 4 (graph3.txt)") {
start = 0;
target = 4;
DijkstraSP dsp(G3_directed, start);
auto path = dsp.pathTo(target);
REQUIRE(dsp.distTo(target) == 47.0);
REQUIRE(path.size() == 1);
REQUIRE(path[0] == DirectedEdge(0, 4, 47.0));
}
SECTION("Dijkstra beim dritten Graph - 1 nach 16 (graph3.txt)") {
start = 1;
target = 16;
DijkstraSP dsp(G3_directed, start);
auto path = dsp.pathTo(target);
REQUIRE(dsp.distTo(target) == 35.0);
REQUIRE(path.size() == 2);
REQUIRE(path[0] == DirectedEdge(1, 7, 9.0));
REQUIRE(path[1] == DirectedEdge(7, 16, 26.0));
}
SECTION("Dijkstra beim dritten Graph - 3 nach 7 (graph3.txt)") {
start = 3;
target = 7;
DijkstraSP dsp(G3_directed, start);
auto path = dsp.pathTo(target);
REQUIRE(dsp.distTo(target) == 42.0);
REQUIRE(path.size() == 3);
REQUIRE(path[0] == DirectedEdge(3, 5, 27.0));
REQUIRE(path[1] == DirectedEdge(5, 6, 8.0));
REQUIRE(path[2] == DirectedEdge(6, 7, 7.0));
}
}
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// http://www.hashemall.com/
// Zeile 1 - 413 hat den SHA 256 Hashwert: C812B068B2223D95AC8750EBBEB14261A7DFA84DF2DC4BC8F0026E7223C35A37

101
P4/Graphsearch.h Executable file
View File

@@ -0,0 +1,101 @@
#pragma once
#include "EdgeWeightedDigraph.h"
#include "EdgeWeightedGraph.h"
#include <iostream>
namespace Graphsearch {
/**
* Fuehrt eine rekursive Tiefensuche im Graphen G,
* ab dem Knoten v aus und markiert alle besuchten
* Knoten in marked.
* Alle besuchten Knoten werden ausgegeben.
*
* \param[in] G Graph
* \param[in] v Startknoten
* \param[in/out] marked Bereits besuchte Knoten
* \param[in/out] edgeTo Vektor mit dem Nachfolgeknoten zu jedem Knoten
*/
void DFS_recursive(const EdgeWeightedGraph &G, int v, std::vector<bool> &marked, std::vector<int> &edgeTo) {
std::cout << v;
marked[v] = true;
for (int j = 0; j < G.getAdj(v).size(); j++) {
int w = G.getAdj(v)[j].other(v);
if (marked[w] == false) {
edgeTo[w] = v;
std::cout << " -> ";
DFS_recursive(G, w, marked, edgeTo);
}
}
}
/**
* Fuehrt eine rekursive Tiefensuche im Graphen g, ab dem Knoten v aus.
* Alle besuchten Knoten werden ausgegeben.
* Starterfunktion zu DFS_recursive(EdgeWeigtedGraph, int, std::vector<bool>, std::vector<int>)
*
* \param[in] G Graph
* \param[out] marked Bereits besuchte Knoten
* \param[out] edgeTo Vektor mit dem Nachfolgeknoten zu jedem Knoten
* \param[in] v Startknoten
* \return true Graph ist zusammenhaengend
* false Graph ist nicht zusammenhaengend
*/
bool DFS(const EdgeWeightedGraph &G, int v, std::vector<bool> &marked, std::vector<int> &edgeTo) {
bool ret = true;
marked.clear();
marked.resize(G.getV(), false);
edgeTo.clear();
edgeTo.resize(G.getV(), -1);
DFS_recursive(G, v, marked, edgeTo);
std::cout << std::endl;
for (bool value: marked)
ret = ret && value;
return ret;
}
/**
* Fuehrt eine iterative Breitensuche im Graphen g, ab dem Knoten v aus.
* Alle besuchten Knoten werden ausgegeben.
*
* \param[in] G Graph
* \param[in] v Startknoten
* \param[out] marked Gibt an welche Knoten besucht wurden bei der Suche
* \param[out] edgeTo Gibt den Nachfolgerknoten eines Knoten an
* \return true Graph ist zusammenhaengend
* false Graph ist nicht zusammenhaengend
*/
bool BFS(const EdgeWeightedGraph &G, int v, std::vector<bool> &marked, std::vector<int> &edgeTo) {
marked.clear();
marked.resize(G.getV(), false);
edgeTo.clear();
edgeTo.resize(G.getV(), -1);
std::queue<int> q;
marked[v] = true;
q.push(v);
while (!q.empty()) {
int currentV = q.front();
q.pop();
std::cout << currentV << " "; // Knoten besuchen (hier: ausgeben)
for (const Edge &edge: G.getAdj(currentV)) {
int w = edge.other(currentV);
if (!marked[w]) {
edgeTo[w] = currentV;
marked[w] = true;
q.push(w);
}
}
}
// <20>berpr<70>fen, ob alle Knoten besucht wurden
for (bool m: marked) {
if (!m) return false;
}
return true;
}
}

59
P4/KruskalMST.cpp Executable file
View File

@@ -0,0 +1,59 @@
#include "KruskalMST.h"
/**
* Erstellt einen MST zum Graph G mit dem Kruskal Algorithmus
*
* \param[in] G Kantengewichteter-Graph
*/
KruskalMST::KruskalMST(EdgeWeightedGraph G) {
treeID.resize(G.getV());
std::priority_queue<Edge, std::vector<Edge>, std::greater<Edge> > pq;
std::vector<Edge> e = G.edges(); // liefert alle Kanten von G
for (int i = 0; i < e.size(); i++)
pq.push(e[i]);
// zu Beginn ist jeder Knoten ein eigener Baum
for (int i = 0; i < G.getV(); i++)
treeID[i] = i;
while (!pq.empty()) {
Edge e = pq.top();
pq.pop();
int v = e.either();
int w = e.other(v);
// Wenn Knoten v und w zu unterschiedlichen B?umen geh?rt,
// k<>nnen diese mit der Kante e ohne Zykel verbunden werden
if (treeID[v] != treeID[w]) {
mst.push_back(e);
int treeID_w = treeID[w];
for (int i = 0; i < G.getV(); i++) {
// BaumID von v und w
if (treeID[i] == treeID_w) // angleichen
treeID[i] = treeID[v];
}
}
}
}
/**
* Gibt alle Kanten vom MST zurueck
*
* \return Vektor mit Kanten des MST
*/
std::vector<Edge> KruskalMST::edges() const {
return mst;
}
/**
* Gibt die Summe aller Gewichte im MST zurueck
*
* \return Summe der Gewichte im MST
*/
double KruskalMST::weight() const {
double gew = 0.0;
for (Edge e: this->mst)
gew += e.weight();
return gew;
}

18
P4/KruskalMST.h Executable file
View File

@@ -0,0 +1,18 @@
#pragma once
#include <vector>
#include <queue>
#include "EdgeWeightedGraph.h"
class KruskalMST {
private:
std::vector<Edge> mst; // MST-Kanten
std::vector<int> treeID; // BaumId zu jedem Knoten
public:
KruskalMST() {
};
KruskalMST(EdgeWeightedGraph G);
std::vector<Edge> edges() const; // liefert MST
double weight() const; // berechnet Gesamtkosten des MST
};

70
P4/PrimMST.cpp Executable file
View File

@@ -0,0 +1,70 @@
#include "PrimMST.h"
/**
* Erstellt einen MST zum Graph G mit dem Prim Algorithmus
*
* \param[in] G Kantengewichteter-Graph
* \param[in] s Startknoten
*/
PrimMST::PrimMST(EdgeWeightedGraph G, int s) {
marked.resize(G.getV(), false);
// lege alle Kanten vom Startknoten 0 ausgehend in die Priority Queue (PQ)
// setzt voraus, dass G zusammenhaengend ist
visit(G, s);
while (!pq.empty()) {
Edge e = pq.top(); // Hole Kante mit geringstem Gewicht aus PQ
pq.pop(); // entferne diese Kante aus PQ
int v = e.either(); // Knoten 1 der Kante
int w = e.other(v); // Knoten 2 der Kante
// <20>berspringen, falls beide Knoten im Baum markiert sind
if (marked[v] && marked[w])
continue; // Zykel-Detektion
mst.push_back(e); // F<>ge Kante e zum MST hinzu
if (!marked[v])
visit(G, v); // Knoten v oder w zum MSP
if (!marked[w])
visit(G, w); // hinzuf?gen
}
}
/**
* Markiert Knoten v im Graph G als markiert und fuegt alle Nachbarn zur pq hinzu
*
* \param[in] G Kantengewichteter-Graph
* \param[in] v Knoten im Graph G
*/
void PrimMST::visit(EdgeWeightedGraph G, int v) {
marked[v] = true;
std::vector<Edge> Tedges = G[v]; // liefert alle Kanten ausgehend vom Knoten v
// Lege alle Kanten von v zu unmarkierten
// (noch nicht besuchten) Knoten in die PQ ab
for (int i = 0; i < Tedges.size(); i++) {
if (!marked[Tedges[i].other(v)])
pq.push(Tedges[i]);
}
}
/**
* Gibt alle Kanten vom MST zurueck
*
* \return Vektor mit Kanten des MST
*/
std::vector<Edge> PrimMST::edges() const {
return mst;
}
/**
* Gibt die Summe aller Gewichte im MST zurueck
*
* \return Summe der Gewichte im MST
*/
double PrimMST::weight() const {
double gew = 0.0;
for (Edge e: this->mst) {
gew += e.weight();
}
return gew;
}

28
P4/PrimMST.h Executable file
View File

@@ -0,0 +1,28 @@
#pragma once
#include <vector>
#include <queue>
#include "EdgeWeightedGraph.h"
class PrimMST {
private:
std::vector<bool> marked; // MST-Knoten
std::vector<Edge> mst; // MST-Kanten
/*
* PriorityQueue die alle Kanten speichert und mit pq.top()
* die Kante mit dem kleinsten Gewicht zurueck gibt.
*/
std::priority_queue<Edge, std::vector<Edge>, std::greater<Edge> > pq;
public:
PrimMST() {
}
PrimMST(EdgeWeightedGraph G, int s);
void visit(EdgeWeightedGraph G, int v);
std::vector<Edge> edges() const;
double weight() const;
};

152
P4/PriorityQueue.h Executable file
View File

@@ -0,0 +1,152 @@
#pragma once
#include <queue>
#include <vector>
#include <map>
#include <ostream>
namespace Utils {
/**
* Wrapper-Klasse um Vergleiche unabhaengig von value zu ermoeglichen
*
* \tparam[in] _CompareValueTyupe Typ der compareValue
* \tparam[in] _ValueType Typ der value
*/
template<class _CompareValueTyupe, class _ValueType>
class CompareContainer {
public:
_CompareValueTyupe compareValue;
_ValueType value;
/**
* Konstruktor
*
* \param[in] compareValue Anhand dieser Variable wird verglichen
* \param[in] value Variable fuer die ein Vergleich benoetigt wird
*/
CompareContainer(_CompareValueTyupe compareValue, _ValueType value) : compareValue{compareValue}, value{value} {
}
/**
* Vergleicht zwei CompareContainer
*
* \param[in] other Container 2
* \return true, wenn die compareValue von this und other gleich ist. Ansonsten false
*/
bool operator==(const CompareContainer &other) const { return compareValue == other.compareValue; }
/**
* Vergleicht zwei CompareContainer
*
* \param[in] other Container 2
* \return true, wenn die compareValue von this und other ungleich ist. Ansonsten false
*/
bool operator!=(const CompareContainer &other) const { return !this->operator==(other); }
/**
* Vergleicht zwei CompareContainer
*
* \param[in] other Container 2
* \return true, wenn die compareValue von this kleiner als die von other ist. Ansonsten false
*/
bool operator<(const CompareContainer &other) const { return compareValue < other.compareValue; }
/**
* Vergleicht zwei CompareContainer
*
* \param[in] other Container 2
* \return true, wenn die compareValue von this groesser als die von other ist. Ansonsten false
*/
bool operator>(const CompareContainer &other) const {
return !this->operator<(other) && !this->operator==(other);
}
/**
* Vergleicht zwei CompareContainer
*
* \param[in] other Container 2
* \return true, wenn die compareValue von this kleiner oder gleich, wie die von other ist. Ansonsten false
*/
bool operator<=(const CompareContainer &other) const { return !this->operator>(other); }
/**
* Vergleicht zwei CompareContainer
*
* \param[in] other Container 2
* \return true, wenn die compareValue von this groesser oder gleich, wie die von other ist. Ansonsten false
*/
bool operator>=(const CompareContainer &other) const { return !this->operator<(other); }
};
/**
* Wrapper-Klasse um die Funktionsweise der std::priority_queue zu erweitern. Ermoeglicht es Objekte mit einem unabhaengigen Gewicht in die pq zu laden und erweitert die pq mit weiteren Methoden.
* Das kleinste Gewicht ist immer an Position top()
*
* \tparam[in] _Tr Datentyp der PriorityQueue
*/
template<typename _Tr>
class PriorityQueue : public std::priority_queue<CompareContainer<double, _Tr>, std::vector<CompareContainer<double,
_Tr> >, std::greater<CompareContainer<double, _Tr> > > {
public:
/**
* Fuegt ein item mit dem Gewicht weight zur pq hinzu.
*
* \param[in] item Objekt was zur pq hinzugefuegt werden soll
* \param[in] weight Das Gewicht mit dem item priorisiert werden soll
*/
void push(_Tr item, double weight) {
std::priority_queue<CompareContainer<double, _Tr>, std::vector<CompareContainer<double, _Tr> >, std::greater
<CompareContainer<double, _Tr> > >::push(CompareContainer<double, _Tr>(weight, item));
}
/**
* Gibt das Item an Position top() zurueck und entfernt dieses aus der pq.
*
* \return Item an Position top()
*/
_Tr pop_top() {
_Tr item = this->top().value;
this->pop();
return item;
}
/**
* Entfernt element aus der pq und gibt zurueck, ob es gefunden und entfernt wurde.
*
* \return true, wenn element aus der pq entfernt wurde, sonst false
*/
bool remove(const _Tr &element) {
for (auto it = this->c.begin(); it != this->c.end(); it++) {
if ((*it).value == element) {
this->c.erase(it);
return true;
}
}
return false;
}
/**
* Sucht nach element in der pq und gibt zurueck ob es gefunden wurde
*
* \return true, wenn element in der pq gefunden wurde, sonst false
*/
bool contains(const _Tr &element) {
for (auto it = this->c.begin(); it != this->c.end(); it++) {
if ((*it).value == element) {
return true;
}
}
return false;
}
/**
* Tauscht das Gewicht von element aus und gibt zurueck ob es gefunden wurde.
*
* \return true, wenn element in der pq gefunden wurde, sonst false
*/
bool change(const _Tr &element, double weight) {
if (!remove(element)) return false;
this->push(element, weight);
return true;
}
};
}

18182
P4/catch.h Executable file

File diff suppressed because it is too large Load Diff

18182
P4/catch.hpp Executable file

File diff suppressed because it is too large Load Diff

13
P4/graph1.txt Executable file
View File

@@ -0,0 +1,13 @@
7
11
0 1 7
0 3 5
1 2 8
1 3 9
1 4 7
2 4 5
3 4 15
3 5 6
4 5 8
4 6 9
5 6 11

62
P4/graph2.txt Executable file
View File

@@ -0,0 +1,62 @@
20
60
0 1 6
0 4 47
0 8 11
0 16 19
0 19 1
1 3 4
1 7 9
1 10 21
1 13 33
1 16 42
2 3 5
2 5 15
2 12 24
2 13 37
2 17 39
3 4 46
3 11 16
3 18 32
4 5 36
4 7 39
4 11 40
4 15 49
4 18 4
5 6 8
5 11 16
5 12 19
5 16 21
5 18 30
6 7 7
6 9 32
6 13 33
6 16 36
6 17 42
7 8 49
7 11 6
7 15 11
7 16 26
7 17 32
8 9 38
8 12 47
8 14 3
8 18 6
9 10 21
9 14 27
9 19 38
10 13 40
10 15 3
10 19 15
11 14 17
11 17 30
11 19 38
12 15 39
12 17 6
13 18 9
14 15 17
13 19 25
15 16 31
15 19 42
16 18 11
17 19 24

45
P4/graph3.txt Executable file
View File

@@ -0,0 +1,45 @@
20
43
0 4 47
0 18 12
1 3 4
1 7 9
1 10 21
1 13 33
1 16 42
2 3 5
2 12 24
2 13 37
2 17 39
3 5 27
3 8 17
3 11 16
3 12 5
4 18 4
5 6 8
5 11 16
5 12 19
5 16 21
6 7 7
6 13 33
6 16 36
6 17 42
7 8 49
7 11 6
7 16 26
7 17 32
8 12 47
8 14 3
8 16 46
9 10 21
9 19 38
10 15 3
10 19 15
11 14 17
11 13 32
11 17 30
12 14 26
12 17 6
13 16 35
14 17 2
15 19 42

296
P4/main.cpp Executable file
View File

@@ -0,0 +1,296 @@
#define CATCH_CONFIG_RUNNER
#include "catch.h"
#include <iostream>
#include "EdgeWeightedGraph.h"
#include "PrimMST.h"
#include "Graphsearch.h"
#include "KruskalMST.h"
#include "DijkstraSP.h"
using namespace std;
bool isInGrapf(EdgeWeightedGraph gr, int v) {
if (v > gr.getV())
return false;
return true;
}
void PrintGrapf(EdgeWeightedGraph g) {
vector<vector<Edge> > adj = g.getAdj();
cout << endl;
for (int i = 0; i < g.getV(); i++) {
cout << i << " -> ";
for (int j = 0; j < adj[i].size(); j++) {
cout << adj[i][j].other(i) << "[" << adj[i][j].weight() << "]";
if (j < adj[i].size() - 1) {
cout << " -> ";
}
}
cout << endl;
}
}
void print_digraph(EdgeWeightedDigraph graph) {
int prev = -1;
for (DirectedEdge e: graph.edges()) {
if (e.from() != prev)
cout << endl << e.from();
cout << " -> " << e.to() << " [" << e.weight() << "] ";
prev = e.from();
}
cout << endl << endl;
}
void print_mst(vector<Edge> mst) {
vector<int> v;
cout << endl;
for (Edge e: mst) {
int vorhanden = 0;
for (int i: v) {
if (e.either() == i)
vorhanden++;
}
if (vorhanden == 0) {
cout << e.either();
for (Edge z: mst) {
if (z.either() == e.either()) {
cout << " -> " << z.other(z.either()) << " [" << z.weight() << "] ";
}
}
cout << endl;
}
v.push_back(e.either());
}
}
void search(EdgeWeightedGraph gra, int type) {
int search;
cout << endl << "Suche nach ?> ";
cin >> search;
vector<bool> marked;
vector<int> edgeTo;
bool zsm;
if (!isInGrapf(gra, search))
cout << search << " ist nicht im Graphen" << endl;
if (type == 2) {
cout << "Tiefensuche(Depth - First - Search(DFS)) - Startknoten: " << search << endl << "Besuchsreihenfolge :"
<< endl;
zsm = Graphsearch::DFS(gra, search, marked, edgeTo);
} else {
cout << "Breitensuche(Breadth - First - Search(BFS)) - Startknoten: " << search << endl <<
"Besuchsreihenfolge :"
<< endl;
zsm = Graphsearch::BFS(gra, search, marked, edgeTo);
}
cout << endl << "Marked Array:";
for (int i = 0; i < marked.size(); i++)
cout << endl << i << " -> " << marked[i];
cout << endl << "Edge To Array:";
for (int i = 0; i < edgeTo.size(); i++)
cout << endl << i << " -> " << edgeTo[i];
if (zsm)
cout << endl << "Graph ist zusammenhaengend" << endl;
else
cout << endl << "Graph ist nicht zusammenhaengend" << endl;
}
bool get_edge_values(EdgeWeightedGraph &gra, int &from, int &to) {
cout << endl << "Start Knoten ?>";
cin >> from;
if (!isInGrapf(gra, from)) {
cout << from << " ist nicht im Graphen" << endl;
return false;
}
cout << endl << "Ziel Knoten ?>";
cin >> to;
if (!isInGrapf(gra, to)) {
cout << to << " ist nicht im Graphen" << endl;
return false;
}
return true;
}
int main() {
// Starte Unit-Tests
Catch::Session().run();
int selection;
string graph;
EdgeWeightedGraph gra(graph);
EdgeWeightedDigraph wgra(graph);
while (true) {
if (graph == "")
cout << endl << "Graph nicht gefunden" << endl;
cout << endl
<< "Praktikum 4: Graphenalgorithem:" << endl
<< "1) Graph einlesen" << endl
<< "2) Tiefensuche" << endl
<< "3) Breitensuche" << endl
<< "4) MST nach Prim" << endl
<< "5) MST nach Kruskal" << endl
<< "6) Kuerzeste Wege nach Dijkstra" << endl
<< "7) Ausgabe der Adjazenzliste" << endl
<< "8) Kante löschen" << endl
<< "9) Kante hinzufügen" << endl
<< "10) Programm beenden" << endl
<< "? > ";
cin >> selection;
switch (selection) {
case 1: {
int auswahl;
cout << endl << "Graph einlesen" << endl
<< "1) Graph1" << endl
<< "2) Graph2" << endl
<< "3) Graph3" << endl
<< "?> ";
cin >> auswahl;
switch (auswahl) {
case 1:
graph = "graph1.txt";
break;
case 2:
graph = "graph2.txt";
break;
case 3:
graph = "graph3.txt";
break;
}
if (graph != "") {
gra = EdgeWeightedGraph(graph);
wgra = EdgeWeightedDigraph(graph);
cout << endl << "Graph " << auswahl << " wurde eingelesen" << endl;
} else
cout << endl << "Graph nicht gefunden" << endl;
break;
}
case 2: {
search(gra, selection);
break;
}
case 3: {
search(gra, selection);
break;
}
case 4: {
int start = 0;
cout << endl << "Start Knoten ?> ";
cin >> start;
if (!isInGrapf(gra, start)) {
cout << start << " ist nicht im Graphen" << endl;
break;
}
PrimMST test(gra, start);
cout << "Minimaler Spannbaum(MST) nach Prim :" << endl;
cout << "Gewicht: " << test.weight();
vector<Edge> mst = test.edges();
print_mst(mst);
break;
}
case 5: {
KruskalMST test(gra);
cout << "Minimaler Spannbaum(MST) nach Kruskal :" << endl;
cout << "Gewicht: " << test.weight();
vector<Edge> mst = test.edges();
print_mst(mst);
break;
}
case 6: {
int start, ziel = 0;
cout << endl << "Start Knoten ?> ";
cin >> start;
if (!isInGrapf(gra, start)) {
cout << start << " ist nicht im Graphen" << endl;
continue;
}
cout << endl << "Ziel Knoten ?>";
cin >> ziel;
if (!isInGrapf(gra, ziel)) {
cout << ziel << " ist nicht im Graphen" << endl;
continue;
}
DijkstraSP dijkstra(wgra, start);
vector<DirectedEdge> path = dijkstra.pathTo(ziel);
print_digraph(wgra);
double kosten = 0.0;
string out = "";
cout << "Pfad: ";
for (DirectedEdge de: path) {
kosten += de.weight();
out += to_string(de.from()) + " [" + to_string(de.weight()) + "] " + " -> ";
}
if (kosten == 0.0) {
cout << "Kein Weg gefunden" << endl;
continue;
}
cout << out;
cout << path[path.size() - 1].to() << endl;
cout << "Kosten: " << kosten << endl;
break;
}
case 7: {
PrintGrapf(gra);
break;
}
case 8: {
int from, to;
if (get_edge_values(gra, from, to)) {
Edge n(from, to, 0);
DirectedEdge m(from, to, 0);
gra.del_Edge(n);
wgra.del_Edge(m);
cout << "Die Kante (" << from << " ; " << to << ") wurde gelöscht." << endl;
break;
}
break;
}
case 9: {
int from, to, weight;
bool a = get_edge_values(gra, from, to);
cout << endl << "Gewicht ?>";
cin >> weight;
if (a) {
Edge n(from, to, weight);
DirectedEdge m(from, to, weight);
gra.add(n);
wgra.add(m);
cout << "Die Kante (" << from << " ; " << to << " ; " << weight << ") wurde hinzugefügt." << endl;
}
break;
}
case 10: {
}
}
}
return 0;
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,832 @@
{
"inputs" :
[
{
"path" : "CMakeLists.txt"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/CMakeDetermineSystem.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/CMakeSystem.cmake.in"
},
{
"isGenerated" : true,
"path" : "cmake-build-debug/CMakeFiles/3.28.1/CMakeSystem.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/CMakeSystemSpecificInitialize.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/Platform/Darwin-Initialize.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/CMakeDetermineCCompiler.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/CMakeDetermineCompiler.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/CMakeDetermineCompilerId.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/CMakeCompilerIdDetection.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/Compiler/ADSP-DetermineCompiler.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/Compiler/ARMCC-DetermineCompiler.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/Compiler/ARMClang-DetermineCompiler.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/Compiler/AppleClang-DetermineCompiler.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/Compiler/Clang-DetermineCompilerInternal.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/Compiler/Borland-DetermineCompiler.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/Compiler/Bruce-C-DetermineCompiler.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/Compiler/Clang-DetermineCompiler.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/Compiler/Clang-DetermineCompilerInternal.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/Compiler/Compaq-C-DetermineCompiler.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/Compiler/Cray-DetermineCompiler.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/Compiler/CrayClang-DetermineCompiler.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/Compiler/Embarcadero-DetermineCompiler.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/Compiler/Fujitsu-DetermineCompiler.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/Compiler/FujitsuClang-DetermineCompiler.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/Compiler/GHS-DetermineCompiler.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/Compiler/GNU-C-DetermineCompiler.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/Compiler/HP-C-DetermineCompiler.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/Compiler/IAR-DetermineCompiler.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/Compiler/IBMClang-C-DetermineCompiler.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/Compiler/Intel-DetermineCompiler.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/Compiler/IntelLLVM-DetermineCompiler.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/Compiler/LCC-C-DetermineCompiler.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/Compiler/MSVC-DetermineCompiler.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/Compiler/NVHPC-DetermineCompiler.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/Compiler/NVIDIA-DetermineCompiler.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/Compiler/OpenWatcom-DetermineCompiler.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/Compiler/OrangeC-DetermineCompiler.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/Compiler/PGI-DetermineCompiler.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/Compiler/PathScale-DetermineCompiler.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/Compiler/SCO-DetermineCompiler.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/Compiler/SDCC-C-DetermineCompiler.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/Compiler/SunPro-C-DetermineCompiler.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/Compiler/TI-DetermineCompiler.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/Compiler/Tasking-DetermineCompiler.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/Compiler/TinyCC-C-DetermineCompiler.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/Compiler/VisualAge-C-DetermineCompiler.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/Compiler/IBMCPP-C-DetermineVersionInternal.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/Compiler/Watcom-DetermineCompiler.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/Compiler/XL-C-DetermineCompiler.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/Compiler/IBMCPP-C-DetermineVersionInternal.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/Compiler/XLClang-C-DetermineCompiler.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/Compiler/zOS-C-DetermineCompiler.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/Compiler/IBMCPP-C-DetermineVersionInternal.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/CMakeFindBinUtils.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/Compiler/GNU-FindBinUtils.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/CMakeCCompiler.cmake.in"
},
{
"isGenerated" : true,
"path" : "cmake-build-debug/CMakeFiles/3.28.1/CMakeCCompiler.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/CMakeDetermineCXXCompiler.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/CMakeDetermineCompiler.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/Platform/Darwin-Determine-CXX.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/CMakeDetermineCompilerId.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/CMakeCompilerIdDetection.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/Compiler/ADSP-DetermineCompiler.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/Compiler/ARMCC-DetermineCompiler.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/Compiler/ARMClang-DetermineCompiler.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/Compiler/AppleClang-DetermineCompiler.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/Compiler/Clang-DetermineCompilerInternal.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/Compiler/Borland-DetermineCompiler.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/Compiler/Clang-DetermineCompiler.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/Compiler/Clang-DetermineCompilerInternal.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/Compiler/Comeau-CXX-DetermineCompiler.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/Compiler/Compaq-CXX-DetermineCompiler.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/Compiler/Cray-DetermineCompiler.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/Compiler/CrayClang-DetermineCompiler.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/Compiler/Embarcadero-DetermineCompiler.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/Compiler/Fujitsu-DetermineCompiler.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/Compiler/FujitsuClang-DetermineCompiler.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/Compiler/GHS-DetermineCompiler.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/Compiler/GNU-CXX-DetermineCompiler.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/Compiler/HP-CXX-DetermineCompiler.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/Compiler/IAR-DetermineCompiler.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/Compiler/IBMClang-CXX-DetermineCompiler.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/Compiler/Intel-DetermineCompiler.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/Compiler/IntelLLVM-DetermineCompiler.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/Compiler/LCC-CXX-DetermineCompiler.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/Compiler/MSVC-DetermineCompiler.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/Compiler/NVHPC-DetermineCompiler.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/Compiler/NVIDIA-DetermineCompiler.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/Compiler/OpenWatcom-DetermineCompiler.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/Compiler/OrangeC-DetermineCompiler.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/Compiler/PGI-DetermineCompiler.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/Compiler/PathScale-DetermineCompiler.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/Compiler/SCO-DetermineCompiler.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/Compiler/SunPro-CXX-DetermineCompiler.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/Compiler/TI-DetermineCompiler.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/Compiler/Tasking-DetermineCompiler.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/Compiler/VisualAge-CXX-DetermineCompiler.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/Compiler/IBMCPP-CXX-DetermineVersionInternal.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/Compiler/Watcom-DetermineCompiler.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/Compiler/XL-CXX-DetermineCompiler.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/Compiler/IBMCPP-CXX-DetermineVersionInternal.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/Compiler/XLClang-CXX-DetermineCompiler.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/Compiler/zOS-CXX-DetermineCompiler.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/Compiler/IBMCPP-CXX-DetermineVersionInternal.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/CMakeFindBinUtils.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/Compiler/GNU-FindBinUtils.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/CMakeCXXCompiler.cmake.in"
},
{
"isGenerated" : true,
"path" : "cmake-build-debug/CMakeFiles/3.28.1/CMakeCXXCompiler.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/CMakeSystemSpecificInformation.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/CMakeGenericSystem.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/CMakeInitializeConfigs.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/Platform/Darwin.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/Platform/UnixPaths.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/CMakeCInformation.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/CMakeLanguageInformation.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/Compiler/GNU-C.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/Compiler/GNU.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/Compiler/CMakeCommonCompilerMacros.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/Platform/Apple-GNU-C.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/Platform/Apple-GNU.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/CMakeCommonLanguageInclude.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/CMakeTestCCompiler.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/CMakeTestCompilerCommon.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/CMakeDetermineCompilerABI.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/CMakeParseImplicitIncludeInfo.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/CMakeParseImplicitLinkInfo.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/CMakeParseLibraryArchitecture.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/CMakeTestCompilerCommon.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/CMakeCCompilerABI.c"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/CMakeDetermineCompileFeatures.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/Internal/FeatureTesting.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/CMakeCCompiler.cmake.in"
},
{
"isGenerated" : true,
"path" : "cmake-build-debug/CMakeFiles/3.28.1/CMakeCCompiler.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/CMakeCXXInformation.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/CMakeLanguageInformation.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/Compiler/GNU-CXX.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/Compiler/GNU.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/Platform/Apple-GNU-CXX.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/Platform/Apple-GNU.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/CMakeCommonLanguageInclude.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/CMakeTestCXXCompiler.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/CMakeTestCompilerCommon.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/CMakeDetermineCompilerABI.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/CMakeParseImplicitIncludeInfo.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/CMakeParseImplicitLinkInfo.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/CMakeParseLibraryArchitecture.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/CMakeTestCompilerCommon.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/CMakeCXXCompilerABI.cpp"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/CMakeDetermineCompileFeatures.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/Internal/FeatureTesting.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/CMakeCXXCompiler.cmake.in"
},
{
"isGenerated" : true,
"path" : "cmake-build-debug/CMakeFiles/3.28.1/CMakeCXXCompiler.cmake"
},
{
"path" : "P1/ADS_P1_1_Ringpuffer/CMakeLists.txt"
},
{
"path" : "P1/ADS_P1_2_Binaerbaum/CMakeLists.txt"
},
{
"path" : "P2/ADS_P2_1_Sortieren/CMakeLists.txt"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/FindOpenMP.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/CMakeParseImplicitLinkInfo.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/FindPackageHandleStandardArgs.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/FindPackageMessage.cmake"
},
{
"path" : "P2/ADS_P2_2_Hashtable/CMakeLists.txt"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/FindOpenMP.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/CMakeParseImplicitLinkInfo.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/FindPackageHandleStandardArgs.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/FindPackageMessage.cmake"
},
{
"path" : "P3/CMakeLists.txt"
},
{
"path" : "P4/CMakeLists.txt"
}
],
"kind" : "cmakeFiles",
"paths" :
{
"build" : "/Users/safak/Documents/ADS/Praktikum/cmake-build-debug",
"source" : "/Users/safak/Documents/ADS/Praktikum"
},
"version" :
{
"major" : 1,
"minor" : 0
}
}

View File

@@ -0,0 +1,267 @@
{
"configurations" :
[
{
"directories" :
[
{
"build" : ".",
"childIndexes" :
[
1,
2,
3,
4,
5,
6
],
"jsonFile" : "directory-.-Debug-f5ebdc15457944623624.json",
"minimumCMakeVersion" :
{
"string" : "3.10"
},
"projectIndex" : 0,
"source" : "."
},
{
"build" : "P1/ADS_P1_1_Ringpuffer",
"jsonFile" : "directory-P1.ADS_P1_1_Ringpuffer-Debug-80c7a856e4edef5cd089.json",
"minimumCMakeVersion" :
{
"string" : "3.10"
},
"parentIndex" : 0,
"projectIndex" : 1,
"source" : "P1/ADS_P1_1_Ringpuffer",
"targetIndexes" :
[
0
]
},
{
"build" : "P1/ADS_P1_2_Binaerbaum",
"jsonFile" : "directory-P1.ADS_P1_2_Binaerbaum-Debug-0edb9854ffe19ad22cb3.json",
"minimumCMakeVersion" :
{
"string" : "3.10"
},
"parentIndex" : 0,
"projectIndex" : 2,
"source" : "P1/ADS_P1_2_Binaerbaum",
"targetIndexes" :
[
1
]
},
{
"build" : "P2/ADS_P2_1_Sortieren",
"jsonFile" : "directory-P2.ADS_P2_1_Sortieren-Debug-a2400ca11eba2b6257d1.json",
"minimumCMakeVersion" :
{
"string" : "3.10"
},
"parentIndex" : 0,
"projectIndex" : 3,
"source" : "P2/ADS_P2_1_Sortieren",
"targetIndexes" :
[
2
]
},
{
"build" : "P2/ADS_P2_2_Hashtable",
"jsonFile" : "directory-P2.ADS_P2_2_Hashtable-Debug-30d07cd7578cfc1dc61c.json",
"minimumCMakeVersion" :
{
"string" : "3.11"
},
"parentIndex" : 0,
"projectIndex" : 4,
"source" : "P2/ADS_P2_2_Hashtable",
"targetIndexes" :
[
3
]
},
{
"build" : "P3",
"jsonFile" : "directory-P3-Debug-28c4ac58065e0760948c.json",
"minimumCMakeVersion" :
{
"string" : "3.11"
},
"parentIndex" : 0,
"projectIndex" : 5,
"source" : "P3",
"targetIndexes" :
[
4
]
},
{
"build" : "P4",
"jsonFile" : "directory-P4-Debug-789a3104c46f898965f6.json",
"minimumCMakeVersion" :
{
"string" : "3.11"
},
"parentIndex" : 0,
"projectIndex" : 6,
"source" : "P4",
"targetIndexes" :
[
5
]
}
],
"name" : "Debug",
"projects" :
[
{
"childIndexes" :
[
1,
2,
3,
4,
5,
6
],
"directoryIndexes" :
[
0
],
"name" : "ADS_Praktikum"
},
{
"directoryIndexes" :
[
1
],
"name" : "P1_1_Ringpuffer",
"parentIndex" : 0,
"targetIndexes" :
[
0
]
},
{
"directoryIndexes" :
[
2
],
"name" : "P1_2_Binaerbaum",
"parentIndex" : 0,
"targetIndexes" :
[
1
]
},
{
"directoryIndexes" :
[
3
],
"name" : "P2_1_Sortieren",
"parentIndex" : 0,
"targetIndexes" :
[
2
]
},
{
"directoryIndexes" :
[
4
],
"name" : "P2_2_Hashtable",
"parentIndex" : 0,
"targetIndexes" :
[
3
]
},
{
"directoryIndexes" :
[
5
],
"name" : "P3_Binaerbaum",
"parentIndex" : 0,
"targetIndexes" :
[
4
]
},
{
"directoryIndexes" :
[
6
],
"name" : "P4_Graph",
"parentIndex" : 0,
"targetIndexes" :
[
5
]
}
],
"targets" :
[
{
"directoryIndex" : 1,
"id" : "P1_1_Ringpuffer::@c1e80ea4efd23852d426",
"jsonFile" : "target-P1_1_Ringpuffer-Debug-90acae4ce494e8043026.json",
"name" : "P1_1_Ringpuffer",
"projectIndex" : 1
},
{
"directoryIndex" : 2,
"id" : "P1_2_Binaerbaum::@7e0b70581aa3eeb3d97e",
"jsonFile" : "target-P1_2_Binaerbaum-Debug-dc66d35c1df9a51f5d26.json",
"name" : "P1_2_Binaerbaum",
"projectIndex" : 2
},
{
"directoryIndex" : 3,
"id" : "P2_1_Sortieren::@2c7f32daa6d89936809e",
"jsonFile" : "target-P2_1_Sortieren-Debug-4d8b19ae305edf5d810f.json",
"name" : "P2_1_Sortieren",
"projectIndex" : 3
},
{
"directoryIndex" : 4,
"id" : "P2_2_Hashtable::@17014a2bd97c1425fd11",
"jsonFile" : "target-P2_2_Hashtable-Debug-e75fd73481f11a26afbf.json",
"name" : "P2_2_Hashtable",
"projectIndex" : 4
},
{
"directoryIndex" : 5,
"id" : "P3_Binaerbaum::@934463501d1ae26a9a5a",
"jsonFile" : "target-P3_Binaerbaum-Debug-b658731651ac2fb348cd.json",
"name" : "P3_Binaerbaum",
"projectIndex" : 5
},
{
"directoryIndex" : 6,
"id" : "P4_Graph::@4f2a4e2d233502414f28",
"jsonFile" : "target-P4_Graph-Debug-bb10ad662e7a92578c41.json",
"name" : "P4_Graph",
"projectIndex" : 6
}
]
}
],
"kind" : "codemodel",
"paths" :
{
"build" : "/Users/safak/Documents/ADS/Praktikum/cmake-build-debug",
"source" : "/Users/safak/Documents/ADS/Praktikum"
},
"version" :
{
"major" : 2,
"minor" : 6
}
}

View File

@@ -0,0 +1,14 @@
{
"backtraceGraph" :
{
"commands" : [],
"files" : [],
"nodes" : []
},
"installers" : [],
"paths" :
{
"build" : ".",
"source" : "."
}
}

View File

@@ -0,0 +1,14 @@
{
"backtraceGraph" :
{
"commands" : [],
"files" : [],
"nodes" : []
},
"installers" : [],
"paths" :
{
"build" : "P1/ADS_P1_1_Ringpuffer",
"source" : "P1/ADS_P1_1_Ringpuffer"
}
}

View File

@@ -0,0 +1,14 @@
{
"backtraceGraph" :
{
"commands" : [],
"files" : [],
"nodes" : []
},
"installers" : [],
"paths" :
{
"build" : "P1/ADS_P1_2_Binaerbaum",
"source" : "P1/ADS_P1_2_Binaerbaum"
}
}

View File

@@ -0,0 +1,14 @@
{
"backtraceGraph" :
{
"commands" : [],
"files" : [],
"nodes" : []
},
"installers" : [],
"paths" :
{
"build" : "P2/ADS_P2_1_Sortieren",
"source" : "P2/ADS_P2_1_Sortieren"
}
}

View File

@@ -0,0 +1,14 @@
{
"backtraceGraph" :
{
"commands" : [],
"files" : [],
"nodes" : []
},
"installers" : [],
"paths" :
{
"build" : "P2/ADS_P2_2_Hashtable",
"source" : "P2/ADS_P2_2_Hashtable"
}
}

View File

@@ -0,0 +1,14 @@
{
"backtraceGraph" :
{
"commands" : [],
"files" : [],
"nodes" : []
},
"installers" : [],
"paths" :
{
"build" : "P3",
"source" : "P3"
}
}

View File

@@ -0,0 +1,14 @@
{
"backtraceGraph" :
{
"commands" : [],
"files" : [],
"nodes" : []
},
"installers" : [],
"paths" :
{
"build" : "P4",
"source" : "P4"
}
}

View File

@@ -0,0 +1,108 @@
{
"cmake" :
{
"generator" :
{
"multiConfig" : false,
"name" : "Ninja"
},
"paths" :
{
"cmake" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/bin/cmake",
"cpack" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/bin/cpack",
"ctest" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/bin/ctest",
"root" : "/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28"
},
"version" :
{
"isDirty" : false,
"major" : 3,
"minor" : 28,
"patch" : 1,
"string" : "3.28.1",
"suffix" : ""
}
},
"objects" :
[
{
"jsonFile" : "codemodel-v2-61a9e09c3c667cceb557.json",
"kind" : "codemodel",
"version" :
{
"major" : 2,
"minor" : 6
}
},
{
"jsonFile" : "cache-v2-7d4a5c1587617cb0b766.json",
"kind" : "cache",
"version" :
{
"major" : 2,
"minor" : 0
}
},
{
"jsonFile" : "cmakeFiles-v1-22f6c7a6c4212c6d3562.json",
"kind" : "cmakeFiles",
"version" :
{
"major" : 1,
"minor" : 0
}
},
{
"jsonFile" : "toolchains-v1-50636e04ef21605ca616.json",
"kind" : "toolchains",
"version" :
{
"major" : 1,
"minor" : 0
}
}
],
"reply" :
{
"cache-v2" :
{
"jsonFile" : "cache-v2-7d4a5c1587617cb0b766.json",
"kind" : "cache",
"version" :
{
"major" : 2,
"minor" : 0
}
},
"cmakeFiles-v1" :
{
"jsonFile" : "cmakeFiles-v1-22f6c7a6c4212c6d3562.json",
"kind" : "cmakeFiles",
"version" :
{
"major" : 1,
"minor" : 0
}
},
"codemodel-v2" :
{
"jsonFile" : "codemodel-v2-61a9e09c3c667cceb557.json",
"kind" : "codemodel",
"version" :
{
"major" : 2,
"minor" : 6
}
},
"toolchains-v1" :
{
"jsonFile" : "toolchains-v1-50636e04ef21605ca616.json",
"kind" : "toolchains",
"version" :
{
"major" : 1,
"minor" : 0
}
}
}
}

View File

@@ -0,0 +1,123 @@
{
"artifacts" :
[
{
"path" : "P1/ADS_P1_1_Ringpuffer/P1_1_Ringpuffer"
}
],
"backtrace" : 1,
"backtraceGraph" :
{
"commands" :
[
"add_executable"
],
"files" :
[
"P1/ADS_P1_1_Ringpuffer/CMakeLists.txt"
],
"nodes" :
[
{
"file" : 0
},
{
"command" : 0,
"file" : 0,
"line" : 8,
"parent" : 0
}
]
},
"compileGroups" :
[
{
"compileCommandFragments" :
[
{
"fragment" : "-g -std=gnu++11 -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX15.2.sdk -fdiagnostics-color=always"
}
],
"language" : "CXX",
"languageStandard" :
{
"backtraces" :
[
1
],
"standard" : "11"
},
"sourceIndexes" :
[
0,
1,
2,
3
]
}
],
"id" : "P1_1_Ringpuffer::@c1e80ea4efd23852d426",
"link" :
{
"commandFragments" :
[
{
"fragment" : "-g",
"role" : "flags"
},
{
"fragment" : "",
"role" : "flags"
}
],
"language" : "CXX"
},
"name" : "P1_1_Ringpuffer",
"nameOnDisk" : "P1_1_Ringpuffer",
"paths" :
{
"build" : "P1/ADS_P1_1_Ringpuffer",
"source" : "P1/ADS_P1_1_Ringpuffer"
},
"sourceGroups" :
[
{
"name" : "Source Files",
"sourceIndexes" :
[
0,
1,
2,
3
]
}
],
"sources" :
[
{
"backtrace" : 1,
"compileGroupIndex" : 0,
"path" : "P1/ADS_P1_1_Ringpuffer/main.cpp",
"sourceGroupIndex" : 0
},
{
"backtrace" : 1,
"compileGroupIndex" : 0,
"path" : "P1/ADS_P1_1_Ringpuffer/Ring.cpp",
"sourceGroupIndex" : 0
},
{
"backtrace" : 1,
"compileGroupIndex" : 0,
"path" : "P1/ADS_P1_1_Ringpuffer/RingNode.cpp",
"sourceGroupIndex" : 0
},
{
"backtrace" : 1,
"compileGroupIndex" : 0,
"path" : "P1/ADS_P1_1_Ringpuffer/RingTest.cpp",
"sourceGroupIndex" : 0
}
],
"type" : "EXECUTABLE"
}

View File

@@ -0,0 +1,123 @@
{
"artifacts" :
[
{
"path" : "P1/ADS_P1_2_Binaerbaum/P1_2_Binaerbaum"
}
],
"backtrace" : 1,
"backtraceGraph" :
{
"commands" :
[
"add_executable"
],
"files" :
[
"P1/ADS_P1_2_Binaerbaum/CMakeLists.txt"
],
"nodes" :
[
{
"file" : 0
},
{
"command" : 0,
"file" : 0,
"line" : 8,
"parent" : 0
}
]
},
"compileGroups" :
[
{
"compileCommandFragments" :
[
{
"fragment" : "-g -std=gnu++11 -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX15.2.sdk -fdiagnostics-color=always"
}
],
"language" : "CXX",
"languageStandard" :
{
"backtraces" :
[
1
],
"standard" : "11"
},
"sourceIndexes" :
[
0,
1,
2,
3
]
}
],
"id" : "P1_2_Binaerbaum::@7e0b70581aa3eeb3d97e",
"link" :
{
"commandFragments" :
[
{
"fragment" : "-g",
"role" : "flags"
},
{
"fragment" : "",
"role" : "flags"
}
],
"language" : "CXX"
},
"name" : "P1_2_Binaerbaum",
"nameOnDisk" : "P1_2_Binaerbaum",
"paths" :
{
"build" : "P1/ADS_P1_2_Binaerbaum",
"source" : "P1/ADS_P1_2_Binaerbaum"
},
"sourceGroups" :
[
{
"name" : "Source Files",
"sourceIndexes" :
[
0,
1,
2,
3
]
}
],
"sources" :
[
{
"backtrace" : 1,
"compileGroupIndex" : 0,
"path" : "P1/ADS_P1_2_Binaerbaum/main.cpp",
"sourceGroupIndex" : 0
},
{
"backtrace" : 1,
"compileGroupIndex" : 0,
"path" : "P1/ADS_P1_2_Binaerbaum/Tree.cpp",
"sourceGroupIndex" : 0
},
{
"backtrace" : 1,
"compileGroupIndex" : 0,
"path" : "P1/ADS_P1_2_Binaerbaum/TreeNode.cpp",
"sourceGroupIndex" : 0
},
{
"backtrace" : 1,
"compileGroupIndex" : 0,
"path" : "P1/ADS_P1_2_Binaerbaum/TreeTest.cpp",
"sourceGroupIndex" : 0
}
],
"type" : "EXECUTABLE"
}

View File

@@ -0,0 +1,150 @@
{
"artifacts" :
[
{
"path" : "P2/ADS_P2_1_Sortieren/P2_1_Sortieren"
}
],
"backtrace" : 1,
"backtraceGraph" :
{
"commands" :
[
"add_executable",
"set_property",
"find_package",
"target_link_libraries"
],
"files" :
[
"P2/ADS_P2_1_Sortieren/CMakeLists.txt",
"/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/FindOpenMP.cmake"
],
"nodes" :
[
{
"file" : 0
},
{
"command" : 0,
"file" : 0,
"line" : 11,
"parent" : 0
},
{
"command" : 2,
"file" : 0,
"line" : 9,
"parent" : 0
},
{
"file" : 1,
"parent" : 2
},
{
"command" : 1,
"file" : 1,
"line" : 619,
"parent" : 3
},
{
"command" : 3,
"file" : 0,
"line" : 12,
"parent" : 0
}
]
},
"compileGroups" :
[
{
"compileCommandFragments" :
[
{
"fragment" : "-g -std=gnu++17 -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX15.2.sdk -fdiagnostics-color=always"
},
{
"backtrace" : 5,
"fragment" : "-fopenmp"
}
],
"language" : "CXX",
"languageStandard" :
{
"backtraces" :
[
1
],
"standard" : "17"
},
"sourceIndexes" :
[
0,
1,
2
]
}
],
"id" : "P2_1_Sortieren::@2c7f32daa6d89936809e",
"link" :
{
"commandFragments" :
[
{
"fragment" : "-g",
"role" : "flags"
},
{
"fragment" : "",
"role" : "flags"
},
{
"backtrace" : 4,
"fragment" : "/opt/homebrew/Cellar/gcc/14.2.0_1/lib/gcc/current/libgomp.dylib",
"role" : "libraries"
}
],
"language" : "CXX"
},
"name" : "P2_1_Sortieren",
"nameOnDisk" : "P2_1_Sortieren",
"paths" :
{
"build" : "P2/ADS_P2_1_Sortieren",
"source" : "P2/ADS_P2_1_Sortieren"
},
"sourceGroups" :
[
{
"name" : "Source Files",
"sourceIndexes" :
[
0,
1,
2
]
}
],
"sources" :
[
{
"backtrace" : 1,
"compileGroupIndex" : 0,
"path" : "P2/ADS_P2_1_Sortieren/main.cpp",
"sourceGroupIndex" : 0
},
{
"backtrace" : 1,
"compileGroupIndex" : 0,
"path" : "P2/ADS_P2_1_Sortieren/sorting.cpp",
"sourceGroupIndex" : 0
},
{
"backtrace" : 1,
"compileGroupIndex" : 0,
"path" : "P2/ADS_P2_1_Sortieren/unit_tests.cpp",
"sourceGroupIndex" : 0
}
],
"type" : "EXECUTABLE"
}

View File

@@ -0,0 +1,150 @@
{
"artifacts" :
[
{
"path" : "P2/ADS_P2_2_Hashtable/P2_2_Hashtable"
}
],
"backtrace" : 1,
"backtraceGraph" :
{
"commands" :
[
"add_executable",
"set_property",
"find_package",
"target_link_libraries"
],
"files" :
[
"P2/ADS_P2_2_Hashtable/CMakeLists.txt",
"/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.28/Modules/FindOpenMP.cmake"
],
"nodes" :
[
{
"file" : 0
},
{
"command" : 0,
"file" : 0,
"line" : 12,
"parent" : 0
},
{
"command" : 2,
"file" : 0,
"line" : 18,
"parent" : 0
},
{
"file" : 1,
"parent" : 2
},
{
"command" : 1,
"file" : 1,
"line" : 619,
"parent" : 3
},
{
"command" : 3,
"file" : 0,
"line" : 20,
"parent" : 0
}
]
},
"compileGroups" :
[
{
"compileCommandFragments" :
[
{
"fragment" : "-g -std=gnu++17 -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX15.2.sdk -fdiagnostics-color=always"
},
{
"backtrace" : 5,
"fragment" : "-fopenmp"
}
],
"language" : "CXX",
"languageStandard" :
{
"backtraces" :
[
1
],
"standard" : "17"
},
"sourceIndexes" :
[
0,
1,
2
]
}
],
"id" : "P2_2_Hashtable::@17014a2bd97c1425fd11",
"link" :
{
"commandFragments" :
[
{
"fragment" : "-g",
"role" : "flags"
},
{
"fragment" : "",
"role" : "flags"
},
{
"backtrace" : 4,
"fragment" : "/opt/homebrew/Cellar/gcc/14.2.0_1/lib/gcc/current/libgomp.dylib",
"role" : "libraries"
}
],
"language" : "CXX"
},
"name" : "P2_2_Hashtable",
"nameOnDisk" : "P2_2_Hashtable",
"paths" :
{
"build" : "P2/ADS_P2_2_Hashtable",
"source" : "P2/ADS_P2_2_Hashtable"
},
"sourceGroups" :
[
{
"name" : "Source Files",
"sourceIndexes" :
[
0,
1,
2
]
}
],
"sources" :
[
{
"backtrace" : 1,
"compileGroupIndex" : 0,
"path" : "P2/ADS_P2_2_Hashtable/main.cpp",
"sourceGroupIndex" : 0
},
{
"backtrace" : 1,
"compileGroupIndex" : 0,
"path" : "P2/ADS_P2_2_Hashtable/hashtable.cpp",
"sourceGroupIndex" : 0
},
{
"backtrace" : 1,
"compileGroupIndex" : 0,
"path" : "P2/ADS_P2_2_Hashtable/unit_tests.cpp",
"sourceGroupIndex" : 0
}
],
"type" : "EXECUTABLE"
}

View File

@@ -0,0 +1,123 @@
{
"artifacts" :
[
{
"path" : "P3/P3_Binaerbaum"
}
],
"backtrace" : 1,
"backtraceGraph" :
{
"commands" :
[
"add_executable"
],
"files" :
[
"P3/CMakeLists.txt"
],
"nodes" :
[
{
"file" : 0
},
{
"command" : 0,
"file" : 0,
"line" : 12,
"parent" : 0
}
]
},
"compileGroups" :
[
{
"compileCommandFragments" :
[
{
"fragment" : "-g -std=gnu++17 -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX15.2.sdk -fdiagnostics-color=always"
}
],
"language" : "CXX",
"languageStandard" :
{
"backtraces" :
[
1
],
"standard" : "17"
},
"sourceIndexes" :
[
0,
1,
2,
3
]
}
],
"id" : "P3_Binaerbaum::@934463501d1ae26a9a5a",
"link" :
{
"commandFragments" :
[
{
"fragment" : "-g",
"role" : "flags"
},
{
"fragment" : "",
"role" : "flags"
}
],
"language" : "CXX"
},
"name" : "P3_Binaerbaum",
"nameOnDisk" : "P3_Binaerbaum",
"paths" :
{
"build" : "P3",
"source" : "P3"
},
"sourceGroups" :
[
{
"name" : "Source Files",
"sourceIndexes" :
[
0,
1,
2,
3
]
}
],
"sources" :
[
{
"backtrace" : 1,
"compileGroupIndex" : 0,
"path" : "P3/main.cpp",
"sourceGroupIndex" : 0
},
{
"backtrace" : 1,
"compileGroupIndex" : 0,
"path" : "P3/Tree.cpp",
"sourceGroupIndex" : 0
},
{
"backtrace" : 1,
"compileGroupIndex" : 0,
"path" : "P3/TreeNode.cpp",
"sourceGroupIndex" : 0
},
{
"backtrace" : 1,
"compileGroupIndex" : 0,
"path" : "P3/TreeTest.cpp",
"sourceGroupIndex" : 0
}
],
"type" : "EXECUTABLE"
}

View File

@@ -0,0 +1,147 @@
{
"artifacts" :
[
{
"path" : "P4/P4_Graph"
}
],
"backtrace" : 1,
"backtraceGraph" :
{
"commands" :
[
"add_executable"
],
"files" :
[
"P4/CMakeLists.txt"
],
"nodes" :
[
{
"file" : 0
},
{
"command" : 0,
"file" : 0,
"line" : 12,
"parent" : 0
}
]
},
"compileGroups" :
[
{
"compileCommandFragments" :
[
{
"fragment" : "-g -std=gnu++17 -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX15.2.sdk -fdiagnostics-color=always"
}
],
"language" : "CXX",
"languageStandard" :
{
"backtraces" :
[
1
],
"standard" : "17"
},
"sourceIndexes" :
[
0,
1,
2,
3,
4,
5,
6
]
}
],
"id" : "P4_Graph::@4f2a4e2d233502414f28",
"link" :
{
"commandFragments" :
[
{
"fragment" : "-g",
"role" : "flags"
},
{
"fragment" : "",
"role" : "flags"
}
],
"language" : "CXX"
},
"name" : "P4_Graph",
"nameOnDisk" : "P4_Graph",
"paths" :
{
"build" : "P4",
"source" : "P4"
},
"sourceGroups" :
[
{
"name" : "Source Files",
"sourceIndexes" :
[
0,
1,
2,
3,
4,
5,
6
]
}
],
"sources" :
[
{
"backtrace" : 1,
"compileGroupIndex" : 0,
"path" : "P4/main.cpp",
"sourceGroupIndex" : 0
},
{
"backtrace" : 1,
"compileGroupIndex" : 0,
"path" : "P4/DijkstraSP.cpp",
"sourceGroupIndex" : 0
},
{
"backtrace" : 1,
"compileGroupIndex" : 0,
"path" : "P4/EdgeWeightedDigraph.cpp",
"sourceGroupIndex" : 0
},
{
"backtrace" : 1,
"compileGroupIndex" : 0,
"path" : "P4/EdgeWeightedGraph.cpp",
"sourceGroupIndex" : 0
},
{
"backtrace" : 1,
"compileGroupIndex" : 0,
"path" : "P4/GraphTest.cpp",
"sourceGroupIndex" : 0
},
{
"backtrace" : 1,
"compileGroupIndex" : 0,
"path" : "P4/KruskalMST.cpp",
"sourceGroupIndex" : 0
},
{
"backtrace" : 1,
"compileGroupIndex" : 0,
"path" : "P4/PrimMST.cpp",
"sourceGroupIndex" : 0
}
],
"type" : "EXECUTABLE"
}

View File

@@ -0,0 +1,111 @@
{
"kind" : "toolchains",
"toolchains" :
[
{
"compiler" :
{
"id" : "GNU",
"implicit" :
{
"includeDirectories" :
[
"/opt/homebrew/Cellar/gcc/14.2.0_1/lib/gcc/current/gcc/aarch64-apple-darwin24/14/include",
"/opt/homebrew/Cellar/gcc/14.2.0_1/lib/gcc/current/gcc/aarch64-apple-darwin24/14/include-fixed",
"/Library/Developer/CommandLineTools/SDKs/MacOSX15.2.sdk/usr/include",
"/Library/Developer/CommandLineTools/SDKs/MacOSX15.2.sdk/System/Library/Frameworks"
],
"linkDirectories" :
[
"/opt/homebrew/Cellar/gcc/14.2.0_1/lib/gcc/current/gcc/aarch64-apple-darwin24/14",
"/opt/homebrew/Cellar/gcc/14.2.0_1/lib/gcc/current/gcc",
"/opt/homebrew/Cellar/gcc/14.2.0_1/lib/gcc/current",
"/Library/Developer/CommandLineTools/SDKs/MacOSX15.2.sdk/usr/lib",
"/Library/Developer/CommandLineTools/SDKs/MacOSX15.2.sdk/usr/lib/swift"
],
"linkFrameworkDirectories" :
[
"/Library/Developer/CommandLineTools/SDKs/MacOSX15.2.sdk/System/Library/Frameworks"
],
"linkLibraries" :
[
"emutls_w",
"heapt_w",
"gcc"
]
},
"path" : "/opt/homebrew/bin/gcc-14",
"version" : "14.2.0"
},
"language" : "C",
"sourceFileExtensions" :
[
"c",
"m"
]
},
{
"compiler" :
{
"id" : "GNU",
"implicit" :
{
"includeDirectories" :
[
"/opt/homebrew/Cellar/gcc/14.2.0_1/include/c++/14",
"/opt/homebrew/Cellar/gcc/14.2.0_1/include/c++/14/aarch64-apple-darwin24",
"/opt/homebrew/Cellar/gcc/14.2.0_1/include/c++/14/backward",
"/opt/homebrew/Cellar/gcc/14.2.0_1/lib/gcc/current/gcc/aarch64-apple-darwin24/14/include",
"/opt/homebrew/Cellar/gcc/14.2.0_1/lib/gcc/current/gcc/aarch64-apple-darwin24/14/include-fixed",
"/Library/Developer/CommandLineTools/SDKs/MacOSX15.2.sdk/usr/include",
"/Library/Developer/CommandLineTools/SDKs/MacOSX15.2.sdk/System/Library/Frameworks"
],
"linkDirectories" :
[
"/opt/homebrew/Cellar/gcc/14.2.0_1/lib/gcc/current/gcc/aarch64-apple-darwin24/14",
"/opt/homebrew/Cellar/gcc/14.2.0_1/lib/gcc/current/gcc",
"/opt/homebrew/Cellar/gcc/14.2.0_1/lib/gcc/current",
"/Library/Developer/CommandLineTools/SDKs/MacOSX15.2.sdk/usr/lib",
"/Library/Developer/CommandLineTools/SDKs/MacOSX15.2.sdk/usr/lib/swift"
],
"linkFrameworkDirectories" :
[
"/Library/Developer/CommandLineTools/SDKs/MacOSX15.2.sdk/System/Library/Frameworks"
],
"linkLibraries" :
[
"emutls_w",
"heapt_w",
"stdc++",
"gcc"
]
},
"path" : "/opt/homebrew/Cellar/gcc/14.2.0_1/bin/g++-14",
"version" : "14.2.0"
},
"language" : "CXX",
"sourceFileExtensions" :
[
"C",
"M",
"c++",
"cc",
"cpp",
"cxx",
"mm",
"mpp",
"CPP",
"ixx",
"cppm",
"ccm",
"cxxm",
"c++m"
]
}
],
"version" :
{
"major" : 1,
"minor" : 0
}
}

Binary file not shown.

View File

@@ -0,0 +1,9 @@
# ninja log v6
2 415 1740140006085839132 P4/CMakeFiles/P4_Graph.dir/KruskalMST.cpp.o ec21aeb8f94076c
2 471 1740140006085938257 P4/CMakeFiles/P4_Graph.dir/PrimMST.cpp.o e89f67176a80ca3b
1 514 1740140006085617467 P4/CMakeFiles/P4_Graph.dir/EdgeWeightedGraph.cpp.o 2472ee3e833d1daf
1 521 1740140006085514010 P4/CMakeFiles/P4_Graph.dir/EdgeWeightedDigraph.cpp.o c5b7a9c0c1fe9ab4
1 585 1740140006085374761 P4/CMakeFiles/P4_Graph.dir/DijkstraSP.cpp.o 9001e170fede407a
2 989 1740140006085733550 P4/CMakeFiles/P4_Graph.dir/GraphTest.cpp.o 8160742a93f05d3e
1 5106 1740140006085140471 P4/CMakeFiles/P4_Graph.dir/main.cpp.o 3a9c129bf1b5e670
5106 5151 1740140011190649347 P4/P4_Graph bf74e5d1f1040073

Some files were not shown because too many files have changed in this diff Show More