mirror of
https://github.com/caperren/school_archives.git
synced 2025-11-09 13:41:13 +00:00
Added analysis of algorithms.
This commit is contained in:
11
OSU Coursework/CS 325 - Analysis of Algorithms/.idea/CS 325 - Analysis of Algorithms.iml
generated
Normal file
11
OSU Coursework/CS 325 - Analysis of Algorithms/.idea/CS 325 - Analysis of Algorithms.iml
generated
Normal file
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="PYTHON_MODULE" version="4">
|
||||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$" />
|
||||
<orderEntry type="jdk" jdkName="Python 3.5" jdkType="Python SDK" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
<component name="TestRunnerService">
|
||||
<option name="PROJECT_TEST_RUNNER" value="Unittests" />
|
||||
</component>
|
||||
</module>
|
||||
4
OSU Coursework/CS 325 - Analysis of Algorithms/.idea/misc.xml
generated
Normal file
4
OSU Coursework/CS 325 - Analysis of Algorithms/.idea/misc.xml
generated
Normal file
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.5" project-jdk-type="Python SDK" />
|
||||
</project>
|
||||
8
OSU Coursework/CS 325 - Analysis of Algorithms/.idea/modules.xml
generated
Normal file
8
OSU Coursework/CS 325 - Analysis of Algorithms/.idea/modules.xml
generated
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/CS 325 - Analysis of Algorithms.iml" filepath="$PROJECT_DIR$/.idea/CS 325 - Analysis of Algorithms.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
259
OSU Coursework/CS 325 - Analysis of Algorithms/.idea/workspace.xml
generated
Normal file
259
OSU Coursework/CS 325 - Analysis of Algorithms/.idea/workspace.xml
generated
Normal file
@@ -0,0 +1,259 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="8463bdd4-0c68-42b0-84f5-1c2abf1a6d5f" name="Default" comment="" />
|
||||
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
|
||||
<option name="TRACKING_ENABLED" value="true" />
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
||||
<option name="LAST_RESOLUTION" value="IGNORE" />
|
||||
</component>
|
||||
<component name="CoverageDataManager">
|
||||
<SUITE FILE_PATH="coverage/CS_325___Analysis_of_Algorithms$test.coverage" NAME="test Coverage Results" MODIFIED="1517016348937" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
|
||||
<SUITE FILE_PATH="coverage/CS_325___Analysis_of_Algorithms$HW_2.coverage" NAME="HW 2 Coverage Results" MODIFIED="1517020025345" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/HW 2" />
|
||||
</component>
|
||||
<component name="FileEditorManager">
|
||||
<leaf>
|
||||
<file leaf-file-name="hw2.py" pinned="false" current-in-tab="true">
|
||||
<entry file="file://$PROJECT_DIR$/HW 2/hw2.py">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="1548">
|
||||
<caret line="86" column="31" lean-forward="true" selection-start-line="86" selection-start-column="31" selection-end-line="86" selection-end-column="31" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
</leaf>
|
||||
</component>
|
||||
<component name="FileTemplateManagerImpl">
|
||||
<option name="RECENT_TEMPLATES">
|
||||
<list>
|
||||
<option value="Python Script" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="IdeDocumentHistory">
|
||||
<option name="CHANGED_PATHS">
|
||||
<list>
|
||||
<option value="$PROJECT_DIR$/temp.py" />
|
||||
<option value="$PROJECT_DIR$/HW 2/hw2.py" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="JsBuildToolGruntFileManager" detection-done="true" sorting="DEFINITION_ORDER" />
|
||||
<component name="JsBuildToolPackageJson" detection-done="true" sorting="DEFINITION_ORDER" />
|
||||
<component name="JsGulpfileManager">
|
||||
<detection-done>true</detection-done>
|
||||
<sorting>DEFINITION_ORDER</sorting>
|
||||
</component>
|
||||
<component name="ProjectFrameBounds" extendedState="6">
|
||||
<option name="x" value="772" />
|
||||
<option name="y" value="1428" />
|
||||
<option name="width" value="1400" />
|
||||
<option name="height" value="1000" />
|
||||
</component>
|
||||
<component name="ProjectView">
|
||||
<navigator currentView="ProjectPane" proportions="" version="1">
|
||||
<flattenPackages />
|
||||
<showMembers />
|
||||
<showModules />
|
||||
<showLibraryContents />
|
||||
<hideEmptyPackages />
|
||||
<abbreviatePackageNames />
|
||||
<autoscrollToSource />
|
||||
<autoscrollFromSource />
|
||||
<sortByType />
|
||||
<manualOrder />
|
||||
<foldersAlwaysOnTop value="true" />
|
||||
</navigator>
|
||||
<panes>
|
||||
<pane id="Scope" />
|
||||
<pane id="ProjectPane">
|
||||
<subPane>
|
||||
<expand>
|
||||
<path>
|
||||
<item name="CS 325 - Analysis of Algorithms" type="b2602c69:ProjectViewProjectNode" />
|
||||
<item name="CS 325 - Analysis of Algorithms" type="462c0819:PsiDirectoryNode" />
|
||||
</path>
|
||||
</expand>
|
||||
<select />
|
||||
</subPane>
|
||||
</pane>
|
||||
<pane id="Scratches" />
|
||||
</panes>
|
||||
</component>
|
||||
<component name="PropertiesComponent">
|
||||
<property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" />
|
||||
<property name="WebServerToolWindowFactoryState" value="false" />
|
||||
<property name="settings.editor.selected.configurable" value="com.jetbrains.python.configuration.PyActiveSdkModuleConfigurable" />
|
||||
<property name="last_opened_file_path" value="$PROJECT_DIR$/temp.py" />
|
||||
<property name="restartRequiresConfirmation" value="false" />
|
||||
</component>
|
||||
<component name="RunDashboard">
|
||||
<option name="ruleStates">
|
||||
<list>
|
||||
<RuleState>
|
||||
<option name="name" value="ConfigurationTypeDashboardGroupingRule" />
|
||||
</RuleState>
|
||||
<RuleState>
|
||||
<option name="name" value="StatusDashboardGroupingRule" />
|
||||
</RuleState>
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="RunManager" selected="Python.HW 2">
|
||||
<configuration name="HW 2" type="PythonConfigurationType" factoryName="Python" singleton="true">
|
||||
<option name="INTERPRETER_OPTIONS" value="" />
|
||||
<option name="PARENT_ENVS" value="true" />
|
||||
<envs>
|
||||
<env name="PYTHONUNBUFFERED" value="1" />
|
||||
</envs>
|
||||
<option name="SDK_HOME" value="/usr/bin/python3" />
|
||||
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/HW 2" />
|
||||
<option name="IS_MODULE_SDK" value="false" />
|
||||
<option name="ADD_CONTENT_ROOTS" value="true" />
|
||||
<option name="ADD_SOURCE_ROOTS" value="true" />
|
||||
<module name="CS 325 - Analysis of Algorithms" />
|
||||
<EXTENSION ID="PythonCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" runner="coverage.py" />
|
||||
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/HW 2/hw2.py" />
|
||||
<option name="PARAMETERS" value="" />
|
||||
<option name="SHOW_COMMAND_LINE" value="false" />
|
||||
<option name="EMULATE_TERMINAL" value="false" />
|
||||
<option name="MODULE_MODE" value="false" />
|
||||
</configuration>
|
||||
<configuration name="test" type="PythonConfigurationType" factoryName="Python" singleton="true">
|
||||
<option name="INTERPRETER_OPTIONS" value="" />
|
||||
<option name="PARENT_ENVS" value="true" />
|
||||
<envs>
|
||||
<env name="PYTHONUNBUFFERED" value="1" />
|
||||
</envs>
|
||||
<option name="SDK_HOME" value="/usr/bin/python3" />
|
||||
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
|
||||
<option name="IS_MODULE_SDK" value="false" />
|
||||
<option name="ADD_CONTENT_ROOTS" value="true" />
|
||||
<option name="ADD_SOURCE_ROOTS" value="true" />
|
||||
<module name="CS 325 - Analysis of Algorithms" />
|
||||
<EXTENSION ID="PythonCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" runner="coverage.py" />
|
||||
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/temp.py" />
|
||||
<option name="PARAMETERS" value="" />
|
||||
<option name="SHOW_COMMAND_LINE" value="false" />
|
||||
<option name="EMULATE_TERMINAL" value="false" />
|
||||
<option name="MODULE_MODE" value="false" />
|
||||
</configuration>
|
||||
<list size="2">
|
||||
<item index="0" class="java.lang.String" itemvalue="Python.HW 2" />
|
||||
<item index="1" class="java.lang.String" itemvalue="Python.test" />
|
||||
</list>
|
||||
</component>
|
||||
<component name="ShelveChangesManager" show_recycled="false">
|
||||
<option name="remove_strategy" value="false" />
|
||||
</component>
|
||||
<component name="SvnConfiguration">
|
||||
<configuration />
|
||||
</component>
|
||||
<component name="TaskManager">
|
||||
<task active="true" id="Default" summary="Default task">
|
||||
<changelist id="8463bdd4-0c68-42b0-84f5-1c2abf1a6d5f" name="Default" comment="" />
|
||||
<created>1516999834836</created>
|
||||
<option name="number" value="Default" />
|
||||
<option name="presentableId" value="Default" />
|
||||
<updated>1516999834836</updated>
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
<component name="ToolWindowManager">
|
||||
<frame x="26" y="1080" width="2538" height="1444" extended-state="6" />
|
||||
<editor active="true" />
|
||||
<layout>
|
||||
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="11" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="0" side_tool="true" content_ui="tabs" />
|
||||
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.47786948" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="false" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Python Console" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.17629407" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.13715415" sideWeight="0.5" order="1" side_tool="false" content_ui="combo" />
|
||||
<window_info id="Docker" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="false" weight="0.33" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Database" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="SciView" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.39984995" sideWeight="0.5" order="8" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="0" side_tool="true" content_ui="tabs" />
|
||||
<window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="9" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="combo" />
|
||||
<window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="10" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
|
||||
</layout>
|
||||
<layout-to-restore>
|
||||
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="11" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="9" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="0" side_tool="true" content_ui="tabs" />
|
||||
<window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="10" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32933232" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="false" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Python Console" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.17629407" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.1375494" sideWeight="0.5" order="1" side_tool="false" content_ui="combo" />
|
||||
<window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="combo" />
|
||||
<window_info id="Docker" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="false" weight="0.33" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Database" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="SciView" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.39984995" sideWeight="0.5" order="8" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="0" side_tool="true" content_ui="tabs" />
|
||||
</layout-to-restore>
|
||||
</component>
|
||||
<component name="TypeScriptGeneratedFilesManager">
|
||||
<option name="version" value="1" />
|
||||
</component>
|
||||
<component name="VcsContentAnnotationSettings">
|
||||
<option name="myLimit" value="2678400000" />
|
||||
</component>
|
||||
<component name="XDebuggerManager">
|
||||
<breakpoint-manager>
|
||||
<default-breakpoints>
|
||||
<breakpoint type="python-exception">
|
||||
<properties notifyOnTerminate="true" exception="BaseException">
|
||||
<option name="notifyOnTerminate" value="true" />
|
||||
</properties>
|
||||
</breakpoint>
|
||||
</default-breakpoints>
|
||||
<option name="time" value="2" />
|
||||
</breakpoint-manager>
|
||||
<watches-manager />
|
||||
</component>
|
||||
<component name="editorHistoryManager">
|
||||
<entry file="file:///usr/lib/python3.5/timeit.py">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="288">
|
||||
<caret line="129" column="0" lean-forward="false" selection-start-line="129" selection-start-column="0" selection-end-line="129" selection-end-column="0" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/temp.py">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="306">
|
||||
<caret line="17" column="24" lean-forward="true" selection-start-line="17" selection-start-column="24" selection-end-line="17" selection-end-column="24" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/HW 2/hw2.py">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="1548">
|
||||
<caret line="86" column="31" lean-forward="true" selection-start-line="86" selection-start-column="31" selection-end-line="86" selection-end-column="31" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</component>
|
||||
</project>
|
||||
166
OSU Coursework/CS 325 - Analysis of Algorithms/HW 2/hw2.py
Normal file
166
OSU Coursework/CS 325 - Analysis of Algorithms/HW 2/hw2.py
Normal file
@@ -0,0 +1,166 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
from time import time
|
||||
|
||||
|
||||
def run_hanoi_algorithm(hanoi_function, num_disks, print_steps=False, print_stack=False):
|
||||
stacks = get_starting_stack(num_disks)
|
||||
|
||||
if print_stack:
|
||||
pretty_print_stacks(stacks)
|
||||
|
||||
hanoi_function(len(stacks["left"]), stacks, "left", "middle", "right", print_steps, print_stack)
|
||||
|
||||
|
||||
def pretty_print_stacks(hanoi_stacks):
|
||||
to_print = "Left:%s\tMiddle:%s\tRight:%s" % (hanoi_stacks["left"], hanoi_stacks["middle"], hanoi_stacks["right"])
|
||||
print(to_print.expandtabs(40))
|
||||
|
||||
|
||||
def get_starting_stack(num_start_disks):
|
||||
stacks = {
|
||||
"left": [i for i in range(1, num_start_disks + 1)],
|
||||
"middle": [],
|
||||
"right": []
|
||||
}
|
||||
|
||||
return stacks
|
||||
|
||||
|
||||
def move_disk(hanoi_stacks, starting_post, ending_post, print_steps=False, print_stack=False):
|
||||
hanoi_stacks[ending_post].insert(0, hanoi_stacks[starting_post].pop(0))
|
||||
|
||||
if print_steps:
|
||||
print("Moved disk from %s to %s" % (starting_post, ending_post))
|
||||
|
||||
if print_stack:
|
||||
pretty_print_stacks(hanoi_stacks)
|
||||
|
||||
|
||||
def hanoi_recursive(height, hanoi_stacks, starting_post, temp_post, ending_post, print_steps=False, print_stack=False):
|
||||
if height > 0:
|
||||
hanoi_recursive(height - 1, hanoi_stacks, starting_post, ending_post, temp_post, print_steps, print_stack)
|
||||
|
||||
move_disk(hanoi_stacks, starting_post, ending_post, print_steps, print_stack)
|
||||
|
||||
hanoi_recursive(height - 1, hanoi_stacks, temp_post, starting_post, ending_post, print_steps, print_stack)
|
||||
|
||||
|
||||
def make_legal_move(height, hanoi_stacks, starting_post, ending_post, print_steps=False, print_stack=False):
|
||||
if len(hanoi_stacks["right"]) == height or \
|
||||
(len(hanoi_stacks[starting_post]) == 0 and len(hanoi_stacks[ending_post]) == 0):
|
||||
return
|
||||
elif len(hanoi_stacks[starting_post]) == 0:
|
||||
larger = starting_post
|
||||
smaller = ending_post
|
||||
elif len(hanoi_stacks[ending_post]) == 0:
|
||||
larger = ending_post
|
||||
smaller = starting_post
|
||||
else:
|
||||
larger = starting_post if hanoi_stacks[starting_post][0] > hanoi_stacks[ending_post][0] else ending_post
|
||||
smaller = starting_post if larger != starting_post else ending_post
|
||||
|
||||
move_disk(hanoi_stacks, smaller, larger, print_steps, print_stack)
|
||||
|
||||
|
||||
def hanoi_iterative(height, hanoi_stacks, starting_post, temp_post, ending_post, print_steps=False, print_stack=False):
|
||||
while len(hanoi_stacks["right"]) != height:
|
||||
if height % 2 == 0:
|
||||
make_legal_move(height, hanoi_stacks, starting_post, temp_post, print_steps, print_stack)
|
||||
make_legal_move(height, hanoi_stacks, starting_post, ending_post, print_steps, print_stack)
|
||||
else:
|
||||
make_legal_move(height, hanoi_stacks, starting_post, ending_post, print_steps, print_stack)
|
||||
make_legal_move(height, hanoi_stacks, starting_post, temp_post, print_steps, print_stack)
|
||||
|
||||
make_legal_move(height, hanoi_stacks, temp_post, ending_post, print_steps, print_stack)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
# ##### Variables for Later #####
|
||||
recursive_timings = [[], []]
|
||||
iterative_timings = [[], []]
|
||||
num_timing_iterations = 25
|
||||
|
||||
# ##### Problem 1 #####
|
||||
print("CS 325 - Homework 2 - Corwin Perren")
|
||||
|
||||
print("\n\n########## Problem 1 ##########")
|
||||
print("Recursive and iterative version of hanoi made...")
|
||||
# Recursive and iterative version made. See the two immediate functions above.
|
||||
|
||||
# ##### Problem 2 #####
|
||||
print("\n\n########## Problem 2 ##########")
|
||||
|
||||
# Recursive 3 disks
|
||||
print("### Hanoi Recursive - 3 Disks - Printed Steps ###")
|
||||
run_hanoi_algorithm(hanoi_recursive, 3, True, False)
|
||||
|
||||
# Recursive 4 disks
|
||||
print("\n\n### Hanoi Recursive - 4 Disks - Printed Steps ###")
|
||||
run_hanoi_algorithm(hanoi_recursive, 4, True, False)
|
||||
|
||||
# Iterative 3 disks
|
||||
print("\n\n### Hanoi Iterative - 3 Disks - Printed Steps ###")
|
||||
run_hanoi_algorithm(hanoi_iterative, 3, True, False)
|
||||
|
||||
# Iterative 4 disks
|
||||
print("\n\n### Hanoi Iterative - 4 Disks - Printed Steps ###")
|
||||
run_hanoi_algorithm(hanoi_iterative, 4, True, False)
|
||||
|
||||
# Verified that these are the correct steps
|
||||
|
||||
# ##### Problem 3 #####
|
||||
print("\n\n########## Problem 3 ##########")
|
||||
print("### 4 Disks - Print Out Successive Contents from Recursion ###")
|
||||
run_hanoi_algorithm(hanoi_recursive, 4, False, True)
|
||||
|
||||
# ##### Problem 4 #####
|
||||
print("\n\n########## Problem 4 ##########")
|
||||
print("### Recursive Timings For Small n ###")
|
||||
for current_n in range(1, num_timing_iterations):
|
||||
start_time = time()
|
||||
run_hanoi_algorithm(hanoi_recursive, current_n)
|
||||
run_time = time() - start_time
|
||||
|
||||
recursive_timings[0].append(current_n)
|
||||
recursive_timings[1].append(run_time)
|
||||
print("%s disks: %.10f seconds" % (current_n, run_time))
|
||||
|
||||
print("### Iterative Timings For Small n ###")
|
||||
for current_n in range(1, num_timing_iterations):
|
||||
start_time = time()
|
||||
run_hanoi_algorithm(hanoi_iterative, current_n)
|
||||
run_time = time() - start_time
|
||||
|
||||
iterative_timings[0].append(current_n)
|
||||
iterative_timings[1].append(run_time)
|
||||
print("%s disks: %.10f seconds" % (current_n, run_time))
|
||||
|
||||
# ##### Problem 5 #####
|
||||
print("\n\n########## Problem 5 ##########")
|
||||
print("### Plots shown below, or printouts for spreadsheet if run from code ###")
|
||||
|
||||
for i in range(len(recursive_timings[0])):
|
||||
print("%s\t%s" % (recursive_timings[0][i], recursive_timings[1][i]))
|
||||
|
||||
for i in range(len(iterative_timings[0])):
|
||||
print("%s\t%s" % (iterative_timings[0][i], iterative_timings[1][i]))
|
||||
|
||||
# ##### Problem 6 #####
|
||||
print("\n\n########## Problem 6 ##########")
|
||||
print("Recursive C Value is approximately equal to 7.42E-07")
|
||||
print("Iterative C Value is approximately equal to 1.13E-06")
|
||||
|
||||
# ##### Problem 7 #####
|
||||
print("\n\n########## Problem 7 ##########")
|
||||
print("The recursive algorithm will be faster for large n.")
|
||||
|
||||
# ##### Problem 8 #####
|
||||
print("\n\n########## Problem 8 ##########")
|
||||
print("The recursive algorithm would take approximately 434027 years for 64 disks.")
|
||||
print("The iterative algorithm would take approximately 660985 years for 64 disks.")
|
||||
|
||||
# ##### Problem 9 #####
|
||||
print("\n\n########## Problem 9 ##########")
|
||||
print("The recursive algorithm could solve approximately 29 disks in ten minutes.")
|
||||
print("The iterative algorithm could solve approximately 28 disks in ten minutes.")
|
||||
Reference in New Issue
Block a user