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!
Before programming a problem solution those employees a stack, we have to decide how to represent a stack by using the data structures which exist in our programming language. Stacks might be represented in the computer in several ways, usually by means of a one-way list or a linear array. Each of the approach has its advantages & disadvantages. Generally a stack is implemented with two essential operations - push & pop. Push means to add an item on to stack. The push algorithm is sown in Figure.
Here, tos is a pointer which indicates the position of top most items into the stack. Stack is represented through the array arr and MAXSTACK represents the maximum possible number of elements into the stack. The pop algorithm is shown in Figure
Step 1: [test out for stack overflow]
if tos >=MAXSTACK
print "Stack is overflow" and exit
Step 2: [Increment the pointer value through one]
tos=tos+1
Step 3: [Add the item]
Step 4: Exit
arr[tos]=value
The pop operation eliminates the topmost item from the stack. After elimination of top most value tos is decremented by 1.
Step 1: [test out whether the stack is empty]
if tos = 0
print "Stack is underflow" and exit
Step 2: [Elimiante the top most item] value=arr[tos] tos=tos-1
Step 3: [Return the item of the stack]
return(value)
Explain the bubble sort algorithm. Answer This algorithm is used for sorting a list. It makes use of a temporary variable for swapping. It compares two numbers at an insta
Define what an algorithm is and outline the characteristics of a good algorithm.
Question 1. Explain the different types of traversal on binary tree 2. Explain the Prim's minimum spanning tree algorithm 3. Differentiate fixed and variable storage allo
In this unit, we learned the data structure arrays from the application point of view and representation point of view. Two applications that are representation of a sparse matrix
Encryption the plain-text using the round keys: 1. (Key schedule) Implement an algorithm that will take a 128 bit key and generate the round keys for the AES encryption/decryp
Write an algorithm for getting solution to the Tower's of Hanoi problem. Explain the working of your algorithm (with 4 disks) with appropriate diagrams. Ans: void Hanoi(int
(a) Explain the term Group Support System and elaborate on how it can improve groupwork. (b) Briefly explain three advantages of simulation. (c) Explain with the help of a
Write a program that uses the radix sort to sort 1000 random digits. Print the data before and after the sort. Each sort bucket should be a linked list. At the end of the sort, the
Define Merge Sort Merge sort is a perfect example of a successful application of the divide and conquer method. It sorts a given array A[0...n-l] by separating it into two ha
Q. State the difference between a grounded header link list and a circular header link list? Ans: A header linked list is a linked list which all the time c
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: +1-415-670-9521
Phone: +1-415-670-9521
Email: [email protected]
All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd