summaryrefslogtreecommitdiff
path: root/PlaygroundCpp
diff options
context:
space:
mode:
Diffstat (limited to 'PlaygroundCpp')
-rw-r--r--PlaygroundCpp/.cproject418
-rw-r--r--PlaygroundCpp/.project2
-rw-r--r--PlaygroundCpp/.settings/language.settings.xml67
-rw-r--r--PlaygroundCpp/Sources/Playground.cpp88
4 files changed, 225 insertions, 350 deletions
diff --git a/PlaygroundCpp/.cproject b/PlaygroundCpp/.cproject
index 83e6d3d..5a9934f 100644
--- a/PlaygroundCpp/.cproject
+++ b/PlaygroundCpp/.cproject
@@ -1,282 +1,142 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
-
- <storageModule moduleId="org.eclipse.cdt.core.settings">
-
- <cconfiguration id="cdt.managedbuild.config.gnu.exe.debug.854788432">
-
- <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.exe.debug.854788432" moduleId="org.eclipse.cdt.core.settings" name="Debug">
-
- <externalSettings/>
-
- <extensions>
-
- <extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
-
- <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-
- <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-
- <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-
- <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
-
- <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-
- </extensions>
-
- </storageModule>
-
- <storageModule moduleId="cdtBuildSystem" version="4.0.0">
-
- <configuration artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe,org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.exe.debug.854788432" name="Debug" parent="cdt.managedbuild.config.gnu.exe.debug">
-
- <folderInfo id="cdt.managedbuild.config.gnu.exe.debug.854788432." name="/" resourcePath="">
-
- <toolChain id="cdt.managedbuild.toolchain.gnu.exe.debug.707029799" name="Linux GCC" superClass="cdt.managedbuild.toolchain.gnu.exe.debug">
-
- <targetPlatform id="cdt.managedbuild.target.gnu.platform.exe.debug.116540349" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.exe.debug"/>
-
- <builder buildPath="${workspace_loc:/PlaygroundCpp}/Debug" id="cdt.managedbuild.target.gnu.builder.exe.debug.1843014306" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="cdt.managedbuild.target.gnu.builder.exe.debug"/>
-
- <tool id="cdt.managedbuild.tool.gnu.archiver.base.2083142981" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.base"/>
-
- <tool id="cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug.812073924" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug">
-
- <option id="gnu.cpp.compiler.exe.debug.option.optimization.level.639997264" name="Optimization Level" superClass="gnu.cpp.compiler.exe.debug.option.optimization.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/>
-
- <option id="gnu.cpp.compiler.exe.debug.option.debugging.level.431750314" name="Debug Level" superClass="gnu.cpp.compiler.exe.debug.option.debugging.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.debugging.level.max" valueType="enumerated"/>
-
- <inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.1870505499" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
-
- </tool>
-
- <tool id="cdt.managedbuild.tool.gnu.c.compiler.exe.debug.868207749" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.exe.debug">
-
- <option defaultValue="gnu.c.optimization.level.none" id="gnu.c.compiler.exe.debug.option.optimization.level.2108681528" name="Optimization Level" superClass="gnu.c.compiler.exe.debug.option.optimization.level" useByScannerDiscovery="false" valueType="enumerated"/>
-
- <option id="gnu.c.compiler.exe.debug.option.debugging.level.561344640" name="Debug Level" superClass="gnu.c.compiler.exe.debug.option.debugging.level" useByScannerDiscovery="false" value="gnu.c.debugging.level.max" valueType="enumerated"/>
-
- <inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.1371005084" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
-
- </tool>
-
- <tool id="cdt.managedbuild.tool.gnu.c.linker.exe.debug.1306453908" name="GCC C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.exe.debug"/>
-
- <tool id="cdt.managedbuild.tool.gnu.cpp.linker.exe.debug.1593738472" name="GCC C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.exe.debug">
-
- <option id="gnu.cpp.link.option.paths.1593365739" name="Library search path (-L)" superClass="gnu.cpp.link.option.paths" valueType="libPaths">
-
- <listOptionValue builtIn="false" value="/home/haidong/googletest/build/googlemock/gtest"/>
-
- </option>
-
- <option id="gnu.cpp.link.option.libs.2046973616" name="Libraries (-l)" superClass="gnu.cpp.link.option.libs" valueType="libs">
-
- <listOptionValue builtIn="false" srcPrefixMapping="" srcRootPath="" value="gtest"/>
-
- <listOptionValue builtIn="false" srcPrefixMapping="" srcRootPath="" value="gtest_main"/>
-
- </option>
-
- <inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.1967757968" superClass="cdt.managedbuild.tool.gnu.cpp.linker.input">
-
- <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
-
- <additionalInput kind="additionalinput" paths="$(LIBS)"/>
-
- </inputType>
-
- </tool>
-
- <tool id="cdt.managedbuild.tool.gnu.assembler.exe.debug.183585801" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.exe.debug">
-
- <option id="gnu.both.asm.option.include.paths.1592126793" name="Include paths (-I)" superClass="gnu.both.asm.option.include.paths" valueType="includePath">
-
- <listOptionValue builtIn="false" value="/home/haidong/googletest/googletest/include"/>
-
- </option>
-
- <inputType id="cdt.managedbuild.tool.gnu.assembler.input.641163583" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
-
- </tool>
-
- </toolChain>
-
- </folderInfo>
-
- <sourceEntries>
-
- <entry excluding="Sources" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
-
- <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="Sources"/>
-
- </sourceEntries>
-
- </configuration>
-
- </storageModule>
-
- <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
-
- </cconfiguration>
-
- <cconfiguration id="cdt.managedbuild.config.gnu.exe.release.1819242823">
-
- <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.exe.release.1819242823" moduleId="org.eclipse.cdt.core.settings" name="Release">
-
- <externalSettings/>
-
- <extensions>
-
- <extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
-
- <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-
- <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-
- <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-
- <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
-
- <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-
- </extensions>
-
- </storageModule>
-
- <storageModule moduleId="cdtBuildSystem" version="4.0.0">
-
- <configuration artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe,org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.release" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.exe.release.1819242823" name="Release" parent="cdt.managedbuild.config.gnu.exe.release">
-
- <folderInfo id="cdt.managedbuild.config.gnu.exe.release.1819242823." name="/" resourcePath="">
-
- <toolChain id="cdt.managedbuild.toolchain.gnu.exe.release.1654992273" name="Linux GCC" superClass="cdt.managedbuild.toolchain.gnu.exe.release">
-
- <targetPlatform id="cdt.managedbuild.target.gnu.platform.exe.release.500125802" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.exe.release"/>
-
- <builder buildPath="${workspace_loc:/PlaygroundCpp}/Release" id="cdt.managedbuild.target.gnu.builder.exe.release.340698914" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="cdt.managedbuild.target.gnu.builder.exe.release"/>
-
- <tool id="cdt.managedbuild.tool.gnu.archiver.base.528694398" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.base"/>
-
- <tool id="cdt.managedbuild.tool.gnu.cpp.compiler.exe.release.1124698867" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.exe.release">
-
- <option id="gnu.cpp.compiler.exe.release.option.optimization.level.1708013044" name="Optimization Level" superClass="gnu.cpp.compiler.exe.release.option.optimization.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.optimization.level.most" valueType="enumerated"/>
-
- <option id="gnu.cpp.compiler.exe.release.option.debugging.level.1937224406" name="Debug Level" superClass="gnu.cpp.compiler.exe.release.option.debugging.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.debugging.level.none" valueType="enumerated"/>
-
- <inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.1112690290" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
-
- </tool>
-
- <tool id="cdt.managedbuild.tool.gnu.c.compiler.exe.release.844310552" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.exe.release">
-
- <option defaultValue="gnu.c.optimization.level.most" id="gnu.c.compiler.exe.release.option.optimization.level.1779597296" name="Optimization Level" superClass="gnu.c.compiler.exe.release.option.optimization.level" useByScannerDiscovery="false" valueType="enumerated"/>
-
- <option id="gnu.c.compiler.exe.release.option.debugging.level.766030980" name="Debug Level" superClass="gnu.c.compiler.exe.release.option.debugging.level" useByScannerDiscovery="false" value="gnu.c.debugging.level.none" valueType="enumerated"/>
-
- <inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.496248817" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
-
- </tool>
-
- <tool id="cdt.managedbuild.tool.gnu.c.linker.exe.release.1355856436" name="GCC C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.exe.release"/>
-
- <tool id="cdt.managedbuild.tool.gnu.cpp.linker.exe.release.1951039164" name="GCC C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.exe.release">
-
- <inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.1750963769" superClass="cdt.managedbuild.tool.gnu.cpp.linker.input">
-
- <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
-
- <additionalInput kind="additionalinput" paths="$(LIBS)"/>
-
- </inputType>
-
- </tool>
-
- <tool id="cdt.managedbuild.tool.gnu.assembler.exe.release.238089210" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.exe.release">
-
- <inputType id="cdt.managedbuild.tool.gnu.assembler.input.1253971676" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
-
- </tool>
-
- </toolChain>
-
- </folderInfo>
-
- <sourceEntries>
-
- <entry excluding="Sources" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
-
- <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="Sources"/>
-
- </sourceEntries>
-
- </configuration>
-
- </storageModule>
-
- <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
-
- </cconfiguration>
-
- </storageModule>
-
- <storageModule moduleId="cdtBuildSystem" version="4.0.0">
-
- <project id="PlaygroundCpp.cdt.managedbuild.target.gnu.exe.2094636372" name="Executable" projectType="cdt.managedbuild.target.gnu.exe"/>
-
- </storageModule>
-
- <storageModule moduleId="scannerConfiguration">
-
- <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
-
- <scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.exe.debug.854788432;cdt.managedbuild.config.gnu.exe.debug.854788432.;cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug.812073924;cdt.managedbuild.tool.gnu.cpp.compiler.input.1870505499">
-
- <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
-
- </scannerConfigBuildInfo>
-
- <scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.exe.release.1819242823;cdt.managedbuild.config.gnu.exe.release.1819242823.;cdt.managedbuild.tool.gnu.cpp.compiler.exe.release.1124698867;cdt.managedbuild.tool.gnu.cpp.compiler.input.1112690290">
-
- <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
-
- </scannerConfigBuildInfo>
-
- <scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.exe.release.1819242823;cdt.managedbuild.config.gnu.exe.release.1819242823.;cdt.managedbuild.tool.gnu.c.compiler.exe.release.844310552;cdt.managedbuild.tool.gnu.c.compiler.input.496248817">
-
- <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
-
- </scannerConfigBuildInfo>
-
- <scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.exe.debug.854788432;cdt.managedbuild.config.gnu.exe.debug.854788432.;cdt.managedbuild.tool.gnu.c.compiler.exe.debug.868207749;cdt.managedbuild.tool.gnu.c.compiler.input.1371005084">
-
- <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
-
- </scannerConfigBuildInfo>
-
- </storageModule>
-
- <storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
-
- <storageModule moduleId="refreshScope" versionNumber="2">
-
- <configuration configurationName="Debug">
-
- <resource resourceType="PROJECT" workspacePath="/PlaygroundCpp"/>
-
- </configuration>
-
- <configuration configurationName="Release">
-
- <resource resourceType="PROJECT" workspacePath="/PlaygroundCpp"/>
-
- </configuration>
-
- </storageModule>
-
- <storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"/>
-
- <storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>
-
+ <storageModule moduleId="org.eclipse.cdt.core.settings">
+ <cconfiguration id="cdt.managedbuild.config.gnu.exe.debug.854788432">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.exe.debug.854788432" moduleId="org.eclipse.cdt.core.settings" name="Debug">
+ <externalSettings/>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe,org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.exe.debug.854788432" name="Debug" parent="cdt.managedbuild.config.gnu.exe.debug">
+ <folderInfo id="cdt.managedbuild.config.gnu.exe.debug.854788432." name="/" resourcePath="">
+ <toolChain id="cdt.managedbuild.toolchain.gnu.exe.debug.707029799" name="Linux GCC" superClass="cdt.managedbuild.toolchain.gnu.exe.debug">
+ <targetPlatform id="cdt.managedbuild.target.gnu.platform.exe.debug.116540349" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.exe.debug"/>
+ <builder buildPath="${workspace_loc:/PlaygroundCpp}/Debug" id="cdt.managedbuild.target.gnu.builder.exe.debug.1843014306" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="cdt.managedbuild.target.gnu.builder.exe.debug"/>
+ <tool id="cdt.managedbuild.tool.gnu.archiver.base.2083142981" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.base"/>
+ <tool id="cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug.812073924" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug">
+ <option id="gnu.cpp.compiler.exe.debug.option.optimization.level.639997264" name="Optimization Level" superClass="gnu.cpp.compiler.exe.debug.option.optimization.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/>
+ <option id="gnu.cpp.compiler.exe.debug.option.debugging.level.431750314" name="Debug Level" superClass="gnu.cpp.compiler.exe.debug.option.debugging.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.debugging.level.max" valueType="enumerated"/>
+ <inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.1870505499" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
+ </tool>
+ <tool id="cdt.managedbuild.tool.gnu.c.compiler.exe.debug.868207749" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.exe.debug">
+ <option defaultValue="gnu.c.optimization.level.none" id="gnu.c.compiler.exe.debug.option.optimization.level.2108681528" name="Optimization Level" superClass="gnu.c.compiler.exe.debug.option.optimization.level" useByScannerDiscovery="false" valueType="enumerated"/>
+ <option id="gnu.c.compiler.exe.debug.option.debugging.level.561344640" name="Debug Level" superClass="gnu.c.compiler.exe.debug.option.debugging.level" useByScannerDiscovery="false" value="gnu.c.debugging.level.max" valueType="enumerated"/>
+ <inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.1371005084" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
+ </tool>
+ <tool id="cdt.managedbuild.tool.gnu.c.linker.exe.debug.1306453908" name="GCC C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.exe.debug"/>
+ <tool id="cdt.managedbuild.tool.gnu.cpp.linker.exe.debug.1593738472" name="GCC C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.exe.debug">
+ <option id="gnu.cpp.link.option.paths.1593365739" name="Library search path (-L)" superClass="gnu.cpp.link.option.paths" valueType="libPaths">
+ <listOptionValue builtIn="false" value="/home/haidong/googletest/build/googlemock/gtest"/>
+ </option>
+ <option id="gnu.cpp.link.option.libs.2046973616" name="Libraries (-l)" superClass="gnu.cpp.link.option.libs" valueType="libs">
+ <listOptionValue builtIn="false" srcPrefixMapping="" srcRootPath="" value="gtest"/>
+ <listOptionValue builtIn="false" srcPrefixMapping="" srcRootPath="" value="gtest_main"/>
+ </option>
+ <inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.1967757968" superClass="cdt.managedbuild.tool.gnu.cpp.linker.input">
+ <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+ <additionalInput kind="additionalinput" paths="$(LIBS)"/>
+ </inputType>
+ </tool>
+ <tool id="cdt.managedbuild.tool.gnu.assembler.exe.debug.183585801" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.exe.debug">
+ <option id="gnu.both.asm.option.include.paths.1592126793" name="Include paths (-I)" superClass="gnu.both.asm.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value="/home/haidong/googletest/googletest/include"/>
+ </option>
+ <inputType id="cdt.managedbuild.tool.gnu.assembler.input.641163583" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+ </tool>
+ </toolChain>
+ </folderInfo>
+ <sourceEntries>
+ <entry excluding="Sources" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="Sources"/>
+ </sourceEntries>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ <cconfiguration id="cdt.managedbuild.config.gnu.exe.release.1819242823">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.exe.release.1819242823" moduleId="org.eclipse.cdt.core.settings" name="Release">
+ <externalSettings/>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe,org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.release" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.exe.release.1819242823" name="Release" parent="cdt.managedbuild.config.gnu.exe.release">
+ <folderInfo id="cdt.managedbuild.config.gnu.exe.release.1819242823." name="/" resourcePath="">
+ <toolChain id="cdt.managedbuild.toolchain.gnu.exe.release.1654992273" name="Linux GCC" superClass="cdt.managedbuild.toolchain.gnu.exe.release">
+ <targetPlatform id="cdt.managedbuild.target.gnu.platform.exe.release.500125802" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.exe.release"/>
+ <builder buildPath="${workspace_loc:/PlaygroundCpp}/Release" id="cdt.managedbuild.target.gnu.builder.exe.release.340698914" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="cdt.managedbuild.target.gnu.builder.exe.release"/>
+ <tool id="cdt.managedbuild.tool.gnu.archiver.base.528694398" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.base"/>
+ <tool id="cdt.managedbuild.tool.gnu.cpp.compiler.exe.release.1124698867" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.exe.release">
+ <option id="gnu.cpp.compiler.exe.release.option.optimization.level.1708013044" name="Optimization Level" superClass="gnu.cpp.compiler.exe.release.option.optimization.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.optimization.level.most" valueType="enumerated"/>
+ <option id="gnu.cpp.compiler.exe.release.option.debugging.level.1937224406" name="Debug Level" superClass="gnu.cpp.compiler.exe.release.option.debugging.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.debugging.level.none" valueType="enumerated"/>
+ <inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.1112690290" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
+ </tool>
+ <tool id="cdt.managedbuild.tool.gnu.c.compiler.exe.release.844310552" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.exe.release">
+ <option defaultValue="gnu.c.optimization.level.most" id="gnu.c.compiler.exe.release.option.optimization.level.1779597296" name="Optimization Level" superClass="gnu.c.compiler.exe.release.option.optimization.level" useByScannerDiscovery="false" valueType="enumerated"/>
+ <option id="gnu.c.compiler.exe.release.option.debugging.level.766030980" name="Debug Level" superClass="gnu.c.compiler.exe.release.option.debugging.level" useByScannerDiscovery="false" value="gnu.c.debugging.level.none" valueType="enumerated"/>
+ <inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.496248817" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
+ </tool>
+ <tool id="cdt.managedbuild.tool.gnu.c.linker.exe.release.1355856436" name="GCC C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.exe.release"/>
+ <tool id="cdt.managedbuild.tool.gnu.cpp.linker.exe.release.1951039164" name="GCC C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.exe.release">
+ <inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.1750963769" superClass="cdt.managedbuild.tool.gnu.cpp.linker.input">
+ <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+ <additionalInput kind="additionalinput" paths="$(LIBS)"/>
+ </inputType>
+ </tool>
+ <tool id="cdt.managedbuild.tool.gnu.assembler.exe.release.238089210" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.exe.release">
+ <inputType id="cdt.managedbuild.tool.gnu.assembler.input.1253971676" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+ </tool>
+ </toolChain>
+ </folderInfo>
+ <sourceEntries>
+ <entry excluding="Sources" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="Sources"/>
+ </sourceEntries>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <project id="PlaygroundCpp.cdt.managedbuild.target.gnu.exe.2094636372" name="Executable" projectType="cdt.managedbuild.target.gnu.exe"/>
+ </storageModule>
+ <storageModule moduleId="scannerConfiguration">
+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
+ <scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.exe.debug.854788432;cdt.managedbuild.config.gnu.exe.debug.854788432.;cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug.812073924;cdt.managedbuild.tool.gnu.cpp.compiler.input.1870505499">
+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
+ </scannerConfigBuildInfo>
+ <scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.exe.release.1819242823;cdt.managedbuild.config.gnu.exe.release.1819242823.;cdt.managedbuild.tool.gnu.cpp.compiler.exe.release.1124698867;cdt.managedbuild.tool.gnu.cpp.compiler.input.1112690290">
+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
+ </scannerConfigBuildInfo>
+ <scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.exe.release.1819242823;cdt.managedbuild.config.gnu.exe.release.1819242823.;cdt.managedbuild.tool.gnu.c.compiler.exe.release.844310552;cdt.managedbuild.tool.gnu.c.compiler.input.496248817">
+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
+ </scannerConfigBuildInfo>
+ <scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.exe.debug.854788432;cdt.managedbuild.config.gnu.exe.debug.854788432.;cdt.managedbuild.tool.gnu.c.compiler.exe.debug.868207749;cdt.managedbuild.tool.gnu.c.compiler.input.1371005084">
+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
+ </scannerConfigBuildInfo>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
+ <storageModule moduleId="refreshScope" versionNumber="2">
+ <configuration configurationName="Debug">
+ <resource resourceType="PROJECT" workspacePath="/PlaygroundCpp"/>
+ </configuration>
+ <configuration configurationName="Release">
+ <resource resourceType="PROJECT" workspacePath="/PlaygroundCpp"/>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"/>
+ <storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>
</cproject>
diff --git a/PlaygroundCpp/.project b/PlaygroundCpp/.project
index c294861..7abf47f 100644
--- a/PlaygroundCpp/.project
+++ b/PlaygroundCpp/.project
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
- <name>PlaygroundCpp</name>
+ <name>AlgoDesignAndTechniqueEdxCpp</name>
<comment></comment>
<projects>
</projects>
diff --git a/PlaygroundCpp/.settings/language.settings.xml b/PlaygroundCpp/.settings/language.settings.xml
index f5ddb15..aa6e0c9 100644
--- a/PlaygroundCpp/.settings/language.settings.xml
+++ b/PlaygroundCpp/.settings/language.settings.xml
@@ -1,48 +1,25 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project>
-
- <configuration id="cdt.managedbuild.config.gnu.exe.debug.854788432" name="Debug">
-
- <extension point="org.eclipse.cdt.core.LanguageSettingsProvider">
-
- <provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
-
- <provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
-
- <provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
-
- <provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="-939321890483387581" id="org.eclipse.cdt.managedbuilder.core.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
-
- <language-scope id="org.eclipse.cdt.core.gcc"/>
-
- <language-scope id="org.eclipse.cdt.core.g++"/>
-
- </provider>
-
- </extension>
-
- </configuration>
-
- <configuration id="cdt.managedbuild.config.gnu.exe.release.1819242823" name="Release">
-
- <extension point="org.eclipse.cdt.core.LanguageSettingsProvider">
-
- <provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
-
- <provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
-
- <provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
-
- <provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="-939321890483387581" id="org.eclipse.cdt.managedbuilder.core.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
-
- <language-scope id="org.eclipse.cdt.core.gcc"/>
-
- <language-scope id="org.eclipse.cdt.core.g++"/>
-
- </provider>
-
- </extension>
-
- </configuration>
-
+ <configuration id="cdt.managedbuild.config.gnu.exe.debug.854788432" name="Debug">
+ <extension point="org.eclipse.cdt.core.LanguageSettingsProvider">
+ <provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
+ <provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
+ <provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
+ <provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="-939321890483387581" id="org.eclipse.cdt.managedbuilder.core.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
+ <language-scope id="org.eclipse.cdt.core.gcc"/>
+ <language-scope id="org.eclipse.cdt.core.g++"/>
+ </provider>
+ </extension>
+ </configuration>
+ <configuration id="cdt.managedbuild.config.gnu.exe.release.1819242823" name="Release">
+ <extension point="org.eclipse.cdt.core.LanguageSettingsProvider">
+ <provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
+ <provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
+ <provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
+ <provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="-939321890483387581" id="org.eclipse.cdt.managedbuilder.core.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
+ <language-scope id="org.eclipse.cdt.core.gcc"/>
+ <language-scope id="org.eclipse.cdt.core.g++"/>
+ </provider>
+ </extension>
+ </configuration>
</project>
diff --git a/PlaygroundCpp/Sources/Playground.cpp b/PlaygroundCpp/Sources/Playground.cpp
index e9f516d..6cd3f7a 100644
--- a/PlaygroundCpp/Sources/Playground.cpp
+++ b/PlaygroundCpp/Sources/Playground.cpp
@@ -1,37 +1,72 @@
#include <vector>
#include <iostream>
+#include <cstdlib>
//#include <gtest/gtest.h>
using std::vector;
+using std::swap;
-int conquer(vector<int> &a, int b, int c, int left, int right) {
- int countB = 0;
- int countC = 0;
- for (int i = left; i < right + 1; i++) {
- if (a[i] == b)
- countB++;
- if (a[i] == c)
- countC++;
+int partition2(vector<int> &a, int l, int r) {
+ int x = a[l];
+ int j = l;
+ for (int i = l + 1; i <= r; i++) {
+ if (a[i] <= x) {
+ j++;
+ swap(a[i], a[j]);
+ }
}
- if (countB > (right - left + 1) / 2)
- return b;
- if (countC > (right - left + 1) / 2)
- return c;
- return -1;
+ swap(a[l], a[j]);
+ return j;
}
+vector<int> partition3(vector<int> &a, int l, int r) {
+ int x = a[l];
+ int j = l;
+ int dupCount = 0;
+ int biggerNumCount = 0;
-int get_majority_element(vector<int> &a, int left, int right) {
- if (left == right)
- return a[left];
- int middle = (right - left) / 2;
- int b = get_majority_element(a, left, left + middle);
- int c = get_majority_element(a, left + middle + 1, right);
- int d = conquer(a, b, c, left, right);
- return d;
+ for (int i = l + 1; i <= r; i++) {
+ if (a[i] < x) {
+ int t = a[i];
+ a[j] = t;
+ t = a[i - biggerNumCount];
+ a[i] = t;
+ a[i - biggerNumCount] = x;
+ j++;
+ continue;
+ }
+ if (a[i] == x) {
+ int t = a[j + dupCount + 1];
+ a[i] = t;
+ a[j + dupCount + 1] = x;
+ dupCount++;
+ continue;
+ }
+ biggerNumCount++;
+ }
+ vector<int> m = { j, j + dupCount };
+ return m;
+}
+
+void randomized_quick_sort(vector<int> &a, int l, int r) {
+ if (l >= r) {
+ return;
+ }
+
+ int k = l + rand() % (r - l + 1);
+ swap(a[l], a[k]);
+// int m = partition2(a, l, r);
+
+ vector<int> m = partition3(a, l, r);
+
+ randomized_quick_sort(a, l, m[0] - 1);
+ randomized_quick_sort(a, m[1] + 1, r);
}
-//TEST(MajorityElement, test1) {
-// vector<int> a = { 1, 1 };
-// ASSERT_EQ(get_majority_element(a, 0, a.size()-1), 1);
+
+//TEST(ImprovedQuickSort, test1) {
+// vector<int> a = { 2, 3, 9, 2, 2 };
+// vector<int> result = { 2, 2, 2, 3, 9 };
+// randomized_quick_sort(a, 0, a.size() - 1);
+// ASSERT_EQ(result, a);
//}
int main() {
@@ -41,5 +76,8 @@ int main() {
for (size_t i = 0; i < a.size(); ++i) {
std::cin >> a[i];
}
- std::cout << (get_majority_element(a, 0, n - 1) != -1) << '\n';
+ randomized_quick_sort(a, 0, a.size() - 1);
+ for (size_t i = 0; i < a.size(); ++i) {
+ std::cout << a[i] << ' ';
+ }
}