Introduction
The way in which the various data elements are organized in memory with respect to each other is called a data structure. Here in this blog, we are going to discuss the fundamentals of data structures.
Programming and Data structures 
Getting Started
In computer science data structures are a collection of organized data with predefined formats for efficiently storing, accessing, and processing in a computer program. Similar data can often be handled more efficiently when stored and manipulated data in a data structure. Some predefined standard data structures that have proved useful over the year are given below.
 Array
 Linked List
 Stack
 Queues
 Trees
 Graphs


Array and linked lists are basic data structures that are used to create other advanced data structures such as stacks, queues, trees, and graphs.
Data structures in C# shortly known as struct enable the creation of reusable code components. This means that data structures once implemented can be used as a standard component to provide a standard solution to a specific set of problems.
For example, suppose there is a class to implement a data structure that stores and retrieves data in order of their arrival. Once that class is created, the same class can be used in several different applications that need the same functionality.
Type of Data Structure.
Some data structures are fixed lengths of data, and some struct's lengths can grow at run time. Based on the size of the data a data structure can be classified in two categories given
 Static
 Dynamic
The size of these data structures is fixed at compile time and does not grow or shrink at run time. The array is an example of a static data structure.
Dynamic Data StructuresThe size of these data structures is not fixed and grows and shrinks at compile time because memory is allocated dynamically when it is required, linked list comes under dynamic data structures.
Various C# Data Structure.
ArrayArray in data structure stores multiple variables of the same type. It can be declared by specifying the type of its elements, if you want the array to store elements of any type, you can specify the object as its type. The size (number of elements to be stored) of the array is fixed and cannot be grown at runtime, hence you need to specify the size of the array while declaring. There are three types of arrays as given below.
 SingleDimensional array
 Multidimensional array
 Jagged Array
Linked List in C# is a chain of elements in which each element consists of data as well as a link to the next element. The element of the linked list is called Node. A linked list in data structure is a flexible data structure that provides a convenient way to store data. unlike the array for linked list in C#, there is no requirement to declare the size of the linked list at compile time. The different types of linked list are given below.
 Singly Linked List
 Doubly Linked List
 Circular Linked List
A stack is an advanced data structure that can be created using an array or linked list. The stack can be a static or dynamic data structure. When you use an array to create a stack then it becomes static and when you use a linked list then it will be dynamic. The stack data insertion and deletion are allowed only at one end. Hence stack is called the LIFO data structure.
QueueA queue in Data Structure is a collection of elements where data is inserts in one end and deletes in another end. The first item inserted into queue will be deleted first. The difference between stacks and queues is in removing. The difference between stacks and queues is in removing. In a stack, we remove the item the most recently added; in a queue, we remove the item the least recently added.
TreeThe tree data structure in C# is a nonlinear data structure that represents the elements in a hierarchical relationship. Each element in a tree is called a node. The first element is called a root node and the last element is called a leave node. Each leave node is connected to the root node through the edge as shown in the image.
Graph
A graph data structure is also a nonlinear data structure consisting of vertices and edges. The vertices are sometimes also referred to as nodes and the edges are lines or arcs that connect any two nodes in the graph.
Summary
Here in this blog, Fundamentals of Data Structures, we discussed data structures, different types of data structures, and a lot more. I hope this blog helped you to learn.
Thanks
No comments:
Post a Comment