Add files via upload

This commit is contained in:
Mateusz779 2021-12-15 19:31:53 +01:00 committed by GitHub
parent be7b299702
commit 0c952244a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 490 additions and 0 deletions

View File

@ -0,0 +1,24 @@
#!/bin/bash
arr=( "$@" )
echo "Array in original order"
echo ${arr[*]}
for ((i = 0; i<5; i++))
do
for((j = 0; j<5-i-1; j++))
do
if [ ${arr[j]} -gt ${arr[$((j+1))]} ]
then
# swap
temp=${arr[j]}
arr[$j]=${arr[$((j+1))]}
arr[$((j+1))]=$temp
fi
done
done
echo "Array in sorted order :"
echo ${arr[*]}

View File

@ -0,0 +1,13 @@
c:\users\kmate\source\repos\bubble_sort_cpp\bubble_sort_cpp\debug\vc142.pdb
c:\users\kmate\source\repos\bubble_sort_cpp\bubble_sort_cpp\debug\vc142.idb
c:\users\kmate\source\repos\bubble_sort_cpp\bubble_sort_cpp\debug\bubble_sort_cpp.obj
c:\users\kmate\source\repos\bubble_sort_cpp\debug\bubble_sort_cpp.exe
c:\users\kmate\source\repos\bubble_sort_cpp\bubble_sort_cpp\debug\bubble_sort_cpp.ilk
c:\users\kmate\source\repos\bubble_sort_cpp\debug\bubble_sort_cpp.pdb
c:\users\kmate\source\repos\bubble_sort_cpp\bubble_sort_cpp\debug\bubble_sort_cpp.obj.enc
c:\users\kmate\source\repos\bubble_sort_cpp\bubble_sort_cpp\debug\bubble_sort_cpp.tlog\cl.command.1.tlog
c:\users\kmate\source\repos\bubble_sort_cpp\bubble_sort_cpp\debug\bubble_sort_cpp.tlog\cl.read.1.tlog
c:\users\kmate\source\repos\bubble_sort_cpp\bubble_sort_cpp\debug\bubble_sort_cpp.tlog\cl.write.1.tlog
c:\users\kmate\source\repos\bubble_sort_cpp\bubble_sort_cpp\debug\bubble_sort_cpp.tlog\link.command.1.tlog
c:\users\kmate\source\repos\bubble_sort_cpp\bubble_sort_cpp\debug\bubble_sort_cpp.tlog\link.read.1.tlog
c:\users\kmate\source\repos\bubble_sort_cpp\bubble_sort_cpp\debug\bubble_sort_cpp.tlog\link.write.1.tlog

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>
<ProjectOutputs>
<ProjectOutput>
<FullPath>C:\Users\kmate\source\repos\bubble_sort_cpp\Debug\bubble_sort_cpp.exe</FullPath>
</ProjectOutput>
</ProjectOutputs>
<ContentFiles />
<SatelliteDlls />
<NonRecipeFileRefs />
</Project>

View File

@ -0,0 +1 @@


View File

@ -0,0 +1,75 @@
// bubble_sort_cpp.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
#include <iostream>
#include <list>
using namespace std;
int* sort_func(int *sort,int len, bool repeat);
int size_array = 0;
int main()
{
int tmp[] = { 2,7,2,1,3,100,3,32,342,2,44,23 };
size_array = (sizeof(tmp) / sizeof(int))-1;
int* sorted= sort_func(tmp, size_array,false);
for (int i = 0; i <= size_array; i++)
{
cout << sorted[i] << endl;
}
}
int* sort_func(int *sort, int len, bool repeat) {
bool t = true;
int j = 0;
while (t)
{
for (int i = 0; i <= len - 1; i++)
{
if (sort[i] > sort[i + 1])
{
int tmp1 = sort[i];
sort[i] = sort[i + 1];
sort[i + 1] = tmp1;
j = 0;
}
else if (sort[i] == sort[i + 1] && !repeat)
{
int del = i;
for (int a = del - 1; a < len; a++)
{
sort[del] = sort[del+ 1];
del++;
}
size_array--;
len--;
j = 0;
}
else
{
if (j == len)
t = false;
else
j++;
}
}
}
return sort;
}
// Run program: Ctrl + F5 or Debug > Start Without Debugging menu
// Debug program: F5 or Debug > Start Debugging menu
// Tips for Getting Started:
// 1. Use the Solution Explorer window to add/manage files
// 2. Use the Team Explorer window to connect to source control
// 3. Use the Output window to see build output and other messages
// 4. Use the Error List window to view errors
// 5. Go to Project > Add New Item to create new code files, or Project > Add Existing Item to add existing code files to the project
// 6. In the future, to open this project again, go to File > Open > Project and select the .sln file

View 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>{548c242a-3440-47b6-bd0a-2b0a3a030b67}</ProjectGuid>
<RootNamespace>bubblesortcpp</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="bubble_sort_cpp.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View 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="bubble_sort_cpp.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>

View 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>

View File

@ -0,0 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>
</Project>

View File

@ -0,0 +1,68 @@
{
"format": 1,
"restore": {
"C:\\Users\\kmate\\source\\repos\\bubble_sort_cs\\bubble_sort_cs\\bubble_sort_cs.csproj": {}
},
"projects": {
"C:\\Users\\kmate\\source\\repos\\bubble_sort_cs\\bubble_sort_cs\\bubble_sort_cs.csproj": {
"version": "1.0.0",
"restore": {
"projectUniqueName": "C:\\Users\\kmate\\source\\repos\\bubble_sort_cs\\bubble_sort_cs\\bubble_sort_cs.csproj",
"projectName": "bubble_sort_cs",
"projectPath": "C:\\Users\\kmate\\source\\repos\\bubble_sort_cs\\bubble_sort_cs\\bubble_sort_cs.csproj",
"packagesPath": "C:\\Users\\kmate\\.nuget\\packages\\",
"outputPath": "C:\\Users\\kmate\\source\\repos\\bubble_sort_cs\\bubble_sort_cs\\obj\\",
"projectStyle": "PackageReference",
"fallbackFolders": [
"C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages",
"C:\\Program Files (x86)\\Microsoft\\Xamarin\\NuGet\\"
],
"configFilePaths": [
"C:\\Users\\kmate\\AppData\\Roaming\\NuGet\\NuGet.Config",
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.FallbackLocation.config",
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config",
"C:\\Program Files (x86)\\NuGet\\Config\\Xamarin.Offline.config"
],
"originalTargetFrameworks": [
"net5.0"
],
"sources": {
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
"https://api.nuget.org/v3/index.json": {}
},
"frameworks": {
"net5.0": {
"targetAlias": "net5.0",
"projectReferences": {}
}
},
"warningProperties": {
"warnAsError": [
"NU1605"
]
}
},
"frameworks": {
"net5.0": {
"targetAlias": "net5.0",
"imports": [
"net461",
"net462",
"net47",
"net471",
"net472",
"net48"
],
"assetTargetFallback": true,
"warn": true,
"frameworkReferences": {
"Microsoft.NETCore.App": {
"privateAssets": "all"
}
},
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\5.0.403\\RuntimeIdentifierGraph.json"
}
}
}
}
}

View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<RestoreSuccess Condition=" '$(RestoreSuccess)' == '' ">True</RestoreSuccess>
<RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool>
<ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">$(MSBuildThisFileDirectory)project.assets.json</ProjectAssetsFile>
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">$(UserProfile)\.nuget\packages\</NuGetPackageRoot>
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">C:\Users\kmate\.nuget\packages\;C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages;C:\Program Files (x86)\Microsoft\Xamarin\NuGet\</NuGetPackageFolders>
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">5.11.0</NuGetToolVersion>
</PropertyGroup>
<ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<SourceRoot Include="C:\Users\kmate\.nuget\packages\" />
<SourceRoot Include="C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages\" />
<SourceRoot Include="C:\Program Files (x86)\Microsoft\Xamarin\NuGet\" />
</ItemGroup>
<PropertyGroup>
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
</PropertyGroup>
</Project>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
</PropertyGroup>
</Project>

View File

@ -0,0 +1,42 @@
var size_array = 0;
function sort_func(sortA, len, repeat) {
var sort = [];
// Loop through array values
for (var value of sortA) {
sort.push(value);
}
size_array = sort.length;
len = len - 1;
var t = true;
var j = 0;
while (t) {
for (var i = 0; i <= len - 1; i++) {
if (sort[i] > sort[i + 1]) {
var tmp = sort[i];
sort[i] = sort[i + 1];
sort[i + 1] = tmp;
j = 0;
} else if (sort[i] == sort[i + 1] && !repeat) {
var del = i;
for (var a = del - 1; a < len; a++) {
sort[del] = sort[del + 1];
del++;
}
size_array--;
len--;
j = 0;
} else {
if (j == len) t = false;
else j++;
}
}
}
return sort;
}
var to_sort = [1, 3, 1, 4, 254, 23, 423, 2, 1, 2, 3];
var sorted = sort_func(to_sort, to_sort.length, true);
for (var i = 0; i <= size_array - 1; i++) document.write(sorted[i] + "<br>");

View File

@ -0,0 +1,49 @@
<?php
$size_array=0;
function sort_func($sort,$len,$repeat)
{
$len = $len - 1;
$t = true;
$j = 0;
while ($t)
{
for ($i = 0; $i <= $len - 1; $i++)
{
if ($sort[$i] > $sort[$i + 1])
{
$tmp = $sort[$i];
$sort[$i] = $sort[$i + 1];
$sort[$i + 1] = $tmp;
$j = 0;
}
else if ($sort[$i] == $sort[$i + 1]&& !$repeat)
{
$del = $i;
for ($a = $del - 1; $a < $len; $a++){
$sort[$del] = $sort[$del + 1];
$del++;
}
$size_array--;
$len--;
$j = 0;
}
else
{
if ($j == $len)
$t = false;
else
$j++;
}
}
}
return $sort;
}
$to_sort=array(1, 223, 54, 32,1,2,3,5,1,1,1,64);
$sorted= & sort_func($to_sort,count($to_sort),false);
for($i=0;$i<=count($sorted)-1;$i++)
echo "$sorted[$i] \n";