Types and Examples of Standard Data Structure (Essay Sample)
DSA means datastructure and algorithm. data structure is highly programming language it connects mostly trees how i run it and programm shows output or not
IT MEANS WE HAVE TO WRITE RESULTS WHEN WE WRITE ALL CALCULATION THEN WE HAVE TO WRITE ALL THE WORDS ACCOORDINF TO GIVER REQUIMENTS …
PLAGIARISM FREE WORK
UNLIMITED REVISIONS
UIMITED REWORKS
NO MISTAKES KF GRAMMAR
LO1
P1
Type of data structure:
Following the types and examples of standard Data Structure
1. Arrays
One of the simplest data structures, an array is a collection of items that are stored sequentially. An array contains values or variables—known as “elements”—of the same data type and is of a fixed size, so you cannot change the size of an array. Each item in an array is indexed starting with 0.
Example,
If we want to store the names of 100 people then we can create an array of the string type that can store 100 names. String[] array = new String[100];
2. Linked Lists
A linked list is a sequence of items arranged in a linear order all connected to each other. This means you must access data in order, so random access to data is not possible.
Example
Just like a garland is made with flowers, a linked list is made up of nodes. We call every flower on this particular garland to be a node. And each of the node points to the next node in this list as well as it has data
3. Stacks
Stacks are known as LIFO (Last In First Out) structures. This means the element placed last can be accessed first. You can “push” a new element onto the top of the stack, or you can “pop,” deleting the element inserted last which is at the top of the stack
Example
A real-life example is a stack of plates: you can only take a plate from the top of the stack, and you can only add a plate to the top of the stack.
4. Queues
A queue functions similarly to a stack, but instead of being a LIFO structure, it is a FIFO (First In First Out) structure. The easiest way to think about a queue is to think of a line of people waiting to enter a building. The person at the beginning of the line will enter the building first, while the person at the end will enter last.
Example
A real-life example of a queue data structure is a line of people waiting to buy a ticket at a cinema hall.
5. Hash Tables
A hash table structure associates each value with a key and then stores them. This makes it easy to look up values efficiently using a key. It’s an efficient way to insert and search for data regardless of its size, as it makes it easy to identify a specific object from a group of similar objects.
Example
For example, if you go to college, you may be assigned a unique student ID number. This ID number is a key that can be used to retrieve information about you and your student record.
6. Trees
A tree is a structure similar to a linked list because each item is linked. But in a tree items are linked in a hierarchal fashion, just like you might see in a visual representation of someone’s family tree. There are various types of trees, each suited to different applications
Example
For example, a binary search tree (BST) stores data in sorted order with every node in the binary comprised of the following attributes:
* Key (the value saved in the node)
* Left (pointer to the left child node)
* Right (pointer to the right child node)
* P (pointer to the parent node)
7. Heaps
Similarly, a heap is a type of binary tree in which the parent nodes are compared to their children. This allows the values within the nodes to be arranged accordingly. Heaps can be represented as trees, but they can also be represented as binary arrays.
Example
If it is the parent node of , then the value follows a specific order with respect to the value of and the same order will be followed across the tree.
8. Graphs
A graph is an abstract, non-linear data structure that is made of a finite set of nodes that are connected by edges. The nodes may be referred to as “vertices” and contain values, whereas the edges are simply lines or arcs that connect two nodes in the graph.
Example
For example, on Facebook, each user could be represented with a node (or vertex). Each vertex could then contain information about that user, and each edge could represent their connection with another user.
P2
Stack:
A stack is a linear data structure that follows the principle of Last In First Out (LIFO). This means the last element inserted inside the stack is removed first.
You can think of the stack data structure as the pile of plates on top of another.
Characteristics of Stacks
* Stacks are based on the LIFO principle, i.e., the element inserted at the last, is the first element to come out of the list.
* Insertion and deletion in stacks takes place only from one end of the list called the top.
* Insert operation is called push operation.
* Delete operation is called pop operation.
* In stacks we maintain only one pointer to access the list, called the top, which always points to the last element present in the list.
* Stack is used in solving problems works on recursion.
Advantages of Stack
* Stack is easy to learn and implement for beginners.
* Stacks are used to solving problems that work on recursion.
* It allows you to control how memory is allocated and deallocated.
Application of the Stack
1 A Stack can be used for evaluating expressions consisting of operands and operators.
2 Stacks can be used for B
3 acktracking, i.e., to check parenthesis matching in an expression.
4 It can also be used to convert one form of expression to another form.
5 It can be used for systematic Memory Management.
PUSH Operation:
Private void push (int item)
{
If(top==capacity-1)
{
Print(“stack is full!”)
Else
{
Arr[top+1] =item top=top +1
}
}
}
POP Operation
Private void pop (int item)
{
{if ( isEmpty() == True )
{
print( "Stack is empty!" )
{
else
arr[top-1] = item top=top - 1
}
}
}
Peek and isEmpty Operation
Peek and isEmpty are quite simple to implement. We need to steer clear of exceptions though.
Private void peek(int item)
{
if ( isEmpty() == True )
{
print( "Stack is empty!" )
return -1
}
else
return arr[top]=item top=top
}
bool isEmpty()
{
if ( top == -1 )
return True
else
return False
}
LO3
using system;
public class employee
{
Public int id;
Public string fname=new string(new char[25]);
Public string sname=new string(new char[25]);
Public int age;
Public int salary;
Public int mobile;
Public float date;
}
Public static class globals
{
Internal static void main()
{
Int I;
Int n;
Console.write(“\enter the number of employee\n\n”);
n = int.parse(consoleinput.read to white space(true));
employee[] emp=arrays.initialize with default instances(n);
for (i=0;i
{
Console.write(“\n Enter details of “);
Console.write(i+1);
Console.write(“employee”);
Console.write(“\n”);
Console.write(“{0,5}” ,”\n Enter employee Id “);
Emp[i].id=int.parse(consoleinput. .read to white space(true));
Console.write(“{0,10}” ,”\n Enter employee First name: “);
Emp[i].fname=int.parse(consoleinput. .read to white space(true));
Console.write(“{0,10}” ,”\n Enter employee Second name: “);
Emp[i].sname=int.parse(consoleinput. .read to white space(true));
Console.write(“{0,5}” ,”\n Enter employee age: “);
Emp[i].age=int.parse(consoleinput. .read to white space(true));
Console.write(“{0,5}” ,”\n Enter employee Salary: “);
Emp[i].salary=int.parse(consoleinput. .read to white space(true));
Console.write(“{0,15}” ,”\n Enter employee Mobile Number: “);
Emp[i].mobile=int.parse(consoleinput. .read to white space(true));
Console.write(“{0,10}” ,”\n Enter employee Joining Date: “);
Emp[i].date=int.parse(consoleinput. .read to white space(true));
}
Console.write(“{0,10}” , “\n\n-------------------------------------“);
Console.write(“{0,10}” ...
Other Topics:
- Critical Thinking on Network TopologyDescription: Our lives would not be what they are without the Internet. For essential network analysis and design, the network development life cycle helps. Network design and IP addressing design are two significant concerns that must be addressed. There can be two approach of analyzing and designing network : 1) top down...1 page/≈550 words| No Sources | APA | Literature & Language | Essay |
- Informed Consent with Vulnerable PopulationsDescription: Informed consent in the research focuses on protecting the participant's welfare by ensuring that they are informed and voluntary. This is crucial in promoting positive feelings for the participants before, during, and after the study, ensuring that they can deliver credible information that generates the ...1 page/≈275 words| 2 Sources | APA | Literature & Language | Essay |
- Firm Growth by Internal ExpansionDescription: The firm grows by either internal expansion through integration. The push for the firm to grow is to become bigger so as to achieve its objectives such as maximizing profit, increasing sales, and increasing the market shares and attractiveness to various investors and financiers. For example, the ...1 page/≈275 words| 3 Sources | APA | Literature & Language | Essay |