What are the basic features of a stack data structure

Assignment Help Data Structure & Algorithms
Reference no: EM131496554 , Length: 15

Question 1

i. What are the basic features of a stack data structure, explain with the use of an example?

ii. What is the significance of the stacktop in a stack?

iii. Suppose that you want to develop a program that accepts a postfix expression and asks values for variables in the expression. Then you need to calculate the answer for the expression according to the given values.

For example,
The postfix expression is ab+c*

Value of a is 2
Value of b is 3

Value of c is 5

The result is 25

(a) Write the pseudo code algorithm for the above problem.
(b) Implement the algorithm in Java.

Question 2

i. Explain in your own words what an algorithm is giving an example.

ii. Describe different methods of developing algorithms with examples.

iii. With the use of an example describe what sort of problems are more suitable to solve in an algorithmic manner.

iv. Compare and contrast three widely used notations in algorithm analysis with respect to time.

v. Find the time complexities for the following loops. You should clearly analyze each step and give reasons for your answer.

(a)

sum = 0;

for( i = 0; i< n; i++)

for( j = 0; j < n * n; j++) sum++;

(b)               sum = 0;

for( i = 0; i< n; i++)

for( j = 0; j < n * n; j++) sum++;

Question 3

i. Briefly describe the essential points to be satisfied in writing a recursive algorithm.

ii. Compare and contrast recursion vs iteration.

iii. Write a recursive pseudo code algorithm that returns the maximum among the first n
elements of an array.

iv. Write a recursive algorithm that prints all the permutations of the first n characters of a string. For example the call print ("ABC", 3) would print

ABC, ACB, BAC, BCA, CBA, CAB

v. Implement the algorithms written in part 3.3 and 3.4 in Java Language.

Question 4

i. Compare and contrast array structures with linked lists.

ii. Write a pseudo code algorithm to create a linked list with a header and insert five numbers to the list.

(a) Write a pseudo code algorithm to insert a new element between the 3rd and 4th elements.

(b) Write a pseudo code algorithm to delete an element in the middle of the linked list.

iii. Implement parts a andb in 4.4 using Java programming language.

Reference no: EM131496554

Questions Cloud

Identify advantage and disadvantage for the project manager : Have you been involved in, or affected by, a change in your work or studies? If so: What evidence was there that those managing the change agreed.
Discuss the fundamental nature of leadership : Discuss how different styles of leadership and management can impact an organisation and the decision making process
What risks exist for children who live in homes : What risks exist for children who live in homes where domestic violence occurs? How could these affect their later life?
How lp can be used for marketing and/or consumer research : What benefit would be gained by utilizing linear programming (LP) for marketing research? How LP can be used for marketing and/or consumer research.
What are the basic features of a stack data structure : ITE 2105 - DATA STRUCTURES AND ALGORITHMS - What are the basic features of a stack data structure, explain with the use of an example?
Why asymmetric encryption algorithms : Discuss why asymmetric encryption algorithms require larger key sizes.
What form did your resistance take : Discuss with someone who has tried to introduce change in an organisation what evidence there was of resistance. Then consider the following questions.
Discuss about the cyberbullying : List some examples of cyberbullying that you can think of and do you know any one, or have heard about anyone who has been cyber-bullied.
Identify the radical innovations : We are surrounded by so-called innovative products. Consider everyday items such as the iPod or the mobile phone. Try to identify the radical innovations.

Reviews

Write a Review

Data Structure & Algorithms Questions & Answers

  Design and develop a linked list

Your first task in developing the application for tracking contributors is to load a list of the people who are helping the cause. Design and develop a linked list, implemented as a stack, to track all of the contributors

  Implement two stacks using only one array

Write routines to implement two stacks using only one array. Your stack routines should not declare an overflow unless every slot in the array is used.

  Explain the binary search tree search algorithm

How do you know if a graph is a binary tree? Explain the preorder traversal algorithm. Explain the binary search tree search algorithm.

  Draw five-vertex connected graph g that has no cut-vertices

Draw a 5-vertex connected graph G that has no cut-vertices, and then verify that G satisfies each of the following properties. Prove or disprove: If a simple graph G has no cut-edge, then every vertex pf G has even degree?

  Use big-o notation to categorize algorithms

Use big-O notation to categorize traditional grade school algorithms for addition and multiplication. That is, if asked to add two numbers each having N digits, determine individual additions should be performed?

  Creating a table of xml documents

Make a table of XML documents with a type of XML. Use a primary key so add a field of type INT that is an identity. Insert many records into XML field in this new table.

  Design a relational database so that it is at least in 3nf

Design a relational database so that it is at least in 3NF

  Write the search algorithm for a b-pluse tree

Write the search algorithm for a B+tree. Rewrite the B-tree deletion algorithm using a stack instead of recursion. Rewrite the B-tree insertion algorithm using a stack instead of recursion.

  What is the maximum number of edges in a graph

What is the maximum number of edges in a graph with V vertices and no parallel edges - What is the minimum number of edges in a graph with V vertices, none of which are isolated (have degree 0)?

  Greedy strategy for finding a shortest path

Think about the given greedy strategy for finding a shortest path from vertex start to vertex goal in a connected graph.

  Articles available our csu library databases

The Article Critique is required to be a minimum of two pages to a maximum of four pages, double-spaced, APA style, from the journals and articles available in our CSU Library Databases. The article should deal with any of the material presented i..

  Implement the heron method to locate the square root

The Heron Method for approximating the square root of a number states that if x is a guess for the square root of n then a better guess x' is:

Free Assignment Quote

Assured A++ Grade

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!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd