Blog Author
Tekslate
Published Date
14th February, 2018
Ratings
Views
604
Welcome to DataStructures Tutorials. The objective of these tutorials is to gain understanding of DataStructures. In these tutorials, we will cover topics such as Stacks, Sorting, Queues, Trees etc.
In addition to DataStructures Tutorials we will cover common interview questions and issues of DataStructures.
In computer science, a DataStructures is a particular way and organizing data in a computer so that it can be use efficiently.
A data structure is an arrangement of data in a computer memory or even disk storage.
An example of several common data structures are arrays, linked lists, queues, stacks, binary trees, and hash tables.
Different kinds of DataStructures are suited to different kinds of applications and some are highly specialized to specific basis.
For example, 3trees are particular well suited for implementation of databases, while compiler implementation usually use hash tables to look up identifiers.
DataStructures are used in almost every program or software system.
Specific DataStructures are essential ingredients of many efficient algorithms and make possible the management of huge amounts of data, such as large databases and internet indexing services.
The following are the two types of the DataStructures
Linear DataStructures.
Nonlinear DataStructures.
The linear DataStructures holds /stores the data elements in the form of a linear list (i.e. in sequential)
Arrays, stacks, queues and linked lists are called linear DataStructures.
The nonlinear DataStructures holds/stores the data elements in the form hierarchy by establishing some relationship between the data elements.
Trees and graphs are the nonlinear DataStructures.
In general, simple architecture expression can be represented in three ways: infix, prefix and postfix.
A+B infix +AB prefix(or polish) AB+ postfix(pr suffix or reverse polish)
The infix operands – precedence is as follows
Algorithm : In to post (Q,P) Suppose ‘Q’ is an arithmetic expression written in infix notation. This algorithm finds the equivalent postfix expression p.
[End of IF structure] [End if steo2 loop]
Example : Q: A+(B*C(D/E*F)*G)*H)
Symbol Scanned  STACK  postfix(p) 

C  A 

C+  A 

C+C  A 

C+C  AB 

C+C*  AB 

C+C*  ABC 

C+C  ABC* 

C+CC  ABC*D 

C+CC  ABC*D 

C+CC/  ABC*D 

C+CC/  ABC*DE 

C+CC  ABC*DE/ 

C+CC*  ABC*DE/F 

C+C  ABC*DE/F* 

C+C  ABC*DE/F* 

C+C*  ABC*DE/F*G 

C+C.  ABC*DE/F*G* 

C+*  ABC*DE/F*G* 

C+*  ABC*DE/F*G*H 

EMPTY  ABC*DE/F*G*H*+ 
# include<stdio.h> #include<conio.h> #include<ctype.h> #include<stdib.h> char infix[20]; char pastfix[20]; char stack[20]; int TOP=1; void Get Expr() { int len; printf(“Enter an infix expression \n”); gets(infix); len=strlen(infix); infix[len]=’)’; TOP=TOP+1; stack[TOP]=’c’; } void conver () { int i,j; for (i=0;j=0;Top!=1;i++) { if(is alpha(infix[i])) { Post fix[j]=infix[i]; j=j+1; } else { switch(infix[i]) { case’c’: Top=Top+1; stack[Top]=’c’; break; Case ‘+’ : Case ‘‘: While(stack[Top]=’+’stack[Top]==’I’ stack[top]==’*’  stack[Top]==’/’) { Post fix[j]=Stock[Top]; j=j+1; Top=Top1; } Top=Top+1; stack[Top]=infix[i]; break; case ‘*’ case’/’ : while(stock[Top]==’*’  Stack[Top]==’/’_ { postfix[j]=stack[Top]; j=j+1; Top=Top1; } Top=Top+1; stack[Top]=infix[i]; break; case’)’: while(cstack[Top]!=’(‘ ) && (stock[TOP] == ‘+’ stack[Top] == ‘‘  stack[Top]==’*’  stack[Top]==’/’)) { Pastfix[j]=stack[Top]; j=j+1; Top=Top1; } Top=TOP1; }/* switch end */ } /* else end */ }/* for end */ post fix[j]=’\o’; printf(“Expression in postfix is %s \n”, postfix); } void main() { clrscr(); Get expr(); convert (); getch(); } Output: Enter an expression A+(B*C  CDIE*F)
TekSlate
TekSlate is the best online training provider in delivering worldclass IT skills to individuals and corporates from all parts of the globe. We are proven experts in accumulating every need of an IT skills upgrade aspirant and have delivered excellent services. We aim to bring you all the essentials to learn and master new technologies in the market with our articles, blogs, and videos. Build your career success with us, enhancing most indemand skills .
Write For Us