-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
71 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 17 | ||
VisualStudioVersion = 17.4.33213.308 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Linear Data Structures", "Linear Data Structures\Linear Data Structures.csproj", "{D402A62E-E049-465B-92A3-4A5D3A3144F7}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{D402A62E-E049-465B-92A3-4A5D3A3144F7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{D402A62E-E049-465B-92A3-4A5D3A3144F7}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{D402A62E-E049-465B-92A3-4A5D3A3144F7}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{D402A62E-E049-465B-92A3-4A5D3A3144F7}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {1F6A6880-EB9B-4410-B747-11D34EC4ECCC} | ||
EndGlobalSection | ||
EndGlobal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net6.0</TargetFramework> | ||
<RootNamespace>Linear_Data_Structures</RootNamespace> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
using System; | ||
using System.Collections; | ||
|
||
// | ||
class MainClass | ||
{ | ||
public static void Main(string[] args) | ||
{ | ||
//2. | ||
Console.WriteLine("N Integers (uses spaces between numbers):"); | ||
int[] arr = Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); | ||
for (int i = (arr.Length-1); i > -1; i--)//read top to bottom | ||
{ | ||
Console.WriteLine(arr[i]); | ||
} | ||
|
||
//7. | ||
int[] array = { 10, 5, 10, 2, 2, 3, 4, 5, 5, 6, 7, 8, 9, 11, 12, 12 }; | ||
var dict = new Dictionary<int, int>(); | ||
|
||
foreach (var value in array) | ||
{ | ||
// When the key is not found, "count" will be initialized to 0 | ||
dict.TryGetValue(value, out int count); | ||
dict[value] = count + 1; | ||
} | ||
|
||
foreach (var pair in dict) | ||
Console.WriteLine("Value {0} counted {1} times.", pair.Key, pair.Value); | ||
Console.ReadKey(); | ||
|
||
//9. | ||
} | ||
|
||
} |