Data structures and algorithm

Question 1

Consider the list structure given below: myletters

  1. Draw the new structure of the list after performing each of the following operations [4marks]

    1. insert(2, Z, myletters)

    2. insert(0,A, myletters)

    3. set(9,X, myletters)

    4. delete(4,myletters

  2. Write a complete array program to store and display the elements after final operation (a) iv. [6marks]

Question 2

Given below is queue data structure

11

  1. Write a code segment to insert new data item (34) on the queue [5marks]

  2. Write a code segment to remove data item (7) from the queue [5marks]

Question 3

Consider the expression given below 3*5+9-3/2

  1. Convert the expression into prefix expression. [4marks]

  2. Use stack ADT concept to evaluate the prefix expression generated in (a) [6marks]

Question 4

Consider the array below:

  1. Convert the array into binary tree.

  2. Perform: pre-order, in-order and post-order traversal on the resulting tree from (a)