Commit 69dba725 authored by JanRipken's avatar JanRipken
Browse files

main init

parent 6ad1d15b
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
# User-specific files
*.rsuser
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Mono auto generated files
mono_crash.*
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
[Aa][Rr][Mm]/
[Aa][Rr][Mm]64/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
[Ll]ogs/
# Visual Studio 2015/2017 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# Visual Studio 2017 auto generated files
Generated\ Files/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUnit
*.VisualState.xml
TestResult.xml
nunit-*.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# Benchmark Results
BenchmarkDotNet.Artifacts/
# .NET Core
project.lock.json
project.fragment.lock.json
artifacts/
# StyleCop
StyleCopReport.xml
# Files built by Visual Studio
*_i.c
*_p.c
*_h.h
*.ilk
*.meta
*.obj
*.iobj
*.pch
*.pdb
*.ipdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*_wpftmp.csproj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# Visual Studio Trace Files
*.e2e
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# AxoCover is a Code Coverage Tool
.axoCover/*
!.axoCover/settings.json
# Visual Studio code coverage results
*.coverage
*.coveragexml
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# Note: Comment the next line if you want to checkin your web deploy settings,
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/
# NuGet Packages
*.nupkg
# NuGet Symbol Packages
*.snupkg
# The packages folder can be ignored because of Package Restore
**/[Pp]ackages/*
# except build/, which is used as an MSBuild target.
!**/[Pp]ackages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/[Pp]ackages/repositories.config
# NuGet v3's project.json files produces more ignorable files
*.nuget.props
*.nuget.targets
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
*.appx
*.appxbundle
*.appxupload
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!?*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.jfm
*.pfx
*.publishsettings
orleans.codegen.cs
# Including strong name files can present a security risk
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
#*.snk
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
ServiceFabricBackup/
*.rptproj.bak
# SQL Server files
*.mdf
*.ldf
*.ndf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
*.rptproj.rsuser
*- [Bb]ackup.rdl
*- [Bb]ackup ([0-9]).rdl
*- [Bb]ackup ([0-9][0-9]).rdl
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
node_modules/
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
paket-files/
# FAKE - F# Make
.fake/
# CodeRush personal settings
.cr/personal
# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
# Cake - Uncomment if you are using it
# tools/**
# !tools/packages.config
# Tabs Studio
*.tss
# Telerik's JustMock configuration file
*.jmconfig
# BizTalk build output
*.btp.cs
*.btm.cs
*.odx.cs
*.xsd.cs
# OpenCover UI analysis results
OpenCover/
# Azure Stream Analytics local run output
ASALocalRun/
# MSBuild Binary and Structured Log
*.binlog
# NVidia Nsight GPU debugger configuration file
*.nvuser
# MFractors (Xamarin productivity tool) working folder
.mfractor/
# Local History for Visual Studio
.localhistory/
# BeatPulse healthcheck temp database
healthchecksdb
# Backup folder for Package Reference Convert tool in Visual Studio 2017
MigrationBackup/
# Ionide (cross platform F# VS Code tools) working folder
.ionide/
MIT License
Copyright (c) 2021 hsp-fbi-jade-hs-de
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.7.1" />
<PackageReference Include="MSTest.TestAdapter" Version="2.1.1" />
<PackageReference Include="MSTest.TestFramework" Version="2.1.1" />
<PackageReference Include="coverlet.collector" Version="1.3.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\MergeSort_Array\MergeSort_Array.csproj" />
</ItemGroup>
</Project>
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Collections.Generic;
using System.Linq;
using MergeSort_Array;
namespace MergeSort_Array.UnitTest
{
[TestClass]
public class UnitTest1
{
[TestMethod]
public void TestMethod1()
{
// Arrange
Program prg = new Program();
//Act
var result = prg.MergeSort(new int[] { 12, 31, 68, 54 });
//Assert
Assert.IsTrue(Enumerable.SequenceEqual(new int[] { 12, 31, 54, 68 }, result));
}
[TestMethod]
public void TestMethod2()
{
// Arrange
Program prg = new Program();
//Act
var result = prg.MergeSort(new int[] { 12, 31, 68, 54, 13, 56, 43, 87, 3, 9, 59, 76 });
//Assert
Assert.IsTrue(Enumerable.SequenceEqual(new int[] { 3, 9, 12, 13, 31, 43, 54, 56, 59, 68, 76, 87 }, result));
}
}
}

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.31129.286
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MergeSort_Array", "MergeSort_Array\MergeSort_Array.csproj", "{EB899758-0297-48E4-8444-C86C60F9C050}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MergeSort_Array.UnitTest", "MergeSort_Array.UnitTest\MergeSort_Array.UnitTest.csproj", "{BBA13512-D4DB-4A86-9DE7-E7B6567EDF7A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{EB899758-0297-48E4-8444-C86C60F9C050}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EB899758-0297-48E4-8444-C86C60F9C050}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EB899758-0297-48E4-8444-C86C60F9C050}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EB899758-0297-48E4-8444-C86C60F9C050}.Release|Any CPU.Build.0 = Release|Any CPU
{BBA13512-D4DB-4A86-9DE7-E7B6567EDF7A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BBA13512-D4DB-4A86-9DE7-E7B6567EDF7A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BBA13512-D4DB-4A86-9DE7-E7B6567EDF7A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BBA13512-D4DB-4A86-9DE7-E7B6567EDF7A}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {6CEA8C1F-2513-4014-A8F6-A2A19BBBF2FC}
EndGlobalSection
EndGlobal
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>
</Project>
using System;
namespace MergeSort_Array
{
public class Program
{
public int[] Merge(int[] linksArray, int[] rechtsArray) //sollen studenten schreiben
{
int resultlength = rechtsArray.Length + linksArray.Length;
int[] result = new int[resultlength];
// Ergänzen sie Ihren Code hier
// Geschrieben werden muss der "Merge" Algorithmus bei dem die zwei Arrays zu einem Sortiert werden
return result;
}
static void Main(string[] args)
{
Program prg = new Program();
int[] unsortiert = new int[10];
Random random = new Random();
Console.WriteLine("Anfangs Array:");
for (int i = 0; i<unsortiert.Length; i++)
{
unsortiert[i] = random.Next(1,100);
Console.Write(unsortiert[i] + " ");
}
Console.WriteLine("\n");
int[] sortiert = new int[unsortiert.Length];
sortiert = prg.MergeSort(unsortiert);
Console.WriteLine("Sortiertes Array:");
foreach (int x in sortiert)
{
Console.Write(x + " ");
}
Console.Write("\n");
}
public int[] MergeSort(int[] unsortiert)
{
if (unsortiert.Length <= 1)
return unsortiert;
int[] linksArray;
int[] rechtsArray;
int[] result = new int[unsortiert.Length];
int x = 0;
int mitte = unsortiert.Length / 2;
linksArray = new int[mitte];
if (unsortiert.Length % 2 == 0)
rechtsArray = new int[mitte];
else
rechtsArray = new int[mitte + 1];
for (int i = 0; i < mitte; i++) //Teilen der Unsortierten Liste
{
linksArray[i] = unsortiert[i];
}
for (int i = mitte; i < unsortiert.Length; i++)
{
rechtsArray[x] = unsortiert[i];
x++;
}
linksArray = MergeSort(linksArray);
rechtsArray = MergeSort(rechtsArray);
result = Merge(linksArray, rechtsArray);
return result;
}
}
}
# HSP Aufgabe Mergesort
# Mergesort
Aufgabe Mergesort für Hochsprachenprogrammierung / Mecke an der Jade Hochschule
Sortiere Array mit diesem Sortierverfahren, Voraussetzung ist das Arbeiten mit Arrays ([]) in C#.
\ No newline at end of file
Aufgabe: Implementieren Sie den Mergesort Algorithmus in der Methode "Merge" innerhalb der Klasse "Program" MergeSort_Array\Program.cs
Folgende Schritte sind für die Iplementierung [des Algorithmus](http://www.sorting-algorithms.com/) notwendig:
* die wird einmal in dem Folgenden Video Ausführlich beschrieben
## Video
https://user-images.githubusercontent.com/72017165/117287043-32624700-ae6a-11eb-9f52-8ccfafb16586.mp4
## Getting Started
* Clonen Sie die Repository auf Ihren Rechner
* Öffnen Sie die Solution *.sln in Visual Studio
* Führen Sie die Implementierung in der Methode durch
Wenn Sie fertig sind, dann
* Im Projektmappen Explorer (engl. Solution Explorer) klicken Sie rechts das -Unittesting Projekt und wählen Sie "Tests ausführen"
* Starten Sie die Tests innerhalb des Test-Explorers
Diesen Ablauf können Sie auch mit Hilfe des Videos "Aufgabensammlung Einstieg" nachvollziehen
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment