
This video gives glimpse of the entire course.
As a developer, you have certainly heard about many programming languages, such as C#, Java, C++, C, PHP, or Ruby. In all of them, you can use various data structures, as well as implement algorithms, to solve both basic and complex problems.
In this video, we will introduce the basic information about a few programming languages and data types.
Understand the concept of Object, class and interface
Example: Declare a variable in the C# programming language
Create enumeration for available languages or supported currencies and use defined enumeration as a data type
In this video, we will learn the steps of installing Visual Studio Community 2017 and setting up the environment.
Create a new project
Understand the properties and functions of the IDE
In this video we will learn operations related to the standard output stream performed using methods of the Console static class from the System namespace, namely Write and WriteLine.
Using ReadLine method, read data of other types, such as int.
Call the Write method and pass the text as a parameter
The arrays have a lot of possibilities. However, generic lists available while developing in the C# language are even more powerful. A single-dimensional array stores a collection of items of the same type, which are accessible by an index.
Declare and initialize array with an integer and default value
Example – month names
The arrays in the C# language do not need to have only one dimension. It is also possible to create two-dimensional or even three-dimensional arrays.
Declare and initialize two-dimensional array with 5 rows and 2 columns
Example – multiplication table
Example – game map
In this video we will look at the last variant of arrays that is Jagged array Also we will understand the difference between the arrays
Analyze array by observing the diagram
Example – yearly transport plan
There are many algorithms that perform various operations on arrays. However, one of the most common tasks is sorting an array to arrange its elements in the correct order, In this video, we will look at a couple of approaches, including selection sort and insertion sort
Divide array into two parts, namely sorted and unsorted
Test implementation of the selection sort algorithm
In this video we will proceed further to learn the remaining approaches of the sorting algorithm. Use two loops, and compare adjacent elements
Use two loops, and compare adjacent elements
Use recursion to call sorting method for subarrays
Arrays are really useful data structures and they are applied in many algorithms. However, in some cases their application could be complicated due to their nature, which does not allow to increase or decrease the length of the already-created array.
Use foreach loop to iterate through all items
Generic list Example – average value
Generic list Example – list of people
In this video we will introduce 2 types of lists that is Sorted and linked list. Sorted list stores the key-value pairs, you have also access to the Keys and Values properties. Particular keys and values can be easily obtained using the index and the [] operator.
Add an element to the collection using the Add method
Use ContainsKey and ContainsValue for checking whether the collection contains an item with a given key or value
Example – address book and book reader
In this video, we will look at the implementation of the circular-linked list that can be created as a generic class and extends LinkedList
Use CircularLinkedListEnumerator class and implement GetEnumerator method
Example – spin the wheel
Create a new instance of the CircularLinkedList class and add eight values
In this video, we will learn the basic concept of stack. It is an easy-to-understand data structure and can be represented using the example of a pile of many plates, each placed on top of the other. You can only add a new plate to the top of the pile, and you can only get a plate from the top of the pile.
Learn stack with diagrammatic representation
Example – reversing words
Example – Tower of Hanoi
In this video, we will learn Queue. The queue data structure operates in exactly the same way. You can only add new elements at the end of the queue (the enqueue operation) and remove an element from the queue only from the beginning of the queue (the dequeue operation).
Introduce Queue concept with diagrammatic representation
Example – call center with a single consultant
Example – call center with many consultants
A priority queue makes it possible to extend the concept of a queue by setting priority for each element in the queue. Priority can be specified simply as an integer value. However, it depends on the implementation whether smaller or greater values indicate higher priority.
Analyzing the diagram, learn the concept of priority queue
Example – call center with priority support
One of the most important assumptions of the hash table is the possibility of very fast lookup for a Value based on the Key, which should be the O(1) operation. To achieve this goal, the Hash function is used. It takes the Key to generate an index of a bucket, where the Value can be found.
Get access to a particular element using the indexer
Cast the returned result to the proper type (for example, string)
Example – phone book
In the previous video, you got to know the Hashtable class as a non-generic variant of the hash table-related classes. However, it has a significant limitation, because it does not allow you to specify a type of a key and a value. Both the Key and Value properties of the DictionaryEntry class are of the object type.
Create new instance of the Dictionary class
Use indexer to get access to a particular element within the collection
Example – product location
Both non-generic and generic variants of the hash table-related classes do not keep the order of the elements. For this reason, if you need to present data from the collection sorted by keys, you need to sort them prior to presentation. However, you can use another data structure, the sorted dictionary, to solve this problem and keep keys sorted all the time.
Get access to the element and add new element or update a value of the existing one
Example – definitions
In this video, we will understand the basic concept of Sets. While developing applications in the C# language, you can benefit from high-performance operations provided by the HashSet class.
Understand the concepts of Hash sets
Example – coupons
Example – swimming pools
The "sorted" set can be used if you want to have a sorted collection of distinct objects without duplicated elements. The suitable class is named SortedSet
Example – removing duplicates
A tree consists of multiple nodes, including one root. The root does not contain a parent node, while all other nodes do. The C#-based implementation of a basic tree seems to be quite obvious and not complicated. To do so, you can declare two classes, representing a single node and a whole tree
Use Root property to get access to root node, and Children property to obtain data of other nodes
Example – hierarchy of identifiers
Example – company structure
Each node in a basic tree can contain any number of children. However, in the case of binary trees, a node cannot contain more than two children.
Assign a default value to the Children property in the constructor
Example – simple quiz
Binary search tree data structure, which is also referred to as BST. It is a kind of a binary tree that introduces two strict rules regarding relations between nodes in the tree. The implementation of a BST is more difficult than the previously-described variants of trees.
Represent single node in a tree
Represent whole tree by an instance of the BinarySearchTree class
Check whether the tree contains a node with a given value
Data structures allow us to organize data efficiently. They are critical to various problems and their suitable implementation can provide a complete solution that acts like reusable code. In this course, you will learn how to use various data structures while developing in the C# language as well as how to implement some of the most common algorithms used with such data structures.
Initially, you will get to know arrays, lists, dictionaries, and sets together with real-world examples of your application. Then you will learn how to create and use stacks and queues. In the following part of the book, more complex data structures will be introduced—trees and graphs—together with some algorithms for searching the shortest path in a graph. We will also discuss how to organize code in a manageable, consistent, and extendable way. By the end of the course, you will have learned how to build components that are easy to understand, debug, and use in different applications.
About the Author
Marcin Jamro, PhD, is an entrepreneur and researcher, as well as a developer and architect of various kinds of applications. He is the President of the Board at TITUTO Sp. z o.o. [Ltd.] in Rzeszów, Poland.
Marcin is interested in many aspects of computer science, including software engineering and project management. He is the author of two other books—Windows Phone 8 Game Development (2013) and Windows Application Development Cookbook (2017), both by Packt Publishing.
Marcin has published several papers, participated in many conferences, organized a few of them, and participated in two internships at Microsoft in Redmond, USA. He has MCP, MCTS, and MCPD certificates.