Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Qn 3 . ( a ) . Suppose a queue implemented in a circular fashion is in the state shown in the diagram below. Draw

Qn3.
(a). Suppose a queue implemented in a circular fashion is in the state shown in the diagram below. Draw a diagram showing the structure after the letters G and R are inserted, three letters are removed, and the letters D and P are inserted.
(b) What error occurs in part (a) if the letters G, R, D and P are inserted before any letters are removed?
(c) Describe how an array could be used to implement a queue in a program written in a highlevel language.
(d). If the nested paraenthesis representation of a tree is as follows, then what is the graphical representation of the tree?
(A(B(D))(C(E)(F(H)(I)(G)))(M))
(c). From the algorithm below compute the total running time T(n) using the cost and time to execute one statement of the algorithm.
For jlarr2 to Length A
do key larrA[j]
// Insert A[i] into the sorted sequence/
.
ilarrJ-1
While i>0 and A[i]> key
Do A[i+1]larrA[i]
ilarri-1
A[i+1]larr key
[15marks]
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Big Data With Hadoop MapReduce A Classroom Approach

Authors: Rathinaraja Jeyaraj ,Ganeshkumar Pugalendhi ,Anand Paul

1st Edition

1774634848, 978-1774634844

More Books

Students also viewed these Databases questions

Question

What are stocks? How are stocks bought and sold?

Answered: 1 week ago