150 likes | 370 Views
Data Structure. An Overview Approach. Data Type v/s Data Structure. Data Type= Permitted data value (domain) +operations Data Structure= Organized data type +Allowed operations. Data structure at a glance. Major Operations. Insertion Deletions Traversal Searching
E N D
Data Structure An Overview Approach
Data Type v/s Data Structure • Data Type= Permitted data value (domain) +operations • Data Structure= Organized data type +Allowed operations
Major Operations • Insertion • Deletions • Traversal • Searching • Sorting
Traversal in Tree/Graph Data Structure • In order • Pre order • Post order • Reverse In order • Reverse Pre order • Reverse Post order • Level by level Tree Graph • DFS • BFS
Application Area of various Data Structure • Stack- Infix/Prefix Expression Conversion and Evaluation, Reversing an Array/ Memory Mgt. • Queue- Priority Queue/Banking/ Reservation/ Buffer Mgt/ Process Mgt • Tree- Game Tree/ Decision Tree/ Histogram /Chain Membership Mgt./ Symbol Table • Graph- Networking/ Operation Research/ Project Planning & Mgt./Finding Shortest path
Linked Stack • Push Operation Function lpush(top,x) 1. new <=node 2. info(new)=x 3. link(new)=top 4. top=new 5. return (top) End function
Linked Stack • Pop Operation Function lpop(top) 1. item=0 2. if top=NULL print(‘Empty stack’) else item=info(top) top=link(top) 3. return (item) End function
Linked Queue • Insertion Operation // front & rear are global pointer declared as node type// Function ladd(item) 1. new<=NODE // allocate new node 2. info(new)=item 3. link(new)=NULL 4. if front=NULL // is queue empty?// front=Rear=new Else link(rear)=new rear=new // attach node // End function
Linked Stack • Delete Operation Function ldel( ) 1. item=0 2. if front=NULL print(‘Empty Queue’) else item=info(front) front = link(front) 3. return (item) End function
Circular Queue -Array • Insert Operation Function CQInsert(CQ,Item ) 1. t=(rear+1)%MAX 2. if t=front print(‘ Queue full’) else CQ[t]=item rear=t End function
Circular Queue -Array • Delete Operation Function CQDel(CQ) 1. item=0 2. if front=rear print(‘ Queue Empty’) else front=(front+1)%MAX item=CQ[front] 3. return(item) End function
Thanks Presented by - Mr. Rajesh Kumar Mishra PGT (Computer Science) KV No. 1 AFS, Suratgarh