Skip to content

Commit acdffed

Browse files
Cleaning.
1 parent 098bcb7 commit acdffed

File tree

10 files changed

+966
-971
lines changed

10 files changed

+966
-971
lines changed

AlgorithmnsExercises.sln

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Medium_Algorithms", "Algori
5959
EndProject
6060
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Medium_Algorithms.Tests", "Algorithms\Medium_Algorithms.Tests\Medium_Algorithms.Tests.csproj", "{2BC2240B-D0B5-4D9B-85CD-E94F37C32612}"
6161
EndProject
62+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "UnitTests", "UnitTests", "{6E89BAD5-E13B-45FE-AC68-F243FEB41464}"
63+
EndProject
6264
Global
6365
GlobalSection(SolutionConfigurationPlatforms) = preSolution
6466
Debug|Any CPU = Debug|Any CPU
@@ -161,25 +163,25 @@ Global
161163
{D5CCEB3D-5A7B-4C80-A670-3D9737ABDA7C} = {C386E126-8666-4447-B75E-2256E563A1DA}
162164
{24F5D8C8-5E51-40AE-9D9D-293C4D5C745B} = {E047B6E0-EA10-457F-A029-8E0F126D5DD1}
163165
{607A12AE-23BF-44E0-A2B8-37BCAF473D65} = {9662C415-1979-476B-8B5D-EF158CC26A91}
164-
{0DEBEE20-22FC-407F-A659-CAF621B8A845} = {9662C415-1979-476B-8B5D-EF158CC26A91}
165166
{983AB1DA-8F24-498E-BA59-025D993BA512} = {D5CCEB3D-5A7B-4C80-A670-3D9737ABDA7C}
166-
{0DA923FD-2432-4EBA-8489-C036D68FB05D} = {D5CCEB3D-5A7B-4C80-A670-3D9737ABDA7C}
167167
{BB4D864A-0EEA-4179-8C04-2A409F9888EB} = {D5CCEB3D-5A7B-4C80-A670-3D9737ABDA7C}
168-
{4044BAD4-D394-459D-83D5-D8CC5F9855F5} = {D5CCEB3D-5A7B-4C80-A670-3D9737ABDA7C}
169168
{C5CBF5BD-2189-4054-8B4C-EEA6BC4502A8} = {D5CCEB3D-5A7B-4C80-A670-3D9737ABDA7C}
170-
{934FB562-E16A-4225-BB13-6708A9137364} = {D5CCEB3D-5A7B-4C80-A670-3D9737ABDA7C}
171169
{7E71F0AA-0BF1-47FB-82A2-162885C6D428} = {D5CCEB3D-5A7B-4C80-A670-3D9737ABDA7C}
172-
{C3C9D3E6-CBD7-488B-936F-AE6F6B36BEC3} = {D5CCEB3D-5A7B-4C80-A670-3D9737ABDA7C}
173170
{6053CF41-ED7F-4C7B-BBDA-3822D6DD03EE} = {D5CCEB3D-5A7B-4C80-A670-3D9737ABDA7C}
174-
{8DE4F7CF-A22E-4810-ADCC-04D73A783A7C} = {D5CCEB3D-5A7B-4C80-A670-3D9737ABDA7C}
175171
{63B30ADF-3A16-4060-BA93-5A80853F1330} = {D5CCEB3D-5A7B-4C80-A670-3D9737ABDA7C}
176-
{E0CFFE8B-E2E9-4E32-87D1-016B1C29636E} = {D5CCEB3D-5A7B-4C80-A670-3D9737ABDA7C}
177172
{BB31A457-A130-47E6-86E9-08C95773A5F1} = {D5CCEB3D-5A7B-4C80-A670-3D9737ABDA7C}
178-
{A1A9F596-76F9-427F-94DE-A8D2B19847E1} = {D5CCEB3D-5A7B-4C80-A670-3D9737ABDA7C}
179173
{359A92AA-BAB8-409B-BB17-802CB98A5BB0} = {D5CCEB3D-5A7B-4C80-A670-3D9737ABDA7C}
180-
{E9B377DA-68F5-4D14-81A0-0730E1D46F94} = {D5CCEB3D-5A7B-4C80-A670-3D9737ABDA7C}
181174
{145C1215-9B40-4568-A0FA-3742BE12574E} = {B6D795F9-DCD6-4A0E-A2A7-6DE36D63F083}
182-
{2BC2240B-D0B5-4D9B-85CD-E94F37C32612} = {B6D795F9-DCD6-4A0E-A2A7-6DE36D63F083}
175+
{0DEBEE20-22FC-407F-A659-CAF621B8A845} = {6E89BAD5-E13B-45FE-AC68-F243FEB41464}
176+
{2BC2240B-D0B5-4D9B-85CD-E94F37C32612} = {6E89BAD5-E13B-45FE-AC68-F243FEB41464}
177+
{0DA923FD-2432-4EBA-8489-C036D68FB05D} = {6E89BAD5-E13B-45FE-AC68-F243FEB41464}
178+
{4044BAD4-D394-459D-83D5-D8CC5F9855F5} = {6E89BAD5-E13B-45FE-AC68-F243FEB41464}
179+
{934FB562-E16A-4225-BB13-6708A9137364} = {6E89BAD5-E13B-45FE-AC68-F243FEB41464}
180+
{C3C9D3E6-CBD7-488B-936F-AE6F6B36BEC3} = {6E89BAD5-E13B-45FE-AC68-F243FEB41464}
181+
{8DE4F7CF-A22E-4810-ADCC-04D73A783A7C} = {6E89BAD5-E13B-45FE-AC68-F243FEB41464}
182+
{E0CFFE8B-E2E9-4E32-87D1-016B1C29636E} = {6E89BAD5-E13B-45FE-AC68-F243FEB41464}
183+
{A1A9F596-76F9-427F-94DE-A8D2B19847E1} = {6E89BAD5-E13B-45FE-AC68-F243FEB41464}
184+
{E9B377DA-68F5-4D14-81A0-0730E1D46F94} = {6E89BAD5-E13B-45FE-AC68-F243FEB41464}
183185
EndGlobalSection
184186
GlobalSection(ExtensibilityGlobals) = postSolution
185187
SolutionGuid = {B236DD2A-F3D2-471E-805D-C9952324EAEA}

Algorithms/Easy_Algorithms.Tests/Easy_Algorithms.Tests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net7.0</TargetFramework>
4+
<TargetFramework>net9.0</TargetFramework>
55
<ImplicitUsings>enable</ImplicitUsings>
66
<Nullable>enable</Nullable>
77

Algorithms/Easy_Algorithms.Tests/GlobalUsings.cs

Lines changed: 0 additions & 1 deletion
This file was deleted.

Algorithms/Easy_Algorithms.Tests/UnitTest1.cs

Lines changed: 79 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -1,75 +1,82 @@
1-
using Microsoft.VisualStudio.TestPlatform.TestHost;
1+
2+
using Xunit;
23
using static Easy_Algorithms.EasyAlgorithmsClass;
34

45
namespace Easy_Algorithms.Tests
56
{
67
public class EasyAlgorithmsUnitTest
78
{
89
#region InsertionSort
9-
[Fact]
10-
public void InsertionSortTest1()
11-
{
12-
int[] expected = { 2, 3, 5, 5, 6, 8, 9 };
13-
int[] input = { 8, 5, 2, 9, 5, 6, 3 };
14-
Assert.True(compare(InsertionSortClass.InsertionSort(input), expected));
15-
}
16-
#endregion
17-
18-
#region BubbleSort
19-
[Fact]
20-
public void BubbleSortTestCase1()
21-
{
22-
int[] expected = { 2, 3, 5, 5, 6, 8, 9 };
23-
int[] input = { 8, 5, 2, 9, 5, 6, 3 };
24-
Assert.True(compare(BubbleSortClass.BubbleSort(input), expected));
25-
}
26-
27-
//public static bool compare(int[] arr1, int[] arr2)
28-
//{
29-
// if (arr1.Length != arr2.Length)
30-
// {
31-
// return false;
32-
// }
33-
// for (int i = 0; i < arr1.Length; i++)
34-
// {
35-
// if (arr1[i] != arr2[i])
36-
// {
37-
// return false;
38-
// }
39-
// }
40-
// return true;
41-
//}
42-
#endregion
43-
44-
#region FindThreeLargestNumbers
45-
[Fact]
46-
public void FindThreeLargestNumbersTestCase1()
47-
{
48-
int[] expected = { 18, 141, 541 };
49-
Assert.True(compare(
50-
FindThreeLargestNumbersClass.FindThreeLargestNumbers(
51-
new int[] { 141, 1, 17, -7, -17, -27, 18, 541, 8, 7, 7 }
52-
),
53-
expected
54-
));
55-
}
56-
57-
public bool compare(int[] arr1, int[] arr2)
58-
{
59-
if (arr1.Length != arr2.Length)
60-
{
61-
return false;
62-
}
63-
for (int i = 0; i < arr1.Length; i++)
64-
{
65-
if (arr1[i] != arr2[i])
66-
{
67-
return false;
68-
}
69-
}
70-
return true;
71-
}
10+
// [Fact]
11+
// public void InsertionSortTest1()
12+
// {
13+
// int[] expected = { 2, 3, 5, 5, 6, 8, 9 };
14+
// int[] input = { 8, 5, 2, 9, 5, 6, 3 };
15+
// Assert.True(compare(InsertionSortClass.InsertionSort(input), expected));
16+
// }
7217
#endregion
18+
//
19+
// #region BubbleSort
20+
// [Fact]
21+
// public void BubbleSortTestCase1()
22+
// {
23+
// int[] expected = { 2, 3, 5, 5, 6, 8, 9 };
24+
// int[] input = { 8, 5, 2, 9, 5, 6, 3 };
25+
// Assert.True(compare(BubbleSortClass.BubbleSort(input), expected));
26+
// }
27+
//
28+
// /// <summary>
29+
// ///
30+
// /// </summary>
31+
// /// <param name="arr1"></param>
32+
// /// <param name="arr2"></param>
33+
// /// <returns></returns>
34+
// public static bool compare(int[] arr1, int[] arr2)
35+
// {
36+
// if (arr1.Length != arr2.Length)
37+
// {
38+
// return false;
39+
// }
40+
// for (int i = 0; i < arr1.Length; i++)
41+
// {
42+
// if (arr1[i] != arr2[i])
43+
// {
44+
// return false;
45+
// }
46+
// }
47+
// return true;
48+
// }
49+
// #endregion
50+
//
51+
// #region FindThreeLargestNumbers
52+
// [Fact]
53+
// public void FindThreeLargestNumbersTestCase1()
54+
// {
55+
// int[] expected = { 18, 141, 541 };
56+
// Assert.True(compare(
57+
// FindThreeLargestNumbersClass.FindThreeLargestNumbers(
58+
// new int[] { 141, 1, 17, -7, -17, -27, 18, 541, 8, 7, 7 }
59+
// ),
60+
// expected
61+
// ));
62+
// }
63+
//
64+
// public bool compare(int[] arr1, int[] arr2)
65+
// {
66+
// if (arr1.Length != arr2.Length)
67+
// {
68+
// return false;
69+
// }
70+
// for (int i = 0; i < arr1.Length; i++)
71+
// {
72+
// if (arr1[i] != arr2[i])
73+
// {
74+
// return false;
75+
// }
76+
// }
77+
// return true;
78+
// }
79+
// #endregion
7380

7481
#region ProductSum
7582
[Fact]
@@ -555,14 +562,14 @@ public void TestCase1()
555562
#endregion
556563

557564
#region TwoNumberSum
558-
[Fact]
559-
public void TwoNumberSumTest1()
560-
{
561-
int[] output = new TwoNumberSumClass().TwoNumberSum(new int[] { 3, 5, -4, 8, 11, 1, -1, 6 }, 10);
562-
Assert.True(output.Length == 2);
563-
Assert.True(Array.Exists(output, e => e == -1));
564-
Assert.True(Array.Exists(output, e => e == 11));
565-
}
565+
// [Fact]
566+
// public void TwoNumberSumTest1()
567+
// {
568+
// int[] output = new TwoNumberSumClass().TwoNumberSum(new int[] { 3, 5, -4, 8, 11, 1, -1, 6 }, 10);
569+
// Assert.True(output.Length == 2);
570+
// Assert.True(Array.Exists(output, e => e == -1));
571+
// Assert.True(Array.Exists(output, e => e == 11));
572+
// }
566573
#endregion
567574

568575
#region SumTwoSmallestNumbers

Algorithms/Easy_Algorithms/EasyAlgorithmsClass.cs

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -5,43 +5,43 @@ namespace Easy_Algorithms
55
{
66
public class EasyAlgorithmsClass
77
{
8-
#region TwoNumberSum
9-
public class TwoNumberSumClass
10-
{
11-
/// <summary>
12-
/// Write a function that takes in a non-empty array of distinct integers and an integer
13-
/// representing a target sum. If any two numbers in the input array sum the target sum,
14-
/// the function should return them in an array, in any order. If no two numbers sum up to
15-
/// to the target sum up to the target sum, the function should return an empty.
16-
///
17-
/// Note that the target sum has to be obtained by summing two different integers in
18-
/// the array; you can't add a single integer to itself in order to obtain the target sum.
19-
///
20-
/// You can assume that there will be at most pair of numbers summing up to the target sum.
21-
/// </summary>
22-
/// <param name="array"></param>
23-
/// <param name="targetSum"></param>
24-
/// <returns></returns>
25-
/// <exception cref="NotImplementedException"></exception>
26-
public int[] TwoNumberSum(int[] array, int targetSum)
27-
{
28-
for (var i = 0; i < array.Length - 1; i++)
29-
{
30-
var firstNum = array[i];
31-
for (var j = i + 1; j < array.Length; j++)
32-
{
33-
var secondNum = array[j];
34-
if (firstNum + secondNum == targetSum)
35-
{
36-
return new int[] { firstNum, secondNum };
37-
}
38-
}
39-
}
40-
41-
return Array.Empty<int>();
42-
}
43-
}
44-
#endregion
8+
// #region TwoNumberSum
9+
// public class TwoNumberSumClass
10+
// {
11+
// /// <summary>
12+
// /// Write a function that takes in a non-empty array of distinct integers and an integer
13+
// /// representing a target sum. If any two numbers in the input array sum the target sum,
14+
// /// the function should return them in an array, in any order. If no two numbers sum up to
15+
// /// to the target sum up to the target sum, the function should return an empty.
16+
// ///
17+
// /// Note that the target sum has to be obtained by summing two different integers in
18+
// /// the array; you can't add a single integer to itself in order to obtain the target sum.
19+
// ///
20+
// /// You can assume that there will be at most pair of numbers summing up to the target sum.
21+
// /// </summary>
22+
// /// <param name="array"></param>
23+
// /// <param name="targetSum"></param>
24+
// /// <returns></returns>
25+
// /// <exception cref="NotImplementedException"></exception>
26+
// public int[] TwoNumberSum(int[] array, int targetSum)
27+
// {
28+
// for (var i = 0; i < array.Length - 1; i++)
29+
// {
30+
// var firstNum = array[i];
31+
// for (var j = i + 1; j < array.Length; j++)
32+
// {
33+
// var secondNum = array[j];
34+
// if (firstNum + secondNum == targetSum)
35+
// {
36+
// return [firstNum, secondNum];
37+
// }
38+
// }
39+
// }
40+
//
41+
// return Array.Empty<int>();
42+
// }
43+
// }
44+
// #endregion
4545

4646
#region IsValidSubsequence
4747
/// <summary>

Algorithms/Easy_Algorithms/Easy_Algorithms.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net7.0</TargetFramework>
4+
<TargetFramework>net9.0</TargetFramework>
55
<ImplicitUsings>enable</ImplicitUsings>
66
<Nullable>enable</Nullable>
77
</PropertyGroup>

Algorithms/Medium_Algorithms.Tests/GlobalUsings.cs

Lines changed: 0 additions & 1 deletion
This file was deleted.

Algorithms/Medium_Algorithms.Tests/Medium_Algorithms.Tests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net6.0</TargetFramework>
4+
<TargetFramework>net9.0</TargetFramework>
55
<ImplicitUsings>enable</ImplicitUsings>
66
<Nullable>enable</Nullable>
77

0 commit comments

Comments
 (0)