Review 1 Polish Notation Prefix Infix Postfix Precedence of Operators Converting Infix to Postfix...

Preview:

Citation preview

Review

1

Polish NotationPrefixInfixPostfix

Precedence of OperatorsConverting Infix to PostfixEvaluating Postfix

Polish Notation

2

Converting Infix to PostfixConverting Postfix to InfixConverting Infix to PrefixExamples

Examples

3

Converting Infix to Postfix

Examples

4

Converting Infix to Postfix

Examples

5

Converting Infix to Postfix

Examples

6

Converting Postfix to Infix

Examples

7

Converting Postfix to Infix

Examples

8

Converting Infix to Prefix

Examples

9

Converting Infix to Prefix

Summary

10

Converting Infix to PostfixConverting Postfix to InfixConverting Infix to PrefixExamples

Review

11

Polish NotationPrefixInfixPostfix

Precedence of OperatorsConverting Infix to PostfixEvaluating Postfix

Polish Notation

12

Converting Infix to PostfixConverting Postfix to InfixConverting Infix to PrefixExamples

Linked ListsIntroductionInsertion DescriptionDeletion DescriptionBasic Node ImplementationConclusion

OutlineIntroductionInsertion DescriptionDeletion DescriptionBasic Node ImplementationConclusion

IntroductionDefinitions

Lists and arraysNodes and pointersSingle Linked ListsDouble Linked ListsCircular Lists

Advantages

IntroductionDefinitions

Lists and arraysNodes and pointersSingle Linked ListsDouble Linked ListsCircular Lists

Advantages

Lists and arraysLists:

Lists and arraysArrays: {Size of the following array is = 4}

Index 0 1 2 3

Value 44 5 96 3

IntroductionDefinitions

Lists and arraysNodes and pointersSingle Linked ListsDouble Linked ListsCircular Lists

Advantages

Nodes and pointers

IntroductionDefinitions

Lists and arraysNodes and pointersSingle Linked ListsDouble Linked ListsCircular Lists

Advantages

Single linked lists

IntroductionDefinitions

Lists and arraysNodes and pointersSingle Linked ListsDouble Linked ListsCircular Lists

Advantages

Double Linked Lists

IntroductionDefinitions

Lists and arraysNodes and pointersSingle Linked ListsDouble Linked ListsCircular Lists

Advantages

Circular Lists

IntroductionDefinitions

Lists and arraysNodes and pointersSingle Linked ListsDouble Linked ListsCircular Lists

Advantages

AdvantagesThe Linked List advantages are collected

because of the array disadvantages, array disadvantages are:

1. Array Size2. Memory allocation3. Insertion and Deletion

OutlineIntroductionInsertion DescriptionDeletion DescriptionBasic Node ImplementationConclusion

Insertion DescriptionInsertion at the top of the listInsertion at the end of the listInsertion in the middle of the list

Insertion DescriptionInsertion at the top of the listInsertion at the end of the listInsertion in the middle of the list

Insertion at the topSteps:Create a NodeSet the node data ValuesConnect the pointers

Insertion Description

Follow the previous steps and we get

48 17 142head //

head 93

Step 1 Step 2

Step 3

Insertion DescriptionInsertion at the top of the listInsertion at the end of the listInsertion in the middle of the list

Insertion at the endSteps:Create a NodeSet the node data ValuesConnect the pointers

Insertion Description

Follow the previous steps and we get

48 17 142head //

Step 1 Step 2

Step 3

Insertion DescriptionInsertion at the top of the listInsertion at the end of the listInsertion in the middle of the list

Insertion in the middleSteps:Create a NodeSet the node data ValuesBreak pointer connectionRe-connect the pointers

Insertion Description

Step 1 Step 2

Step 3

Step 4

OutlineIntroductionInsertion DescriptionDeletion DescriptionBasic Node ImplementationConclusion

Deletion DescriptionDeleting from the top of the listDeleting from the end of the listDeleting from the middle of the list

Deletion DescriptionDeleting from the top of the listDeleting from the end of the listDeleting from the middle of the list

Deleting from the topStepsBreak the pointer connectionRe-connect the nodesDelete the node

Deletion Description

4 17

head

426

4 17

head

426

4 17

head

42

Deletion DescriptionDeleting from the top of the listDeleting from the end of the listDeleting from the middle of the list

Deleting from the endStepsBreak the pointer connectionSet previous node pointer to NULLDelete the node

Deletion Description

4 17

head

426

4 17

head

426

4 176

head

Deletion DescriptionDeleting from the top of the listDeleting from the end of the listDeleting from the middle of the list

Deleting from the MiddleStepsSet previous Node pointer to next nodeBreak Node pointer connectionDelete the node

Deletion Description

4 17 42

head

4 17

head

42

4

head

42

OutlineIntroductionInsertion DescriptionDeletion DescriptionBasic Node ImplementationConclusion

Basic Node ImplementationThe following code is written in C++:

Struct Node{

int data; //any type of data could be another struct

Node *next; //this is an important piece of code “pointer”

};

SummaryIntroductionInsertion DescriptionDeletion DescriptionBasic Node ImplementationConclusion

Recommended