Stacks & Queses

Download Stacks & Queses

Post on 10-Sep-2015

5 views

Category:

Documents

1 download

Embed Size (px)

DESCRIPTION

Brief notes on Stacks & Queses

TRANSCRIPT

  • EXAMPLE:

  • The traversal of the previous trees are as follows:

    Inorder traversal:

    20 25 28 30 35 40 50 53 55 60 70 90

    Preorder traversal:

    40 20 10 30 25 28 35 70 50 55 53 60 90

    Postorder traversal:

    10 28 2 35 30 20 53 60 55 50 90 70 40

    Copyright Amity University

    Q.No 1 To represent hierarchical relationship between elements, which data structure is suitable?

    a.Dequeb.Priorityc. Treed.All of above

    Copyright Amity University

    Q.No 2 A technique for recursively processing the nodes of a tree in which subtrees are processed before root is processed is a

    Post-Order Traversal Quick Traversal Pre-Order Traversal In-Order Traversal

    Copyright Amity University

    Q.No 3 An extra node at the front of the list, which doesnot represent an item in the list is called

    a. header nodeb. List nodec. Both a and b

    Copyright Amity University

    Q.No 4 The circular List has

    a) 1 NULL linkb) No NULL Link c)at least 1 NULL Linkd) 2 NULL Links

    Copyright Amity University

    5 Which of the following operations is performed more efficiently by doubly linked list than by linear linked list?

    Deleting a node whose location is given.Inserting a node after the node with a given location Traversing the list to process each node earching an unsorted list for a given item

    Copyright Amity University

    AnswersQ.No 1 c 2 a 3 a 4 b 5 a

  • *

    Amity Business SchoolAmity Business School*Amity Business SchoolAmity Business School*Amity Business School*Amity Business School*Amity Business School*Amity Business School*Amity Business School*Amity Business School*Amity Business School*Amity Business School*Amity Business School*Amity Business School*Amity Business School*Amity Business School*Amity Business School*Amity Business School*Amity Business School*Amity Business School*