1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Sedaia [141]
3 years ago
14

Compare and contrast a linked list and an array.

Computers and Technology
1 answer:
Ostrovityanka [42]3 years ago
4 0

Answer:

Differences between arrays and linked list are as following:-

  1. Arrays store elements in contiguous memory location while the linked list does not store elements at contiguous memory location it connects nodes at different memory location.
  2. Array has index to directly access the elements there are no indexes in linked list to directly access the elements.
  3. Linked list contains Nodes which contains the data and the address of the next Node while the array contains only the data in the block.
  4. Traversal over the arrays is easy while the traversal over the linked list is difficult as compared to arrays.
You might be interested in
Imagine the user types in a complete sentence, but we want to read only the first word and place it in the String variable word.
Vladimir [108]

Answer:

import java.util.Scanner;

public class FirstWord {

   public static void main(String[] args) {

       //NOW YOU WANT TO COLLECT INPUTS FROM THE STUDENT OR USER

       //IMPORT THE SCANNER CLASS FIRST  outside your class

       // THEN YOU CREATE AN OBJECT OF THE SCANNER CLASS

       Scanner input = new Scanner(System.in);

       

       //CREATE A VARIABLE TO HOLD THE USER INPUT

       String text = input.nextLine();

       

       //The variable holder will be used to store characters from the for loop

       String holder="";

       

       //Create a for loop that loops through the user's input

       for(int i=0; i<text.length(); i++){

           //As the loop increases, we get the character in the user's input and store them one by one in the variable holder

           holder+=text.charAt(i);

           if(text.charAt(i)==' '){

               //If the loop encounters a space, it means a complete word has been gotten from the user's input

               //Then the break below Breaks the loop, and the loop stops running

               break;

           }

       }

       System.out.println(holder);

}

Explanation:

text.length() returns the length of the sequence of characters present in length

text.charAt(a number) Returns the char value at the specified index. An index ranges from 0 to length() - 1. The first char value of the sequence is at index 0, the next at index 1, and so on, as for array indexing.

Create a for loop

How does a for loop work?

It collects a starting point, an end point and an increment respectively....all these are passed in as arguments into the for loop

For example, the code above starts from 0, calculates the number of characters in the user's input and sets it as the end point, the loop runs from zero to the length of the text of the user...

Note: i++ in the loop is the increment, it means the loop increases by 1

8 0
3 years ago
How will you swap pictures between a Publication page and the scratch area​
tamaranim1 [39]

Answer:

To move a picture from your publication to the scratch area, click and drag a picture off of a publication page. Then drop it into the scratch area in Publisher.

hope it helped you..

4 0
1 year ago
Which program will have the output shown below?
Ipatiy [6.2K]

Answer: >>> for count in range(10, 14):

   print(count)

Explanation:

just took the test on edg

4 0
3 years ago
Read 2 more answers
This project involves writing a java program to simulate a blackjack card game. You will use a simple console-based user interfa
coldgirl [10]

Answer:i dont know sorry

Explanation:

8 0
3 years ago
Write the definition of a method, isReverse, whose two parameters are arrays of integers of equal size. The method returns true
Marat540 [252]

Answer:

   public static boolean isReverse(int [ ]a, int [ ]b ){

       for (int i=0;i<a.length;i++)

       {

           if(!(a[i] == b[a.length-i-1]))

               return false;

       }

       return true;

       }

Explanation:

Using a for loop, we go through the elements of the first array. The if comapres and checks if any of the values are not the same as the appropriate value on the other array, if it is so, then it is not a reverse, and we return false. else  we return true.

7 0
3 years ago
Other questions:
  • Libby wrote an email to her friend. She pressed Shift and the number key 2 together to enter the email address. Which symbol did
    7·2 answers
  • A restaurant bill comes to $28.35. Find the total cost if the tax is 6.25% and a 20% tip is left on the amount before tax.​
    6·1 answer
  • ______________ is only one of the marketing mix tools that acompany uses to achieve its marketing objectives.
    7·1 answer
  • Scavenging is a form of fraud in which the perpetrator uses a computer program to search for key terms in a database and then st
    14·1 answer
  • How do you change the text style on brainly mobile ?
    12·1 answer
  • Write a function that, given an array A of N integers, of which represents loads caused by successive processes, the function sh
    15·1 answer
  • Which application is a digital version of a manual typewriter? A. Database B. Presentation C. Spreadsheet D. Word processor
    8·2 answers
  • What services are used to help speed the development and deployment of internal custom applications?
    8·2 answers
  • Identify the hardware components in your own computer. If you don't have a computer, use a friend's, or one at work or in an NVC
    5·1 answer
  • Ali has created a small program in Python, but he wants to store his data in a multi-dimensional array. He would like to use adv
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!