Compare commits
23 Commits
20c082a483
...
596d863a25
Author | SHA1 | Date | |
---|---|---|---|
596d863a25 | |||
ee0556730d | |||
15c4684857 | |||
84645fad5f | |||
954ea3f949 | |||
e338ddb255 | |||
7cabc13196 | |||
32a5a1c51a | |||
700d6696c8 | |||
23e7860e43 | |||
25091543a2 | |||
05d637acb5 | |||
462d1ccc83 | |||
7a75d22514 | |||
e76f3b452e | |||
96d5eb8071 | |||
5913fb8084 | |||
2da0705577 | |||
deb58f03bb | |||
9ec4e515f2 | |||
227614c62d | |||
4c21f99291 | |||
dba577e099 |
138
DataStructures/DataStructures.vcxproj
Normal file
138
DataStructures/DataStructures.vcxproj
Normal file
@ -0,0 +1,138 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ItemGroup Label="ProjectConfigurations">
|
||||||
|
<ProjectConfiguration Include="Debug|Win32">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|Win32">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Debug|x64">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|x64">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
</ItemGroup>
|
||||||
|
<PropertyGroup Label="Globals">
|
||||||
|
<VCProjectVersion>16.0</VCProjectVersion>
|
||||||
|
<Keyword>Win32Proj</Keyword>
|
||||||
|
<ProjectGuid>{b126f459-712b-4505-89b8-ef02d606d964}</ProjectGuid>
|
||||||
|
<RootNamespace>DataStructures</RootNamespace>
|
||||||
|
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
|
<ImportGroup Label="ExtensionSettings">
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="Shared">
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<PropertyGroup Label="UserMacros" />
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<ConformanceMode>true</ConformanceMode>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<ConformanceMode>true</ConformanceMode>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<ConformanceMode>true</ConformanceMode>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<ConformanceMode>true</ConformanceMode>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClInclude Include="src\Generic\directednode.h" />
|
||||||
|
<ClInclude Include="src\Generic\undirectednode.h" />
|
||||||
|
<ClInclude Include="src\LinkedList\linkedlist.h" />
|
||||||
|
<ClInclude Include="src\LinkedList\linkedlistnode.h" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
|
<ImportGroup Label="ExtensionTargets">
|
||||||
|
</ImportGroup>
|
||||||
|
</Project>
|
31
DataStructures/DataStructures.vcxproj.filters
Normal file
31
DataStructures/DataStructures.vcxproj.filters
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ItemGroup>
|
||||||
|
<Filter Include="Source Files">
|
||||||
|
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||||
|
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="Header Files">
|
||||||
|
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||||
|
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="Resource Files">
|
||||||
|
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||||
|
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||||
|
</Filter>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClInclude Include="src\Generic\directednode.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="src\Generic\undirectednode.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="src\LinkedList\linkedlist.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="src\LinkedList\linkedlistnode.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
26
DataStructures/src/Generic/directednode.h
Normal file
26
DataStructures/src/Generic/directednode.h
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
#pragma once
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
|
namespace Generic {
|
||||||
|
template <typename T, typename NodeType>
|
||||||
|
class DirectedNode
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
DirectedNode(T value, std::shared_ptr<NodeType> left = nullptr, std::shared_ptr<NodeType> right = nullptr);
|
||||||
|
~DirectedNode();
|
||||||
|
T value;
|
||||||
|
std::shared_ptr<NodeType> left;
|
||||||
|
std::shared_ptr<NodeType> right;
|
||||||
|
protected:
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename T, typename NodeType>
|
||||||
|
DirectedNode<T, NodeType>::DirectedNode(T value, std::shared_ptr<NodeType> left, std::shared_ptr<NodeType> right) {
|
||||||
|
this->value = value;
|
||||||
|
this->left = left;
|
||||||
|
this->right = right;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T, typename NodeType>
|
||||||
|
DirectedNode<T, NodeType>::~DirectedNode() {}
|
||||||
|
}
|
23
DataStructures/src/Generic/undirectednode.h
Normal file
23
DataStructures/src/Generic/undirectednode.h
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
#pragma once
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
|
namespace Generic {
|
||||||
|
template <typename T, typename NodeType>
|
||||||
|
class UndirectedNode
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
UndirectedNode(T value, std::shared_ptr<NodeType> next = nullptr);
|
||||||
|
~UndirectedNode();
|
||||||
|
T value;
|
||||||
|
std::shared_ptr<NodeType> next;
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename T, typename NodeType>
|
||||||
|
UndirectedNode<T, NodeType>::UndirectedNode(T value, std::shared_ptr<NodeType> next) {
|
||||||
|
this->value = value;
|
||||||
|
this->next = next;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T, typename NodeType>
|
||||||
|
UndirectedNode<T, NodeType>::~UndirectedNode() {}
|
||||||
|
}
|
15
DataStructures/src/Nodes/linkedlistnode.h
Normal file
15
DataStructures/src/Nodes/linkedlistnode.h
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "../Generic/undirectednode.h"
|
||||||
|
|
||||||
|
namespace Datastructures {
|
||||||
|
namespace Nodes {
|
||||||
|
template <typename T>
|
||||||
|
class LinkedListNode : public Generic::UndirectedNode<T, LinkedListNode<T>>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
//Inherit Constructor and destructor from generic Undirectetd Node
|
||||||
|
using Generic::UndirectedNode<T, LinkedListNode<T>>::UndirectedNode;
|
||||||
|
private:
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
142
DataStructures/src/linkedlist.h
Normal file
142
DataStructures/src/linkedlist.h
Normal file
@ -0,0 +1,142 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "Nodes/linkedlistnode.h"
|
||||||
|
|
||||||
|
namespace Datastructures {
|
||||||
|
template <typename T>
|
||||||
|
class LinkedList
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
LinkedList();
|
||||||
|
LinkedList(T value);
|
||||||
|
~LinkedList();
|
||||||
|
T& operator[](int index);
|
||||||
|
void append(T value);
|
||||||
|
bool insert(T value, int index);
|
||||||
|
bool remove(int index);
|
||||||
|
int count() const;
|
||||||
|
int find(const T &value) const;
|
||||||
|
|
||||||
|
enum EFindResult {
|
||||||
|
eNotFound = -1,
|
||||||
|
};
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::shared_ptr<Nodes::LinkedListNode<T>> getIndex(int index);
|
||||||
|
std::shared_ptr<Nodes::LinkedListNode<T>> mHead;
|
||||||
|
int mCount;
|
||||||
|
};
|
||||||
|
|
||||||
|
//Generic Class constructor for the Linked List
|
||||||
|
template <typename T>
|
||||||
|
LinkedList<T>::LinkedList() {
|
||||||
|
mCount = 0;
|
||||||
|
mHead = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Class constructor for the Linked List, taking a preset value to go into the head of the list
|
||||||
|
template <typename T>
|
||||||
|
LinkedList<T>::LinkedList(T value) {
|
||||||
|
mCount = 1;
|
||||||
|
mHead = std::make_shared<Nodes::LinkedListNode<T>>(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
LinkedList<T>::~LinkedList() {}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
T& LinkedList<T>::operator[](int index) {
|
||||||
|
//Return the value from a given index. (Will return null pointer if out of range)
|
||||||
|
return this->getIndex(index)->value;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
void LinkedList<T>::append(T value) {
|
||||||
|
mCount++;
|
||||||
|
if (mHead == nullptr) {
|
||||||
|
mHead = std::make_shared<Nodes::LinkedListNode<T>>(value);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Add new node (Count already altered so we need to look a node before the end)
|
||||||
|
std::shared_ptr<Nodes::LinkedListNode<T>> node = this->getIndex(mCount - 2);
|
||||||
|
node->next = std::make_shared<Nodes::LinkedListNode<T>>(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
bool LinkedList<T>::insert(T value, int index) {
|
||||||
|
|
||||||
|
if (index == 0 || this->mCount == 0)
|
||||||
|
{//If the new item needs to go into the head of the linked list.
|
||||||
|
mHead = std::make_shared<Nodes::LinkedListNode<T>>(value, mHead);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//Get the node before the one we are going to be inserting
|
||||||
|
std::shared_ptr<Nodes::LinkedListNode<T>> node = this->getIndex(index-1);
|
||||||
|
//If node is nullptr, index is out of range
|
||||||
|
if (node == nullptr)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
node->next = std::make_shared<Nodes::LinkedListNode<T>>(value, node->next);
|
||||||
|
}
|
||||||
|
//Append the new value into a new node.
|
||||||
|
mCount++;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
bool LinkedList<T>::remove(int index) {
|
||||||
|
//If the list is empty
|
||||||
|
if (this->mCount == 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
//Check if we are looking to remove the head node (0)
|
||||||
|
if (index == 0)
|
||||||
|
{
|
||||||
|
this->mHead = this->mHead->next;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//Get the node before the one that is about to be removed
|
||||||
|
std::shared_ptr<Nodes::LinkedListNode<T>> node = this->getIndex(index - 1);
|
||||||
|
//Point this node to the node pointed to by the one about to be removed
|
||||||
|
node->next = node->next->next;
|
||||||
|
}
|
||||||
|
//Reduce the total count of nodes
|
||||||
|
mCount--;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
int LinkedList<T>::count() const {
|
||||||
|
return this->mCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
int LinkedList<T>::find(const T& value) const {
|
||||||
|
//Start at the head of the list
|
||||||
|
std::shared_ptr<Nodes::LinkedListNode<T>> node = mHead;
|
||||||
|
for (int i = 0; i < this->mCount; i++)
|
||||||
|
{//Loop through list to try and find value
|
||||||
|
if (node->value == value)
|
||||||
|
return i;
|
||||||
|
node = node->next;
|
||||||
|
}
|
||||||
|
return EFindResult::eNotFound; //-1
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
std::shared_ptr<Nodes::LinkedListNode<T>> LinkedList<T>::getIndex(int index) {
|
||||||
|
//Check if the value lies within the range of the list.
|
||||||
|
if (index < 0 || index >= this->mCount)
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
|
std::shared_ptr<Nodes::LinkedListNode<T>> node = mHead;
|
||||||
|
for (int i = 0; i < index; i++)
|
||||||
|
{//Interate through the linked list i times to get to the index.
|
||||||
|
node = node->next;
|
||||||
|
}
|
||||||
|
return node;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
41
DataStructuresCPP.sln
Normal file
41
DataStructuresCPP.sln
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
# Visual Studio Version 17
|
||||||
|
VisualStudioVersion = 17.3.32929.385
|
||||||
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DataStructuresCPP", "DataStructuresCPP.vcxproj", "{B338A154-A64D-4ADA-A276-E12076AC9A15}"
|
||||||
|
EndProject
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DataStructures", "DataStructures\DataStructures.vcxproj", "{B126F459-712B-4505-89B8-EF02D606D964}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|x64 = Debug|x64
|
||||||
|
Debug|x86 = Debug|x86
|
||||||
|
Release|x64 = Release|x64
|
||||||
|
Release|x86 = Release|x86
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{B338A154-A64D-4ADA-A276-E12076AC9A15}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
|
{B338A154-A64D-4ADA-A276-E12076AC9A15}.Debug|x64.Build.0 = Debug|x64
|
||||||
|
{B338A154-A64D-4ADA-A276-E12076AC9A15}.Debug|x86.ActiveCfg = Debug|Win32
|
||||||
|
{B338A154-A64D-4ADA-A276-E12076AC9A15}.Debug|x86.Build.0 = Debug|Win32
|
||||||
|
{B338A154-A64D-4ADA-A276-E12076AC9A15}.Release|x64.ActiveCfg = Release|x64
|
||||||
|
{B338A154-A64D-4ADA-A276-E12076AC9A15}.Release|x64.Build.0 = Release|x64
|
||||||
|
{B338A154-A64D-4ADA-A276-E12076AC9A15}.Release|x86.ActiveCfg = Release|Win32
|
||||||
|
{B338A154-A64D-4ADA-A276-E12076AC9A15}.Release|x86.Build.0 = Release|Win32
|
||||||
|
{B126F459-712B-4505-89B8-EF02D606D964}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
|
{B126F459-712B-4505-89B8-EF02D606D964}.Debug|x64.Build.0 = Debug|x64
|
||||||
|
{B126F459-712B-4505-89B8-EF02D606D964}.Debug|x86.ActiveCfg = Debug|Win32
|
||||||
|
{B126F459-712B-4505-89B8-EF02D606D964}.Debug|x86.Build.0 = Debug|Win32
|
||||||
|
{B126F459-712B-4505-89B8-EF02D606D964}.Release|x64.ActiveCfg = Release|x64
|
||||||
|
{B126F459-712B-4505-89B8-EF02D606D964}.Release|x64.Build.0 = Release|x64
|
||||||
|
{B126F459-712B-4505-89B8-EF02D606D964}.Release|x86.ActiveCfg = Release|Win32
|
||||||
|
{B126F459-712B-4505-89B8-EF02D606D964}.Release|x86.Build.0 = Release|Win32
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
|
SolutionGuid = {8602429F-B7C8-4C07-94D2-8DD415A716D8}
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
136
DataStructuresCPP.vcxproj
Normal file
136
DataStructuresCPP.vcxproj
Normal file
@ -0,0 +1,136 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ItemGroup Label="ProjectConfigurations">
|
||||||
|
<ProjectConfiguration Include="Debug|Win32">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|Win32">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Debug|x64">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|x64">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
</ItemGroup>
|
||||||
|
<PropertyGroup Label="Globals">
|
||||||
|
<VCProjectVersion>16.0</VCProjectVersion>
|
||||||
|
<Keyword>Win32Proj</Keyword>
|
||||||
|
<ProjectGuid>{b338a154-a64d-4ada-a276-e12076ac9a15}</ProjectGuid>
|
||||||
|
<RootNamespace>DataStructuresCPP</RootNamespace>
|
||||||
|
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
|
<ImportGroup Label="ExtensionSettings">
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="Shared">
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<PropertyGroup Label="UserMacros" />
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<ConformanceMode>true</ConformanceMode>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<ConformanceMode>true</ConformanceMode>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<ConformanceMode>true</ConformanceMode>
|
||||||
|
<AdditionalIncludeDirectories>$(SolutionDir)DataStructures\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<ConformanceMode>true</ConformanceMode>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="src\main.cpp" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
|
<ImportGroup Label="ExtensionTargets">
|
||||||
|
</ImportGroup>
|
||||||
|
</Project>
|
22
DataStructuresCPP.vcxproj.filters
Normal file
22
DataStructuresCPP.vcxproj.filters
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ItemGroup>
|
||||||
|
<Filter Include="Source Files">
|
||||||
|
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||||
|
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="Header Files">
|
||||||
|
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||||
|
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="Resource Files">
|
||||||
|
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||||
|
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||||
|
</Filter>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="src\main.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
14
src/main.cpp
Normal file
14
src/main.cpp
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
#include <iostream>
|
||||||
|
#include <linkedlist.h>
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
Datastructures::LinkedList<int> list;
|
||||||
|
list.append(5);
|
||||||
|
list.append(200);
|
||||||
|
list.insert(20, 2);
|
||||||
|
std::cout << list.count() << std::endl; //3
|
||||||
|
std::cout << list[0] << list[1] << list[2] << std::endl; //520020
|
||||||
|
list.remove(0);
|
||||||
|
int x = list.find(10);
|
||||||
|
std::cout << list.count() << std::endl; //2
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user