-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
445 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio 2013 | ||
VisualStudioVersion = 12.0.21005.1 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Huffman", "Huffman\Huffman.vcxproj", "{3725C8F0-4679-467E-84E1-AEC9FB4DA576}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Win32 = Debug|Win32 | ||
Release|Win32 = Release|Win32 | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{3725C8F0-4679-467E-84E1-AEC9FB4DA576}.Debug|Win32.ActiveCfg = Debug|Win32 | ||
{3725C8F0-4679-467E-84E1-AEC9FB4DA576}.Debug|Win32.Build.0 = Debug|Win32 | ||
{3725C8F0-4679-467E-84E1-AEC9FB4DA576}.Release|Win32.ActiveCfg = Release|Win32 | ||
{3725C8F0-4679-467E-84E1-AEC9FB4DA576}.Release|Win32.Build.0 = Release|Win32 | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
EndGlobal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project DefaultTargets="Build" ToolsVersion="12.0" 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> | ||
</ItemGroup> | ||
<PropertyGroup Label="Globals"> | ||
<ProjectGuid>{3725C8F0-4679-467E-84E1-AEC9FB4DA576}</ProjectGuid> | ||
<Keyword>Win32Proj</Keyword> | ||
<RootNamespace>Huffman</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> | ||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> | ||
<ImportGroup Label="ExtensionSettings"> | ||
</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> | ||
<PropertyGroup Label="UserMacros" /> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> | ||
<LinkIncremental>true</LinkIncremental> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> | ||
<LinkIncremental>false</LinkIncremental> | ||
</PropertyGroup> | ||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> | ||
<ClCompile> | ||
<PrecompiledHeader> | ||
</PrecompiledHeader> | ||
<WarningLevel>Level3</WarningLevel> | ||
<Optimization>Disabled</Optimization> | ||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||
</ClCompile> | ||
<Link> | ||
<SubSystem>Console</SubSystem> | ||
<GenerateDebugInformation>true</GenerateDebugInformation> | ||
</Link> | ||
</ItemDefinitionGroup> | ||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> | ||
<ClCompile> | ||
<WarningLevel>Level3</WarningLevel> | ||
<PrecompiledHeader> | ||
</PrecompiledHeader> | ||
<Optimization>MaxSpeed</Optimization> | ||
<FunctionLevelLinking>true</FunctionLevelLinking> | ||
<IntrinsicFunctions>true</IntrinsicFunctions> | ||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||
</ClCompile> | ||
<Link> | ||
<SubSystem>Console</SubSystem> | ||
<GenerateDebugInformation>true</GenerateDebugInformation> | ||
<EnableCOMDATFolding>true</EnableCOMDATFolding> | ||
<OptimizeReferences>true</OptimizeReferences> | ||
</Link> | ||
</ItemDefinitionGroup> | ||
<ItemGroup> | ||
<ClCompile Include="LinkList.cpp" /> | ||
<ClCompile Include="main.cpp" /> | ||
<ClCompile Include="SqList.cpp" /> | ||
<ClCompile Include="SqStack.cpp" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ClInclude Include="LinkList.h" /> | ||
<ClInclude Include="SqList.h" /> | ||
<ClInclude Include="SqStack.h" /> | ||
</ItemGroup> | ||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> | ||
<ImportGroup Label="ExtensionTargets"> | ||
</ImportGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<ItemGroup> | ||
<Filter Include="源文件"> | ||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> | ||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> | ||
</Filter> | ||
<Filter Include="头文件"> | ||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> | ||
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions> | ||
</Filter> | ||
<Filter Include="资源文件"> | ||
<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="SqList.cpp"> | ||
<Filter>源文件</Filter> | ||
</ClCompile> | ||
<ClCompile Include="main.cpp"> | ||
<Filter>源文件</Filter> | ||
</ClCompile> | ||
<ClCompile Include="LinkList.cpp"> | ||
<Filter>源文件</Filter> | ||
</ClCompile> | ||
<ClCompile Include="SqStack.cpp"> | ||
<Filter>源文件</Filter> | ||
</ClCompile> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ClInclude Include="SqList.h"> | ||
<Filter>头文件</Filter> | ||
</ClInclude> | ||
<ClInclude Include="LinkList.h"> | ||
<Filter>头文件</Filter> | ||
</ClInclude> | ||
<ClInclude Include="SqStack.h"> | ||
<Filter>头文件</Filter> | ||
</ClInclude> | ||
</ItemGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
#include <stdio.h> | ||
#include <malloc.h> | ||
#include "LinkList.h" | ||
|
||
void LinkDispaly(LinkList L) { //头结点跳过 | ||
//printf("%d ", L->data); | ||
while (L = L->next) | ||
{ | ||
printf("%d ", L->data); | ||
} | ||
} | ||
|
||
void LinkInsert(LinkList L, int i, ElemType e) //有头结点 | ||
{ | ||
if (i<=0) | ||
{ | ||
return ; | ||
} | ||
for (int j = 1; j <= i - 1 && (L = L->next); j++);//&& (L = L->next) | ||
|
||
LinkList s = (LinkList)malloc(sizeof(Lnode)); | ||
|
||
s->data = e; | ||
s->next = L->next; | ||
L->next = s; | ||
|
||
} | ||
|
||
void LinkInit(LinkList& L) { //初始化头结点 | ||
L = (LinkList)malloc(sizeof(Lnode)); | ||
L->next = NULL; | ||
} | ||
|
||
void LinkDelete(LinkList L, int i) { //有头结点 | ||
for (int j = 1; j <= i - 1 && (L = L->next); j++); | ||
LinkList s = L->next; | ||
L->next = s->next; | ||
free(s); | ||
} | ||
|
||
ElemType LinkGet(LinkList L, int i) { //有头结点,i为第几个数,除去头结点 | ||
for (int j = 1; j <= i - 1 && (L = L->next); j++); | ||
if (L->next) | ||
{ | ||
return L->next->data; | ||
} | ||
else | ||
{ | ||
return 0; | ||
} | ||
} | ||
|
||
void LinkCreate(LinkList L, ElemType* array, int n) { //有头结点,头结点data为NULL | ||
for (int i = 0; i <n; i++) | ||
{ | ||
LinkList s = (LinkList)malloc(sizeof(Lnode)); | ||
s->next = L->next; | ||
L->next = s; | ||
s->data = *array; | ||
array++; | ||
L = L->next; | ||
} | ||
} | ||
|
||
void LinkDestroy(LinkList L){ //所有节点释放 | ||
while (L->next) | ||
{ | ||
LinkList s = L; | ||
L = L->next; | ||
free(s); | ||
} | ||
free(L); | ||
} | ||
//int a[10] = { 1,2,3,4,5,6,7,8,9,10 }; | ||
//LinkList L; | ||
//LinkInit(L); | ||
//LinkCreate(L, a, 10); | ||
// | ||
//LinkDispaly(L); | ||
|
||
void PolynominalCreate(Poly L, ElemType* index, ElemType* data, int n){ | ||
L->index = *index; | ||
L->data = *data; | ||
for (int i = 0; i < n; i++) | ||
{ | ||
Poly s = (Poly)malloc(sizeof(Polynominal)); | ||
s->next = L->next; | ||
L->next = s; | ||
s->data = *data; | ||
s->index = *index; | ||
data++; | ||
index++; | ||
L = L->next; | ||
} | ||
} | ||
|
||
void Operate(ElemType one, ElemType two) { | ||
|
||
} | ||
|
||
|
||
void PolynominalOperate(Poly Lone, Poly Ltwo, void(*Operate)(ElemType, ElemType)) { | ||
|
||
} | ||
|
||
void PolynominalDispaly(Poly L) { | ||
printf("%dX%d \n", L->data, L->index); | ||
while (L = L->next) | ||
{ | ||
printf("%dX%d \n",L->data,L->index); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#ifndef SQSTACK_H_INCLUDED | ||
#define SQSTACK_H_INCLUDED | ||
|
||
|
||
typedef int ElemType; | ||
typedef struct Lnode { | ||
ElemType data; | ||
struct Lnode* next; | ||
}Lnode,*LinkList; | ||
|
||
void LinkDispaly(LinkList L); | ||
|
||
void LinkInsert(LinkList L, int i,ElemType e); | ||
|
||
void LinkInit(LinkList& L); | ||
|
||
void LinkDelete(LinkList L, int i); | ||
|
||
ElemType LinkGet(LinkList L, int i); | ||
|
||
void LinkCreate(LinkList L, ElemType* array, int n); | ||
|
||
void LinkDestroy(LinkList L); | ||
|
||
|
||
typedef struct Polynominal | ||
{ | ||
ElemType index; | ||
ElemType data; | ||
struct Polynominal* next; | ||
}Polynominal,*Poly; | ||
|
||
void PolynominalCreate(Poly L,ElemType *index,ElemType*data,int n); | ||
|
||
void Operate(ElemType one, ElemType two); | ||
|
||
|
||
void PolynominalOperate(Poly Lone, Poly Ltwo,void(*Operate)(ElemType,ElemType)); | ||
|
||
void PolynominalDispaly(Poly L); | ||
#endif |
Oops, something went wrong.