Coder Social home page Coder Social logo

c-sharp-data-structures-and-algorithms---second-edition's Introduction

C# Data Structures and Algorithms

no-image

This is the code repository for C# Data Structures and Algorithms, published by Packt.

Harness the power of C# to build a diverse range of efficient applications

What is this book about?

Explore efficient data organization in C# with this guide to implementing and utilizing diverse data structures, along with common algorithms, offering reusable solutions for effective development.

This book covers the following exciting features:

  • Understand the fundamentals of algorithms and their classification
  • Store data using arrays and lists, and explore various ways to sort arrays
  • Build enhanced applications with stacks, queues, hashtables, dictionaries, and sets
  • Create efficient applications with tree-related algorithms, such as for searching in a binary search tree
  • Boost solution efficiency with graphs, including finding the shortest path in the graph
  • Implement algorithms solving Tower of Hanoi and Sudoku games, generating fractals, and even guessing the title of this book

If you feel this book is for you, get your copy today!

Instructions and Navigations

All of the code is organized into folders. For example, Chapter03.

The code will look like the following:

int[,] numbers = new int[,]
{
{ 9, 5, -9 },
{ -11, 4, 0 },
{ 6, 115, 3 },
{ -12, -9, 71 },
{ 1, -6, -1 }
};

Following is what you need for this book: This book is for developers looking to learn data structures and algorithms in C#. While basic programming skills and C# knowledge is useful, beginners will find value in the provided code snippets, illustrations, and detailed explanations, enhancing their programming skills. Advanced developers can use this book as a valuable resource for reusable code snippets, instead of writing algorithms from scratch each time.

Related products

Get to Know the Author

Marcin Jamro, PhD, DSc is an entrepreneur, expert and experienced developer with significant international experience. He held the role of CEO at a few IT companies, operated as CTO at projects in various countries, as well as worked at Microsoft Corporation in Redmond, USA. He is the author of a few books and numerous publications. The results of his research have been presented and discussed at many scientific conferences. He has MCPD, MCTS, MCP and CAE certificates. Marcin is a multiple laureate, finalist and mentor in various competitions. He has significant experience in project development, especially .NET-based, and shares his knowledge as an expert in domestic and international projects, as well as invests in modern solutions.

Other books by the author

c-sharp-data-structures-and-algorithms---second-edition's People

Contributors

marcinjamro avatar packt-nithya avatar rajdeep-packt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

c-sharp-data-structures-and-algorithms---second-edition's Issues

Chapter08 broken

In Chapter08 the dependencies are broken expecting "..\08-Graph\08-Graph.csproj" but actual is "..\Graph\08-Graph.csproj",

Severity	Code	Description	Project	File	Line	Suppression State
Warning		The referenced project '..\08-Graph\08-Graph.csproj' does not exist.	08-DirectedWeightedEdges	C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets	2153	
Warning		The referenced project '..\08-Graph\08-Graph.csproj' does not exist.	08-PathInGame	C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets	2153	
Warning		The referenced project '..\08-Graph\08-Graph.csproj' does not exist.	08-TelecommunicationCable	C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets	2153	
Warning		The referenced project '..\08-Graph\08-Graph.csproj' does not exist.	08-UndirectedUnweightedEdges	C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets	2153	
Warning		The referenced project '..\08-Graph\08-Graph.csproj' does not exist.	08-VoivodeshipMap	C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets	2153	

failing

  • DirectedWeightedEdges
  • PathInGame
  • TelecommunicationCable
  • UndirectedUnweightedEdges
  • VoivodeshipMap

F:\MarcinJ>tree

Folder PATH listing for volume Training
Volume serial number is 9CBD-A162
...
├───Chapter08
│   ├───DirectedWeightedEdges
│   ├───Graph
│   ├───PathInGame
│   ├───TelecommunicationCable
│   ├───UndirectedUnweightedEdges
│   └───VoivodeshipMap
...

because the actual independent project saught is (note "Graph" vs "08-Graph") ..

F:\MarcinJ>type Chapter08\DirectedWeightedEdges\08-DirectedWeightedEdges.csproj
<Project Sdk="Microsoft.NET.Sdk">
        <PropertyGroup>
                <OutputType>Exe</OutputType>
                <TargetFramework>net8.0</TargetFramework>
                <RootNamespace>_08_DirectedWeightedEdges</RootNamespace>
                <ImplicitUsings>enable</ImplicitUsings>
                <Nullable>enable</Nullable>
        </PropertyGroup>

        <ItemGroup>
                <ProjectReference Include="..\08-Graph\08-Graph.csproj" />
        </ItemGroup>

</Project>

F:\MarcinJ>

Unclear when this error has arisen (e.g. author code or polishing by Packt), and sad no reviewer caught these errors
thus Chapter08 as friday-edit-ship is almost identical to the train-wreck of Chapter07 (Issue #5, PR #6)

I will shortly provide a PR to address this mismatch, and my approach will be to fix those 5 dependent parents
I accept that changing that single independent child would be an alternate fix

Chapter07 broken

In Chapter07 the dependencies are broken expecting "..\07-Tree\07-Tree.csproj", whereas actual is "..\Tree\07-Tree.csproj", failing

  • BSTVisualization
  • CompanyStructure
  • HierarchyOfIdentifiers
  • SimpleQuiz

e.g. errors

Severity	Code	Description	Project	File	Line	Suppression State
Error	NU1104	Unable to find project 'F:\MarcinJ\Chapter07\07-Tree\07-Tree.csproj'. Check that the project reference is valid and that the project file exists.	07-BSTVisualization	F:\MarcinJ\Chapter07\BSTVisualization\07-BSTVisualization.csproj	1	
Warning		The referenced project '..\07-Tree\07-Tree.csproj' does not exist.	07-BSTVisualization	C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets	2153	

bacause those .csproj files are expecting "..\07-Tree\07-Tree.csproj", e.g. [note the "Include=" part]

F:\MarcinJ>type Chapter07\BSTVisualization\07-BSTVisualization.csproj
<Project Sdk="Microsoft.NET.Sdk">

	<PropertyGroup>
		<OutputType>Exe</OutputType>
		<TargetFramework>net8.0</TargetFramework>
		<RootNamespace>_07_BSTVisualization</RootNamespace>
		<ImplicitUsings>enable</ImplicitUsings>
		<Nullable>enable</Nullable>
	</PropertyGroup>

	<ItemGroup>
		<ProjectReference Include="..\07-Tree\07-Tree.csproj" />
	</ItemGroup>

</Project>

because the actual independent project saught is (note "Tree" and not "07-Tree")

F:\MarcinJ>tree
Folder PATH listing for volume training
Volume serial number is 9CBD-A162
...
├───Chapter07
│   ├───AutoComplete
│   ├───BSTVisualization
│   ├───CompanyStructure
│   ├───HierarchyOfIdentifiers
│   ├───SimpleQuiz
│   └───Tree
...

Unclear when this error has arisen (e.g. author code or QA polishing by Packt), and sad no reviewer caught these errors.

I will shortly provide a PR to address this mismatch, and my approach will be to fix those 4 dependent parents
I accept that changing that single independent child would be an alternate fix

needs standard GH files to avoid junk files by a PR

There should be standard files used within GH ecosystem for every repository project, e.g.

  • .gitignore to avoid polluting a PR with a mess of bin, obj etc files when committing changes
  • .gitattributes to set defaults to automatically normalize line endings, and diff/merge behaviour
  • .editorconfig settings to standardise code styles etc

as I will be submitting several PRs, it seems sensible to start with these basics.

Chapter03\SortingAlgorithms project doesn't compile due to mistakes in SelectionSort.cs

After downloading the companion code from Pack for the "C# Data Structures and Algorithms - Second Edition" [ISBN 9781803248271]
https://www.packtpub.com/product/c-data-structures-and-algorithms-second-edition/9781803248271
Download code from GitHub
that redirects to the common repository
https://github.com/PacktPublishing/C-Sharp-Data-Structures-and-Algorithms---Second-Edition/tree/main

but unfortunately not all the code samples actually compile! This Issue reports failures within Chapter03\SortingAlgorithms project

Severity	Code	Description	Project	File	Line	Suppression State
Error	CS0118	'SelectionSort' is a namespace but is used like a type	03-SortingAlgorithms	F:\MarcinJ\Chapter03\SortingAlgorithms\Program.cs	9	Active

Warning	CS7022	The entry point of the program is global code; ignoring 'Program.Main(string[])' entry point.	03-SortingAlgorithms	F:\MarcinJ\Chapter03\SortingAlgorithms\SelectionSort.cs	34	Active

In SelectionSort.cs just prior to class definition has a spurious definition of AbstractSort
this conflicts with the correct definition in AbstractSort.cs

Likewise the SelectionSort.cs also contains a spurious Program class (and static void Main entry point) that VS sensibly ignores with CS7022 warning, and the CSC implies the SVM for the actual top-level Program.cs

Because the class definition lacks the public assessor
class SelectionSort : AbstractSort
the Program tries to bind to the namespace instead and raises CS0260 error

Easy to make public
public class SelectionSort : AbstractSort
but [to be equivalent to other *.cs files] also better to suppress the local block namespace as already defaulted in .csproj by
<RootNamespace>_03_SortingAlgorithms</RootNamespace>

I will now raise a PR hoping that Packt and author Dr Marcin Jamro will agree [to the benefit of subsequent subscribers]
(I'm also hoping that each of these PRs will merit Packt awarding me an extra Credit to offset my time & effort!)

BTW this PR builds on my earlier PR #2 (Issue #1) so I hope that Packt & Marcin have already accepted that.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.