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

  Implement an open hash table

In this programming assignment you will implement an open hash table and compare the performance of four hash functions using various prime table sizes.

  Use a search tree to find the solution

Explain how will use a search tree to find the solution.

  How to access virtualised applications through unicore

How to access virtualised applications through UNICORE

  Recursive tree algorithms

Write a recursive function to determine if a binary tree is a binary search tree.

  Determine the mean salary as well as the number of salaries

Determine the mean salary as well as the number of salaries.

  Currency conversion development

Currency Conversion Development

  Cloud computing assignment

WSDL service that receives a request for a stock market quote and returns the quote

  Design a gui and implement tic tac toe game in java

Design a GUI and implement Tic Tac Toe game in java

  Recursive implementation of euclids algorithm

Write a recursive implementation of Euclid's algorithm for finding the greatest common divisor (GCD) of two integers

  Data structures for a single algorithm

Data structures for a single algorithm

  Write the selection sort algorithm

Write the selection sort algorithm

  Design of sample and hold amplifiers for 100 msps by using n

The report is divided into four main parts. The introduction about sample, hold amplifier and design, bootstrap switch design followed by simulation results.

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