Already have an account? Get multiple benefits of using own account!
Login in your account..!
Remember me
Don't have an account? Create your account in less than a minutes,
Forgot password? how can I recover my password now!
Enter right registered email to receive password!
Since the stack is list of elements, the queue is also a list of elements. The stack & the queue differ just in the position where the elements may be added or deleted. Similar to other liner data structures, queues can also be implemented by using arrays. Program 1 lists the implementation of a queue by using arrays.
Program: Array implementation of any Queue
include "stdio.h"
define QUEUE_LENGTH 50
struct queue
{ int element[QUEUE_LENGTH];
int front, rear, choice,x,y;
}
struct queue q;
main()
{
int choice,x;
printf ("enter 1 for add and 2 to eliminate element front the queue")
printf("Enter your alternative")
scanf("%d",&choice);
switch (choice)
case 1 :
printf ("Enter element to be inserted :");
scanf("%d",&x);
add(&q,x);
break;
case 2 :
delete();
add(y)
++q.rear;
if (q.rear < QUEUE_LENGTH)
q.element[q.rear] = y;
else
printf("Queue overflow")
delete()
if q.front > q.rear printf("Queue empty");
else{
x = q.element[q.front];
q.front++;
retrun x;
File organisation might be described as a method of storing records in file. Also, the subsequent implications approaching these records can be accessed. Given are the factors invo
Q. Assume that we have separated n elements in to m sorted lists. Explain how to generate a single sorted list of all n elements in time O (n log m )?
Ans: I nsertion into the B-tree: 1. First search is made for the place where the new record must be positioned. As soon as the keys are inserted, they are sorted into th
Design and implement an algorithm to simulate car re-organizing of the train at the railway switching junction. You can only use stacks as the data structure to represent the t
Define about the class invariant A class invariant may not be true during execution of a public operation though it should be true between executions of public operations. For
write aprogram for random -search to implement if a[i]=x;then terminate other wise continue the search by picking new randon inex into a
List various problem solving techniques. There are two techniques:- 1. Top down 2. Bottom- up
Q. Give the algorithm to build a binary tree where the yields of preorder and post order traversal are given to us.
Example 3: Travelling Salesman problem Given: n associated cities and distances among them Find: tour of minimum length that visits all of city. Solutions: How several
Q. Construct a binary tree whose nodes in inorder and preorder are written as follows: Inorder : 10, 15, 17, 18, 20, 25, 30, 35, 38, 40, 50 Preorder: 20, 15, 10
Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!
whatsapp: +91-977-207-8620
Phone: +91-977-207-8620
Email: [email protected]
All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd