Surprisingly, you will notice that we have already used these data structures before, without knowing they were data structures: the class and the structure. Whenever we instantiate one of these, we are actually using it as a data structure (more or less).… Read more

## Archive for the ‘Data Structures’ Category

### Other Data Structures

Saturday, June 16th, 2018### Sorted Set

Saturday, June 16th, 2018* Sorted Set* is the preferred data structure when we want to have sorted items and also to eliminate duplicate elements. Unfortunately, its performance is worse than that of a Hash Set or a Dictionary. The following program declares a new

*and adds elements to it:*

**Sorted Set**### Hash Set

Thursday, June 14th, 2018There are two types of Sets in the * System.Collections.Generic* namespace:

*and*

**SortedSet***. Both of them offer the functionality of storing non-duplicate items. The main difference between them is the fact that the*

**HashSet***obviously has its items sorted. Therefor, if you do not care about the order in which the items are stored, you are better off performance-wise to use a*

**SortedSet***.… Read more*

**HashSet**### Sorted Dictionary

Friday, June 8th, 2018Sorted Dictionary is just a normal Dictionary data structure, but with its keys sorted. Of course, it is obvious that having its elements sorted will make this data structure slightly slower than a normal Dictionary, but it does offer the advantage of making an in memory sorted lookup very easy.… Read more

### Dictionary

Friday, June 1st, 2018The data structure Dictionary suggests storing key-value pairs and provides a quick search by key. In common language, this means that instead of elements receiving a numerical index, as in the array case, they receive a specific type as a * key* (this is what the

*stands for in the*

**K***concept;*

**Dictionary<K, T>***stands for the type of the values stored in the dictionary) for accessing elements.… Read more*

**T**### Queue

Monday, May 28th, 2018* Queue *is a linear data structure in which there are two operations defined: adding an element to the tail (

*) and extract the front-positioned element from the head (*

**enqueue***). These two operations take a constant time to execute, because the queue is usually implemented with a linked list.… Read more*

**dequeue**### Stack

Wednesday, May 2nd, 2018Stack is a linear data structure in which there are 3 operations defined: adding an element at the top of the stack (push), removing an element from the top of the stack (pop) and inspect the element from the top without removing it (peek).… Read more

### Linked List

Tuesday, April 24th, 2018Singly and doubly linked lists (also known simply as * Linked Lists*) hold collection of elements, which preserve their order. Their representation in the memory is dynamic, pointer-based. They are linked sequences of elements. Adding is a fast operation, but it is a bit slower than adding to a List, because every time when we add an element to a linked list, we allocate a new memory area.… Read more

### Array List

Monday, April 23rd, 2018* ArrayList *is a dynamic array. What that means is that an

*can have any amount of objects and of any type. This data structure was originally designed to simplify the processes of adding new elements into an array. Under the hood, an*

**ArrayList***is an array whose size is doubled every time it runs out of space.… Read more*

**ArrayList**