Question

State two advantages of implementing Stack using LinkedList instead of ArrayList c .. A daing. la ue 0 hecking. .for. .a tching .de.l n. .a.pYg xam
0 0
Add a comment Improve this question Transcribed image text
Answer #1

For storing the elements both Array and Link list are used.The only difference is that array have contigous memory allocation while Link List have non contigous allocation.

There are some advantages of using link list instead of array :

1.There is no size issue in Link list but array have size issue(The size of the arrays is fixed:)

2.Ease of insertion/deletion : Addition or deletion of the element in link list is easy as compare to array.

3. Since Link list does not have size limit so elements can be added to any extent.

Basically link list have two main advantage over array i.e Dynamic Size and ease of inserting and deleting the elements.

Add a comment
Know the answer?
Add Answer to:
State two advantages of implementing Stack using LinkedList instead of ArrayList c .. A daing. la...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Write a C++ program to read N students records implementing stack using pointers. Each record has...

    Write a C++ program to read N students records implementing stack using pointers. Each record has a name field and ID field. Your program should have at least the following functions: main(), Read_record.(..), Push.., pop (...)

  • C or C++ I need to create a code with implementing stack using linked list(and should...

    C or C++ I need to create a code with implementing stack using linked list(and should not use static array) and for input, each line should be this following order form: name, id, and email and for output, each line should be this order: id, name, and email here is examples of text files example1.txt Geo, 10, geoff@duke.edu Yoa, 13, yoshua@montreal.edu Yon, 19, yann@nyu.edu Cpo, 48, cho@nyu.edu Apx, 55, alex@amind.com example2.txt Joh, 50, jonnathan@hello.edu Jea, 20, jessicca@gmila.com Dav, 194, david@hi.edu...

  • Please Refactor this Assignment by using Arraylist instead of Array. import java.util.Scanner; public class DaysOfWeeks {...

    Please Refactor this Assignment by using Arraylist instead of Array. import java.util.Scanner; public class DaysOfWeeks { public static void main(String[] args) { String DAY_OF_WEEKS[] = {"Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"}; char ch; int n; Scanner scanner = new Scanner(System.in); do { System.out.print("Enter the day of the Week: "); n = scanner.nextInt() - 1; if (n >= 0 && n <= 6) System.out.println("The day of the week is " + DAY_OF_WEEKS[n] + "."); else System.out.println("Invalid Entry"); System.out.print("Try again (Y/N): "); ch = scanner.next().charAt(0); }while(ch=='Y'); }...

  • Purpose This assignment is an exercise in implementing the Stack ADT using a dynamically-allocated array, as...

    Purpose This assignment is an exercise in implementing the Stack ADT using a dynamically-allocated array, as well as techniques for managing dynamically-allocated storage in C++. Assignment In this assignment, you will write a class called Stack that will encapsulate a dynamically-allocated array of elements of a generic data type. A driver program is provided for this assignment to test your implementation. You don't have to write the tests. Program You will need to write a single template class for this...

  • Question 4 (4 marks) (a) State TWO advantages of using B-spline curve (b) Given a set of data points Po- (0,0,0), P(...

    Question 4 (4 marks) (a) State TWO advantages of using B-spline curve (b) Given a set of data points Po- (0,0,0), P(2,-1,-1), P-(1,2.2) on the curve Q. A B-spline curve calculated by: P(,)-Σ N,,0)I, where N,,0-11 fort, sl < 0 otherwise" 1) Nikiのwith 3 control points and knot vector defined 1-1.) N'서の+ N,,(t)- Itt by [0 0 0 1 1 刂is used to represent the curve. (2 marks) What type of B-spline curve is this? (i) (2 marks) (i) What...

  • Hanoi Tower Recursion Implementing with Vector (stack) c++ To implement the Hanoi Tower using the following...

    Hanoi Tower Recursion Implementing with Vector (stack) c++ To implement the Hanoi Tower using the following Stack operation provided by STL Vector: push_back() pop_back() back() Sample Test Run Enter hanoi tower height: 4 src: 4 3 2 1 | dest: | temp: src: 4 3 2 | dest: | temp: 1 src: 4 3 | dest: 2 | temp: 1 src: 4 3 | dest: 2 1 | temp: src: 4 | dest: 2 1 | temp: 3 src: 4...

  • State two advantages of recharging an electric ferry using wireless power transfer, rather than recharging through...

    State two advantages of recharging an electric ferry using wireless power transfer, rather than recharging through mechanical contacts.

  • c program Here we see a Stack ADT implemented using array. We would like the stack...

    c program Here we see a Stack ADT implemented using array. We would like the stack to be usable for different max sizes though, so we need to use dynamic memory allocation for our array as well. #include <stdio.h> #include <stdlib.h> typedef struct { int *data;   // stack data, we assume integer for simplicity int top;     // top of the stack int maxSize; // max size of the stack } Stack; void StackInit(Stack* stack, int size) {     // this...

  • Convert attached servlet file to use ArrayList instead of using Enumeration string array. import java.io.*; import...

    Convert attached servlet file to use ArrayList instead of using Enumeration string array. import java.io.*; import javax.servlet.*; import javax.servlet.annotation.*; import javax.servlet.http.*; import java.util.*; @WebServlet("/show-params") public class ShowParameters extends HttpServlet { @Override public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html"); PrintWriter out = response.getWriter(); String docType = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 " + "Transitional//EN\">\n"; String title = "Reading All Request Parameters"; out.println(docType + "<HTML>\n" + "<HEAD><TITLE>" + title + "</TITLE></HEAD>\n" + "<BODY BGCOLOR=\"#FDF5E6\">\n" + "<H1 ALIGN=CENTER>"...

  • Linkedlist implementation in C++ The below code I have written is almost done, I only need...

    Linkedlist implementation in C++ The below code I have written is almost done, I only need help to write the definition for delete_last() functio​n. ​ Language C++ // LinkedList.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include <string> #include <iostream> using namespace std; struct Node { int dataItem;//Our link list stores integers Node *next;//this is a Node pointer that will be areference to next node in the list }; class LinkedList { private: Node *first;...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT