mirror of
https://github.com/Ruvikm/Wangdao-Data-Structures.git
synced 2026-06-18 01:19:36 +08:00
线性表部分更新
This commit is contained in:
BIN
线性表/链式实现大题/P40.1/.vs/P40.1/v16/.suo
Normal file
BIN
线性表/链式实现大题/P40.1/.vs/P40.1/v16/.suo
Normal file
Binary file not shown.
BIN
线性表/链式实现大题/P40.1/.vs/P40.1/v16/Browse.VC.db
Normal file
BIN
线性表/链式实现大题/P40.1/.vs/P40.1/v16/Browse.VC.db
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
线性表/链式实现大题/P40.1/Debug/P40.1.exe
Normal file
BIN
线性表/链式实现大题/P40.1/Debug/P40.1.exe
Normal file
Binary file not shown.
11
线性表/链式实现大题/P40.1/Debug/P40.1.exe.recipe
Normal file
11
线性表/链式实现大题/P40.1/Debug/P40.1.exe.recipe
Normal file
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project>
|
||||
<ProjectOutputs>
|
||||
<ProjectOutput>
|
||||
<FullPath>D:\college\code\C(C++)_CODE\考研数据结构\链式实现大题\P40.1\Debug\P40.1.exe</FullPath>
|
||||
</ProjectOutput>
|
||||
</ProjectOutputs>
|
||||
<ContentFiles />
|
||||
<SatelliteDlls />
|
||||
<NonRecipeFileRefs />
|
||||
</Project>
|
||||
BIN
线性表/链式实现大题/P40.1/Debug/P40.1.ilk
Normal file
BIN
线性表/链式实现大题/P40.1/Debug/P40.1.ilk
Normal file
Binary file not shown.
3
线性表/链式实现大题/P40.1/Debug/P40.1.log
Normal file
3
线性表/链式实现大题/P40.1/Debug/P40.1.log
Normal file
@@ -0,0 +1,3 @@
|
||||
P40.1.cpp
|
||||
D:\college\code\C(C++)_CODE\考研数据结构\链式实现大题\P40.1\P40.1.cpp(40,2): warning C4018: '<': signed/unsigned mismatch
|
||||
P40.1.vcxproj -> D:\college\code\C(C++)_CODE\考研数据结构\链式实现大题\P40.1\Debug\P40.1.exe
|
||||
BIN
线性表/链式实现大题/P40.1/Debug/P40.1.obj
Normal file
BIN
线性表/链式实现大题/P40.1/Debug/P40.1.obj
Normal file
Binary file not shown.
BIN
线性表/链式实现大题/P40.1/Debug/P40.1.pdb
Normal file
BIN
线性表/链式实现大题/P40.1/Debug/P40.1.pdb
Normal file
Binary file not shown.
BIN
线性表/链式实现大题/P40.1/Debug/P40.1.tlog/CL.command.1.tlog
Normal file
BIN
线性表/链式实现大题/P40.1/Debug/P40.1.tlog/CL.command.1.tlog
Normal file
Binary file not shown.
BIN
线性表/链式实现大题/P40.1/Debug/P40.1.tlog/CL.read.1.tlog
Normal file
BIN
线性表/链式实现大题/P40.1/Debug/P40.1.tlog/CL.read.1.tlog
Normal file
Binary file not shown.
BIN
线性表/链式实现大题/P40.1/Debug/P40.1.tlog/CL.write.1.tlog
Normal file
BIN
线性表/链式实现大题/P40.1/Debug/P40.1.tlog/CL.write.1.tlog
Normal file
Binary file not shown.
2
线性表/链式实现大题/P40.1/Debug/P40.1.tlog/P40.1.lastbuildstate
Normal file
2
线性表/链式实现大题/P40.1/Debug/P40.1.tlog/P40.1.lastbuildstate
Normal file
@@ -0,0 +1,2 @@
|
||||
PlatformToolSet=v142:VCToolArchitecture=Native32Bit:VCToolsVersion=14.28.29333:TargetPlatformVersion=10.0.18362.0:
|
||||
Debug|Win32|D:\college\code\C(C++)_CODE\考研数据结构\链式实现大题\P40.1\|
|
||||
BIN
线性表/链式实现大题/P40.1/Debug/P40.1.tlog/link.command.1.tlog
Normal file
BIN
线性表/链式实现大题/P40.1/Debug/P40.1.tlog/link.command.1.tlog
Normal file
Binary file not shown.
BIN
线性表/链式实现大题/P40.1/Debug/P40.1.tlog/link.read.1.tlog
Normal file
BIN
线性表/链式实现大题/P40.1/Debug/P40.1.tlog/link.read.1.tlog
Normal file
Binary file not shown.
BIN
线性表/链式实现大题/P40.1/Debug/P40.1.tlog/link.write.1.tlog
Normal file
BIN
线性表/链式实现大题/P40.1/Debug/P40.1.tlog/link.write.1.tlog
Normal file
Binary file not shown.
@@ -0,0 +1,4 @@
|
||||
D:\college\code\C(C++)_CODE\考研数据结构\链式实现大题\1\P40.1\Debug\P40.1.exe
|
||||
D:\college\code\C(C++)_CODE\考研数据结构\链式实现大题\1\P40.1\Debug\P40.1.pdb
|
||||
D:\college\code\C(C++)_CODE\考研数据结构\链式实现大题\P40.1\Debug\P40.1.exe
|
||||
D:\college\code\C(C++)_CODE\考研数据结构\链式实现大题\P40.1\Debug\P40.1.pdb
|
||||
BIN
线性表/链式实现大题/P40.1/Debug/vc142.idb
Normal file
BIN
线性表/链式实现大题/P40.1/Debug/vc142.idb
Normal file
Binary file not shown.
BIN
线性表/链式实现大题/P40.1/Debug/vc142.pdb
Normal file
BIN
线性表/链式实现大题/P40.1/Debug/vc142.pdb
Normal file
Binary file not shown.
85
线性表/链式实现大题/P40.1/P40.1.cpp
Normal file
85
线性表/链式实现大题/P40.1/P40.1.cpp
Normal file
@@ -0,0 +1,85 @@
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
using namespace std;
|
||||
|
||||
//P40.1
|
||||
//没计一个递归算法, 删除不带头结点的单链表中所有值为×的结点
|
||||
|
||||
#define ElemType int
|
||||
#define _for(i,a,b) for(int i=(a);i<(b);i++)
|
||||
|
||||
|
||||
#pragma region 建立不带头结点的链表
|
||||
|
||||
typedef struct LNode {
|
||||
ElemType data;
|
||||
struct LNode* next;
|
||||
}LNode, * LinkList;
|
||||
|
||||
//初始化链表
|
||||
bool InitList(LinkList &L) {
|
||||
L = NULL;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//判断是否为空
|
||||
bool IsEmpty(LinkList L) {
|
||||
return (L == NULL);
|
||||
}
|
||||
|
||||
//使用尾插法建表
|
||||
LinkList CreatList(vector<int> data) {
|
||||
if (data.size() < 1) {
|
||||
return NULL;
|
||||
}
|
||||
//头结点
|
||||
LNode* head = (LinkList)malloc(sizeof(LNode));
|
||||
head->data = data[0];
|
||||
head->next = NULL;
|
||||
LinkList p = head;
|
||||
_for(i, 1, data.size()) {
|
||||
LNode* s = (LinkList)malloc(sizeof(LNode));
|
||||
s->data = data[i];
|
||||
s->next = NULL;
|
||||
p->next = s;
|
||||
p = s;
|
||||
}
|
||||
return head;
|
||||
}
|
||||
//输出链表
|
||||
void PrintList(LinkList list) {
|
||||
while (list != NULL) {
|
||||
printf("%d ", list->data);
|
||||
list = list->next;
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
#pragma endregion
|
||||
|
||||
|
||||
//P40.1
|
||||
void DeleteXNode(LinkList &head, ElemType X) {
|
||||
if (head == NULL) return;
|
||||
if (head->data != X) {
|
||||
return DeleteXNode(head->next, X);
|
||||
}
|
||||
LNode* q = head;
|
||||
head = head->next;
|
||||
delete q;
|
||||
return DeleteXNode(head, X);
|
||||
}
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
vector<int> data{ 2,4,6,4,6,3,6,41 };
|
||||
LinkList head;
|
||||
InitList(head);
|
||||
head = CreatList(data);
|
||||
PrintList(head);
|
||||
DeleteXNode(head, 6);
|
||||
PrintList(head);
|
||||
return 0;
|
||||
}
|
||||
31
线性表/链式实现大题/P40.1/P40.1.sln
Normal file
31
线性表/链式实现大题/P40.1/P40.1.sln
Normal file
@@ -0,0 +1,31 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.30804.86
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "P40.1", "P40.1.vcxproj", "{6FBE2DD3-5938-43F5-8D38-F99BD5C9F83B}"
|
||||
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
|
||||
{6FBE2DD3-5938-43F5-8D38-F99BD5C9F83B}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{6FBE2DD3-5938-43F5-8D38-F99BD5C9F83B}.Debug|x64.Build.0 = Debug|x64
|
||||
{6FBE2DD3-5938-43F5-8D38-F99BD5C9F83B}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{6FBE2DD3-5938-43F5-8D38-F99BD5C9F83B}.Debug|x86.Build.0 = Debug|Win32
|
||||
{6FBE2DD3-5938-43F5-8D38-F99BD5C9F83B}.Release|x64.ActiveCfg = Release|x64
|
||||
{6FBE2DD3-5938-43F5-8D38-F99BD5C9F83B}.Release|x64.Build.0 = Release|x64
|
||||
{6FBE2DD3-5938-43F5-8D38-F99BD5C9F83B}.Release|x86.ActiveCfg = Release|Win32
|
||||
{6FBE2DD3-5938-43F5-8D38-F99BD5C9F83B}.Release|x86.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {003D253E-162B-4239-8D70-04072966FFF5}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
147
线性表/链式实现大题/P40.1/P40.1.vcxproj
Normal file
147
线性表/链式实现大题/P40.1/P40.1.vcxproj
Normal file
@@ -0,0 +1,147 @@
|
||||
<?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>{6fbe2dd3-5938-43f5-8d38-f99bd5c9f83b}</ProjectGuid>
|
||||
<RootNamespace>P401</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>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v142</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" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<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>
|
||||
<ClCompile Include="P40.1.cpp" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
22
线性表/链式实现大题/P40.1/P40.1.vcxproj.filters
Normal file
22
线性表/链式实现大题/P40.1/P40.1.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="P40.1.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
4
线性表/链式实现大题/P40.1/P40.1.vcxproj.user
Normal file
4
线性表/链式实现大题/P40.1/P40.1.vcxproj.user
Normal file
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup />
|
||||
</Project>
|
||||
BIN
线性表/链式实现大题/P40.2/.vs/P40.2/v16/.suo
Normal file
BIN
线性表/链式实现大题/P40.2/.vs/P40.2/v16/.suo
Normal file
Binary file not shown.
BIN
线性表/链式实现大题/P40.2/.vs/P40.2/v16/Browse.VC.db
Normal file
BIN
线性表/链式实现大题/P40.2/.vs/P40.2/v16/Browse.VC.db
Normal file
Binary file not shown.
Binary file not shown.
BIN
线性表/链式实现大题/P40.2/Debug/P40.2.exe
Normal file
BIN
线性表/链式实现大题/P40.2/Debug/P40.2.exe
Normal file
Binary file not shown.
11
线性表/链式实现大题/P40.2/Debug/P40.2.exe.recipe
Normal file
11
线性表/链式实现大题/P40.2/Debug/P40.2.exe.recipe
Normal file
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project>
|
||||
<ProjectOutputs>
|
||||
<ProjectOutput>
|
||||
<FullPath>D:\college\code\C(C++)_CODE\考研数据结构\链式实现大题\P40.2\Debug\P40.2.exe</FullPath>
|
||||
</ProjectOutput>
|
||||
</ProjectOutputs>
|
||||
<ContentFiles />
|
||||
<SatelliteDlls />
|
||||
<NonRecipeFileRefs />
|
||||
</Project>
|
||||
BIN
线性表/链式实现大题/P40.2/Debug/P40.2.ilk
Normal file
BIN
线性表/链式实现大题/P40.2/Debug/P40.2.ilk
Normal file
Binary file not shown.
3
线性表/链式实现大题/P40.2/Debug/P40.2.log
Normal file
3
线性表/链式实现大题/P40.2/Debug/P40.2.log
Normal file
@@ -0,0 +1,3 @@
|
||||
P40.2.cpp
|
||||
D:\college\code\C(C++)_CODE\考研数据结构\链式实现大题\P40.2\P40.2.cpp(47,2): warning C4018: '<': signed/unsigned mismatch
|
||||
P40.2.vcxproj -> D:\college\code\C(C++)_CODE\考研数据结构\链式实现大题\P40.2\Debug\P40.2.exe
|
||||
BIN
线性表/链式实现大题/P40.2/Debug/P40.2.obj
Normal file
BIN
线性表/链式实现大题/P40.2/Debug/P40.2.obj
Normal file
Binary file not shown.
BIN
线性表/链式实现大题/P40.2/Debug/P40.2.pdb
Normal file
BIN
线性表/链式实现大题/P40.2/Debug/P40.2.pdb
Normal file
Binary file not shown.
BIN
线性表/链式实现大题/P40.2/Debug/P40.2.tlog/CL.command.1.tlog
Normal file
BIN
线性表/链式实现大题/P40.2/Debug/P40.2.tlog/CL.command.1.tlog
Normal file
Binary file not shown.
BIN
线性表/链式实现大题/P40.2/Debug/P40.2.tlog/CL.read.1.tlog
Normal file
BIN
线性表/链式实现大题/P40.2/Debug/P40.2.tlog/CL.read.1.tlog
Normal file
Binary file not shown.
BIN
线性表/链式实现大题/P40.2/Debug/P40.2.tlog/CL.write.1.tlog
Normal file
BIN
线性表/链式实现大题/P40.2/Debug/P40.2.tlog/CL.write.1.tlog
Normal file
Binary file not shown.
2
线性表/链式实现大题/P40.2/Debug/P40.2.tlog/P40.2.lastbuildstate
Normal file
2
线性表/链式实现大题/P40.2/Debug/P40.2.tlog/P40.2.lastbuildstate
Normal file
@@ -0,0 +1,2 @@
|
||||
PlatformToolSet=v142:VCToolArchitecture=Native32Bit:VCToolsVersion=14.28.29333:TargetPlatformVersion=10.0.18362.0:
|
||||
Debug|Win32|D:\college\code\C(C++)_CODE\考研数据结构\链式实现大题\P40.2\|
|
||||
BIN
线性表/链式实现大题/P40.2/Debug/P40.2.tlog/link.command.1.tlog
Normal file
BIN
线性表/链式实现大题/P40.2/Debug/P40.2.tlog/link.command.1.tlog
Normal file
Binary file not shown.
BIN
线性表/链式实现大题/P40.2/Debug/P40.2.tlog/link.read.1.tlog
Normal file
BIN
线性表/链式实现大题/P40.2/Debug/P40.2.tlog/link.read.1.tlog
Normal file
Binary file not shown.
BIN
线性表/链式实现大题/P40.2/Debug/P40.2.tlog/link.write.1.tlog
Normal file
BIN
线性表/链式实现大题/P40.2/Debug/P40.2.tlog/link.write.1.tlog
Normal file
Binary file not shown.
@@ -0,0 +1,2 @@
|
||||
D:\college\code\C(C++)_CODE\考研数据结构\链式实现大题\P40.2\Debug\P40.2.exe
|
||||
D:\college\code\C(C++)_CODE\考研数据结构\链式实现大题\P40.2\Debug\P40.2.pdb
|
||||
BIN
线性表/链式实现大题/P40.2/Debug/vc142.idb
Normal file
BIN
线性表/链式实现大题/P40.2/Debug/vc142.idb
Normal file
Binary file not shown.
BIN
线性表/链式实现大题/P40.2/Debug/vc142.pdb
Normal file
BIN
线性表/链式实现大题/P40.2/Debug/vc142.pdb
Normal file
Binary file not shown.
101
线性表/链式实现大题/P40.2/P40.2.cpp
Normal file
101
线性表/链式实现大题/P40.2/P40.2.cpp
Normal file
@@ -0,0 +1,101 @@
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
using namespace std;
|
||||
|
||||
//P40.2
|
||||
//在带头结点的单链表中, 删除所有值为x的结点, 并释放其空间, 假设值为x的结点
|
||||
//不唯一, 试编写算法以实现上述操作
|
||||
|
||||
#define ElemType int
|
||||
#define _for(i,a,b) for(int i=(a);i<(b);i++)
|
||||
|
||||
|
||||
#pragma region 建立带头结点的链表
|
||||
|
||||
typedef struct LNode {
|
||||
ElemType data;
|
||||
struct LNode* next;
|
||||
}LNode, * LinkList;
|
||||
|
||||
//初始化链表
|
||||
bool InitList(LinkList& L) {
|
||||
//分配一个头结点
|
||||
L = (LNode*)malloc(sizeof(LNode));
|
||||
//内存不足,分配失败
|
||||
if (L == NULL) {
|
||||
return false;
|
||||
}
|
||||
//头结点之后暂时还没有节点
|
||||
L->next = NULL;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//判断是否为空
|
||||
bool IsEmpty(LinkList L) {
|
||||
return ((L->next) == NULL);
|
||||
}
|
||||
|
||||
//使用尾插法建表
|
||||
LinkList CreatList(vector<int> data) {
|
||||
if (data.size() < 1) {
|
||||
return NULL;
|
||||
}
|
||||
//头结点
|
||||
LNode* head = (LinkList)malloc(sizeof(LNode));
|
||||
head->data = NULL;
|
||||
head->next = NULL;
|
||||
LinkList p = head;
|
||||
_for(i, 0, data.size()) {
|
||||
LNode* s = (LinkList)malloc(sizeof(LNode));
|
||||
s->data = data[i];
|
||||
s->next = NULL;
|
||||
p->next = s;
|
||||
p = s;
|
||||
}
|
||||
return head;
|
||||
}
|
||||
//输出链表
|
||||
void PrintList(LinkList list) {
|
||||
list = list->next;
|
||||
while (list != NULL) {
|
||||
printf("%d ", list->data);
|
||||
list = list->next;
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
#pragma endregion
|
||||
|
||||
|
||||
//P40.2
|
||||
LinkList DeleteXNode(LinkList &head, ElemType X) {
|
||||
LinkList p = head->next;
|
||||
LinkList q = head;
|
||||
while (p != NULL) {
|
||||
if (p->data == X) {
|
||||
LNode* d = p;
|
||||
q->next = p->next;
|
||||
p = p->next;
|
||||
delete d;
|
||||
}
|
||||
else {
|
||||
q = p;
|
||||
p = p->next;
|
||||
}
|
||||
}
|
||||
return head;
|
||||
}
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
vector<int> data{ 2,4,6,6,6,3,6,41 };
|
||||
LinkList head;
|
||||
InitList(head);
|
||||
head = CreatList(data);
|
||||
PrintList(head);
|
||||
head = DeleteXNode(head, 6);
|
||||
PrintList(head);
|
||||
return 0;
|
||||
}
|
||||
31
线性表/链式实现大题/P40.2/P40.2.sln
Normal file
31
线性表/链式实现大题/P40.2/P40.2.sln
Normal file
@@ -0,0 +1,31 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.30804.86
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "P40.2", "P40.2.vcxproj", "{779EE9C0-7683-4061-AC53-35E5335E189F}"
|
||||
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
|
||||
{779EE9C0-7683-4061-AC53-35E5335E189F}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{779EE9C0-7683-4061-AC53-35E5335E189F}.Debug|x64.Build.0 = Debug|x64
|
||||
{779EE9C0-7683-4061-AC53-35E5335E189F}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{779EE9C0-7683-4061-AC53-35E5335E189F}.Debug|x86.Build.0 = Debug|Win32
|
||||
{779EE9C0-7683-4061-AC53-35E5335E189F}.Release|x64.ActiveCfg = Release|x64
|
||||
{779EE9C0-7683-4061-AC53-35E5335E189F}.Release|x64.Build.0 = Release|x64
|
||||
{779EE9C0-7683-4061-AC53-35E5335E189F}.Release|x86.ActiveCfg = Release|Win32
|
||||
{779EE9C0-7683-4061-AC53-35E5335E189F}.Release|x86.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {DA1417F4-DD79-4843-8BE9-3F4186D7A991}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
147
线性表/链式实现大题/P40.2/P40.2.vcxproj
Normal file
147
线性表/链式实现大题/P40.2/P40.2.vcxproj
Normal file
@@ -0,0 +1,147 @@
|
||||
<?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>{779ee9c0-7683-4061-ac53-35e5335e189f}</ProjectGuid>
|
||||
<RootNamespace>P402</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>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v142</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" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<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>
|
||||
<ClCompile Include="P40.2.cpp" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
22
线性表/链式实现大题/P40.2/P40.2.vcxproj.filters
Normal file
22
线性表/链式实现大题/P40.2/P40.2.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="P40.2.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
4
线性表/链式实现大题/P40.2/P40.2.vcxproj.user
Normal file
4
线性表/链式实现大题/P40.2/P40.2.vcxproj.user
Normal file
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup />
|
||||
</Project>
|
||||
BIN
线性表/链式实现大题/P40.3/.vs/P40.3/v16/.suo
Normal file
BIN
线性表/链式实现大题/P40.3/.vs/P40.3/v16/.suo
Normal file
Binary file not shown.
BIN
线性表/链式实现大题/P40.3/.vs/P40.3/v16/Browse.VC.db
Normal file
BIN
线性表/链式实现大题/P40.3/.vs/P40.3/v16/Browse.VC.db
Normal file
Binary file not shown.
Binary file not shown.
BIN
线性表/链式实现大题/P40.3/Debug/P40.3.exe
Normal file
BIN
线性表/链式实现大题/P40.3/Debug/P40.3.exe
Normal file
Binary file not shown.
11
线性表/链式实现大题/P40.3/Debug/P40.3.exe.recipe
Normal file
11
线性表/链式实现大题/P40.3/Debug/P40.3.exe.recipe
Normal file
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project>
|
||||
<ProjectOutputs>
|
||||
<ProjectOutput>
|
||||
<FullPath>D:\college\code\C(C++)_CODE\考研数据结构\链式实现大题\P40.3\Debug\P40.3.exe</FullPath>
|
||||
</ProjectOutput>
|
||||
</ProjectOutputs>
|
||||
<ContentFiles />
|
||||
<SatelliteDlls />
|
||||
<NonRecipeFileRefs />
|
||||
</Project>
|
||||
BIN
线性表/链式实现大题/P40.3/Debug/P40.3.ilk
Normal file
BIN
线性表/链式实现大题/P40.3/Debug/P40.3.ilk
Normal file
Binary file not shown.
3
线性表/链式实现大题/P40.3/Debug/P40.3.log
Normal file
3
线性表/链式实现大题/P40.3/Debug/P40.3.log
Normal file
@@ -0,0 +1,3 @@
|
||||
P40.3.cpp
|
||||
D:\college\code\C(C++)_CODE\考研数据结构\链式实现大题\P40.3\P40.3.cpp(47,2): warning C4018: '<': signed/unsigned mismatch
|
||||
P40.3.vcxproj -> D:\college\code\C(C++)_CODE\考研数据结构\链式实现大题\P40.3\Debug\P40.3.exe
|
||||
BIN
线性表/链式实现大题/P40.3/Debug/P40.3.obj
Normal file
BIN
线性表/链式实现大题/P40.3/Debug/P40.3.obj
Normal file
Binary file not shown.
BIN
线性表/链式实现大题/P40.3/Debug/P40.3.pdb
Normal file
BIN
线性表/链式实现大题/P40.3/Debug/P40.3.pdb
Normal file
Binary file not shown.
BIN
线性表/链式实现大题/P40.3/Debug/P40.3.tlog/CL.command.1.tlog
Normal file
BIN
线性表/链式实现大题/P40.3/Debug/P40.3.tlog/CL.command.1.tlog
Normal file
Binary file not shown.
BIN
线性表/链式实现大题/P40.3/Debug/P40.3.tlog/CL.read.1.tlog
Normal file
BIN
线性表/链式实现大题/P40.3/Debug/P40.3.tlog/CL.read.1.tlog
Normal file
Binary file not shown.
BIN
线性表/链式实现大题/P40.3/Debug/P40.3.tlog/CL.write.1.tlog
Normal file
BIN
线性表/链式实现大题/P40.3/Debug/P40.3.tlog/CL.write.1.tlog
Normal file
Binary file not shown.
2
线性表/链式实现大题/P40.3/Debug/P40.3.tlog/P40.3.lastbuildstate
Normal file
2
线性表/链式实现大题/P40.3/Debug/P40.3.tlog/P40.3.lastbuildstate
Normal file
@@ -0,0 +1,2 @@
|
||||
PlatformToolSet=v142:VCToolArchitecture=Native32Bit:VCToolsVersion=14.28.29333:TargetPlatformVersion=10.0.18362.0:
|
||||
Debug|Win32|D:\college\code\C(C++)_CODE\考研数据结构\链式实现大题\P40.3\|
|
||||
BIN
线性表/链式实现大题/P40.3/Debug/P40.3.tlog/link.command.1.tlog
Normal file
BIN
线性表/链式实现大题/P40.3/Debug/P40.3.tlog/link.command.1.tlog
Normal file
Binary file not shown.
BIN
线性表/链式实现大题/P40.3/Debug/P40.3.tlog/link.read.1.tlog
Normal file
BIN
线性表/链式实现大题/P40.3/Debug/P40.3.tlog/link.read.1.tlog
Normal file
Binary file not shown.
BIN
线性表/链式实现大题/P40.3/Debug/P40.3.tlog/link.write.1.tlog
Normal file
BIN
线性表/链式实现大题/P40.3/Debug/P40.3.tlog/link.write.1.tlog
Normal file
Binary file not shown.
@@ -0,0 +1,2 @@
|
||||
D:\college\code\C(C++)_CODE\考研数据结构\链式实现大题\P40.3\Debug\P40.3.exe
|
||||
D:\college\code\C(C++)_CODE\考研数据结构\链式实现大题\P40.3\Debug\P40.3.pdb
|
||||
BIN
线性表/链式实现大题/P40.3/Debug/vc142.idb
Normal file
BIN
线性表/链式实现大题/P40.3/Debug/vc142.idb
Normal file
Binary file not shown.
BIN
线性表/链式实现大题/P40.3/Debug/vc142.pdb
Normal file
BIN
线性表/链式实现大题/P40.3/Debug/vc142.pdb
Normal file
Binary file not shown.
86
线性表/链式实现大题/P40.3/P40.3.cpp
Normal file
86
线性表/链式实现大题/P40.3/P40.3.cpp
Normal file
@@ -0,0 +1,86 @@
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
using namespace std;
|
||||
|
||||
//P40.3
|
||||
//设L为带头结点的单链表,编写算法实现从尾到头反向输出每个结点的值
|
||||
#define ElemType int
|
||||
#define _for(i,a,b) for(int i=(a);i<(b);i++)
|
||||
|
||||
|
||||
#pragma region 建立带头结点的链表
|
||||
|
||||
typedef struct LNode {
|
||||
ElemType data;
|
||||
struct LNode* next;
|
||||
}LNode, * LinkList;
|
||||
|
||||
//初始化链表
|
||||
bool InitList(LinkList& L) {
|
||||
//分配一个头结点
|
||||
L = (LNode*)malloc(sizeof(LNode));
|
||||
//内存不足,分配失败
|
||||
if (L == NULL) {
|
||||
return false;
|
||||
}
|
||||
//头结点之后暂时还没有节点
|
||||
L->next = NULL;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//判断是否为空
|
||||
bool IsEmpty(LinkList L) {
|
||||
return ((L->next) == NULL);
|
||||
}
|
||||
|
||||
//使用尾插法建表
|
||||
LinkList CreatList(vector<int> data) {
|
||||
if (data.size() < 1) {
|
||||
return NULL;
|
||||
}
|
||||
//头结点
|
||||
LNode* head = (LinkList)malloc(sizeof(LNode));
|
||||
head->data = NULL;
|
||||
head->next = NULL;
|
||||
LinkList p = head;
|
||||
_for(i, 0, data.size()) {
|
||||
LNode* s = (LinkList)malloc(sizeof(LNode));
|
||||
s->data = data[i];
|
||||
s->next = NULL;
|
||||
p->next = s;
|
||||
p = s;
|
||||
}
|
||||
return head;
|
||||
}
|
||||
//输出链表
|
||||
void PrintList(LinkList list) {
|
||||
while (list != NULL) {
|
||||
printf("%d ", list->data);
|
||||
list = list->next;
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
#pragma endregion
|
||||
|
||||
|
||||
//P40.3
|
||||
void ReversePrint(LinkList L) {
|
||||
if (L->next != NULL) {
|
||||
ReversePrint(L->next);
|
||||
}
|
||||
cout << L->data<<" ";
|
||||
}
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
vector<int> data{ 2,4,5,6,7,3,6,41 };
|
||||
LinkList head;
|
||||
InitList(head);
|
||||
head = CreatList(data);
|
||||
PrintList(head->next);
|
||||
ReversePrint(head->next);
|
||||
return 0;
|
||||
}
|
||||
31
线性表/链式实现大题/P40.3/P40.3.sln
Normal file
31
线性表/链式实现大题/P40.3/P40.3.sln
Normal file
@@ -0,0 +1,31 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.30804.86
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "P40.3", "P40.3.vcxproj", "{B2ECE814-0B47-448D-934C-C8EC0116E7B1}"
|
||||
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
|
||||
{B2ECE814-0B47-448D-934C-C8EC0116E7B1}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{B2ECE814-0B47-448D-934C-C8EC0116E7B1}.Debug|x64.Build.0 = Debug|x64
|
||||
{B2ECE814-0B47-448D-934C-C8EC0116E7B1}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{B2ECE814-0B47-448D-934C-C8EC0116E7B1}.Debug|x86.Build.0 = Debug|Win32
|
||||
{B2ECE814-0B47-448D-934C-C8EC0116E7B1}.Release|x64.ActiveCfg = Release|x64
|
||||
{B2ECE814-0B47-448D-934C-C8EC0116E7B1}.Release|x64.Build.0 = Release|x64
|
||||
{B2ECE814-0B47-448D-934C-C8EC0116E7B1}.Release|x86.ActiveCfg = Release|Win32
|
||||
{B2ECE814-0B47-448D-934C-C8EC0116E7B1}.Release|x86.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {6E3E5E65-9B5F-49A5-A975-A21403A19A30}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
147
线性表/链式实现大题/P40.3/P40.3.vcxproj
Normal file
147
线性表/链式实现大题/P40.3/P40.3.vcxproj
Normal file
@@ -0,0 +1,147 @@
|
||||
<?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>{b2ece814-0b47-448d-934c-c8ec0116e7b1}</ProjectGuid>
|
||||
<RootNamespace>P403</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>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v142</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" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<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>
|
||||
<ClCompile Include="P40.3.cpp" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
22
线性表/链式实现大题/P40.3/P40.3.vcxproj.filters
Normal file
22
线性表/链式实现大题/P40.3/P40.3.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="P40.3.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
4
线性表/链式实现大题/P40.3/P40.3.vcxproj.user
Normal file
4
线性表/链式实现大题/P40.3/P40.3.vcxproj.user
Normal file
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup />
|
||||
</Project>
|
||||
BIN
线性表/链式实现大题/P40.4/.vs/P40.4/v16/.suo
Normal file
BIN
线性表/链式实现大题/P40.4/.vs/P40.4/v16/.suo
Normal file
Binary file not shown.
BIN
线性表/链式实现大题/P40.4/.vs/P40.4/v16/Browse.VC.db
Normal file
BIN
线性表/链式实现大题/P40.4/.vs/P40.4/v16/Browse.VC.db
Normal file
Binary file not shown.
Binary file not shown.
BIN
线性表/链式实现大题/P40.4/Debug/P40.4.exe
Normal file
BIN
线性表/链式实现大题/P40.4/Debug/P40.4.exe
Normal file
Binary file not shown.
11
线性表/链式实现大题/P40.4/Debug/P40.4.exe.recipe
Normal file
11
线性表/链式实现大题/P40.4/Debug/P40.4.exe.recipe
Normal file
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project>
|
||||
<ProjectOutputs>
|
||||
<ProjectOutput>
|
||||
<FullPath>D:\college\code\C(C++)_CODE\考研数据结构\链式实现大题\P40.4\Debug\P40.4.exe</FullPath>
|
||||
</ProjectOutput>
|
||||
</ProjectOutputs>
|
||||
<ContentFiles />
|
||||
<SatelliteDlls />
|
||||
<NonRecipeFileRefs />
|
||||
</Project>
|
||||
BIN
线性表/链式实现大题/P40.4/Debug/P40.4.ilk
Normal file
BIN
线性表/链式实现大题/P40.4/Debug/P40.4.ilk
Normal file
Binary file not shown.
3
线性表/链式实现大题/P40.4/Debug/P40.4.log
Normal file
3
线性表/链式实现大题/P40.4/Debug/P40.4.log
Normal file
@@ -0,0 +1,3 @@
|
||||
P40.4.cpp
|
||||
D:\college\code\C(C++)_CODE\考研数据结构\链式实现大题\P40.4\P40.4.cpp(47,2): warning C4018: '<': signed/unsigned mismatch
|
||||
P40.4.vcxproj -> D:\college\code\C(C++)_CODE\考研数据结构\链式实现大题\P40.4\Debug\P40.4.exe
|
||||
BIN
线性表/链式实现大题/P40.4/Debug/P40.4.obj
Normal file
BIN
线性表/链式实现大题/P40.4/Debug/P40.4.obj
Normal file
Binary file not shown.
BIN
线性表/链式实现大题/P40.4/Debug/P40.4.pdb
Normal file
BIN
线性表/链式实现大题/P40.4/Debug/P40.4.pdb
Normal file
Binary file not shown.
BIN
线性表/链式实现大题/P40.4/Debug/P40.4.tlog/CL.command.1.tlog
Normal file
BIN
线性表/链式实现大题/P40.4/Debug/P40.4.tlog/CL.command.1.tlog
Normal file
Binary file not shown.
BIN
线性表/链式实现大题/P40.4/Debug/P40.4.tlog/CL.read.1.tlog
Normal file
BIN
线性表/链式实现大题/P40.4/Debug/P40.4.tlog/CL.read.1.tlog
Normal file
Binary file not shown.
BIN
线性表/链式实现大题/P40.4/Debug/P40.4.tlog/CL.write.1.tlog
Normal file
BIN
线性表/链式实现大题/P40.4/Debug/P40.4.tlog/CL.write.1.tlog
Normal file
Binary file not shown.
2
线性表/链式实现大题/P40.4/Debug/P40.4.tlog/P40.4.lastbuildstate
Normal file
2
线性表/链式实现大题/P40.4/Debug/P40.4.tlog/P40.4.lastbuildstate
Normal file
@@ -0,0 +1,2 @@
|
||||
PlatformToolSet=v142:VCToolArchitecture=Native32Bit:VCToolsVersion=14.28.29333:TargetPlatformVersion=10.0.18362.0:
|
||||
Debug|Win32|D:\college\code\C(C++)_CODE\考研数据结构\链式实现大题\P40.4\|
|
||||
BIN
线性表/链式实现大题/P40.4/Debug/P40.4.tlog/link.command.1.tlog
Normal file
BIN
线性表/链式实现大题/P40.4/Debug/P40.4.tlog/link.command.1.tlog
Normal file
Binary file not shown.
BIN
线性表/链式实现大题/P40.4/Debug/P40.4.tlog/link.read.1.tlog
Normal file
BIN
线性表/链式实现大题/P40.4/Debug/P40.4.tlog/link.read.1.tlog
Normal file
Binary file not shown.
BIN
线性表/链式实现大题/P40.4/Debug/P40.4.tlog/link.write.1.tlog
Normal file
BIN
线性表/链式实现大题/P40.4/Debug/P40.4.tlog/link.write.1.tlog
Normal file
Binary file not shown.
@@ -0,0 +1,2 @@
|
||||
D:\college\code\C(C++)_CODE\考研数据结构\链式实现大题\P40.4\Debug\P40.4.exe
|
||||
D:\college\code\C(C++)_CODE\考研数据结构\链式实现大题\P40.4\Debug\P40.4.pdb
|
||||
BIN
线性表/链式实现大题/P40.4/Debug/vc142.idb
Normal file
BIN
线性表/链式实现大题/P40.4/Debug/vc142.idb
Normal file
Binary file not shown.
BIN
线性表/链式实现大题/P40.4/Debug/vc142.pdb
Normal file
BIN
线性表/链式实现大题/P40.4/Debug/vc142.pdb
Normal file
Binary file not shown.
101
线性表/链式实现大题/P40.4/P40.4.cpp
Normal file
101
线性表/链式实现大题/P40.4/P40.4.cpp
Normal file
@@ -0,0 +1,101 @@
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
using namespace std;
|
||||
|
||||
//P40.4
|
||||
//试编写在带头结点的单链表中删除一个最小值结点的高效算法(假设最小值结点是唯一的)
|
||||
#define ElemType int
|
||||
#define _for(i,a,b) for(int i=(a);i<(b);i++)
|
||||
#define INF 0x3f3f3f3f
|
||||
|
||||
#pragma region 建立带头结点的链表
|
||||
|
||||
typedef struct LNode {
|
||||
ElemType data;
|
||||
struct LNode* next;
|
||||
}LNode, * LinkList;
|
||||
|
||||
//初始化链表
|
||||
bool InitList(LinkList& L) {
|
||||
//分配一个头结点
|
||||
L = (LNode*)malloc(sizeof(LNode));
|
||||
//内存不足,分配失败
|
||||
if (L == NULL) {
|
||||
return false;
|
||||
}
|
||||
//头结点之后暂时还没有节点
|
||||
L->next = NULL;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//判断是否为空
|
||||
bool IsEmpty(LinkList L) {
|
||||
return ((L->next) == NULL);
|
||||
}
|
||||
|
||||
//使用尾插法建表
|
||||
LinkList CreatList(vector<int> data) {
|
||||
if (data.size() < 1) {
|
||||
return NULL;
|
||||
}
|
||||
//头结点
|
||||
LNode* head = (LinkList)malloc(sizeof(LNode));
|
||||
head->data = NULL;
|
||||
head->next = NULL;
|
||||
LinkList p = head;
|
||||
_for(i, 0, data.size()) {
|
||||
LNode* s = (LinkList)malloc(sizeof(LNode));
|
||||
s->data = data[i];
|
||||
s->next = NULL;
|
||||
p->next = s;
|
||||
p = s;
|
||||
}
|
||||
return head;
|
||||
}
|
||||
//输出链表
|
||||
void PrintList(LinkList list) {
|
||||
list = list->next;
|
||||
while (list != NULL) {
|
||||
printf("%d ", list->data);
|
||||
list = list->next;
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
#pragma endregion
|
||||
|
||||
|
||||
//P40.4
|
||||
void DelMinNode(LinkList& head) {
|
||||
LNode* p = head->next;
|
||||
LNode* q = head;
|
||||
LNode* Minq = q, * Minp = p;
|
||||
while (p != NULL) {
|
||||
if (p->data < Minp->data) {
|
||||
Minp = p;
|
||||
Minq = q;
|
||||
}
|
||||
else {
|
||||
q = p;
|
||||
p = p->next;
|
||||
}
|
||||
}
|
||||
LNode* X = Minp;
|
||||
Minq->next = Minp->next;
|
||||
Minp = Minp->next;
|
||||
delete X;
|
||||
}
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
vector<int> data{ 3,4,6,8,1,3,9,5 };
|
||||
LinkList head;
|
||||
InitList(head);
|
||||
head = CreatList(data);
|
||||
PrintList(head);
|
||||
DelMinNode(head);
|
||||
PrintList(head);
|
||||
return 0;
|
||||
}
|
||||
31
线性表/链式实现大题/P40.4/P40.4.sln
Normal file
31
线性表/链式实现大题/P40.4/P40.4.sln
Normal file
@@ -0,0 +1,31 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.30804.86
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "P40.4", "P40.4.vcxproj", "{55A5D37F-4534-476C-82DF-42F0130AE213}"
|
||||
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
|
||||
{55A5D37F-4534-476C-82DF-42F0130AE213}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{55A5D37F-4534-476C-82DF-42F0130AE213}.Debug|x64.Build.0 = Debug|x64
|
||||
{55A5D37F-4534-476C-82DF-42F0130AE213}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{55A5D37F-4534-476C-82DF-42F0130AE213}.Debug|x86.Build.0 = Debug|Win32
|
||||
{55A5D37F-4534-476C-82DF-42F0130AE213}.Release|x64.ActiveCfg = Release|x64
|
||||
{55A5D37F-4534-476C-82DF-42F0130AE213}.Release|x64.Build.0 = Release|x64
|
||||
{55A5D37F-4534-476C-82DF-42F0130AE213}.Release|x86.ActiveCfg = Release|Win32
|
||||
{55A5D37F-4534-476C-82DF-42F0130AE213}.Release|x86.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {8C88FE1B-391D-498C-A87F-D6373F09E3BE}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
147
线性表/链式实现大题/P40.4/P40.4.vcxproj
Normal file
147
线性表/链式实现大题/P40.4/P40.4.vcxproj
Normal file
@@ -0,0 +1,147 @@
|
||||
<?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>{55a5d37f-4534-476c-82df-42f0130ae213}</ProjectGuid>
|
||||
<RootNamespace>P404</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>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v142</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" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<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>
|
||||
<ClCompile Include="P40.4.cpp" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
22
线性表/链式实现大题/P40.4/P40.4.vcxproj.filters
Normal file
22
线性表/链式实现大题/P40.4/P40.4.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="P40.4.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
4
线性表/链式实现大题/P40.4/P40.4.vcxproj.user
Normal file
4
线性表/链式实现大题/P40.4/P40.4.vcxproj.user
Normal file
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup />
|
||||
</Project>
|
||||
BIN
线性表/链式实现大题/P40.5/.vs/P40.5/v16/.suo
Normal file
BIN
线性表/链式实现大题/P40.5/.vs/P40.5/v16/.suo
Normal file
Binary file not shown.
BIN
线性表/链式实现大题/P40.5/.vs/P40.5/v16/Browse.VC.db
Normal file
BIN
线性表/链式实现大题/P40.5/.vs/P40.5/v16/Browse.VC.db
Normal file
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user