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
seropon [69]
3 years ago
13

A 'array palindrome' is an array which, when its elements are reversed, remains the same (i.e., the elements of the array are sa

me when scanned forward or backward) Write a recursive, bool-valued function, isPalindrome, that accepts an integer -valued array , and the number of elements and returns whether the array is a palindrome.
An array is a palindrome if:

the array is empty (0 elements ) or contains only one element (which therefore is the same when reversed), or

the first and last elements of the array are the same, and the rest of the array (i.e., the second through next-to-last elements ) form a palindrome.
Computers and Technology
1 answer:
stiv31 [10]3 years ago
6 0

Answer:

This code is written in MATLAB.

function [result] = isPalindrome(array,length)

if length == 0 || length == 1 %if the array is empty or contains only one element, the array is a palindrome

result = 1;

else

for i = 1:length/2 %check all the elements forward and backward until the middle is reached

if array(i) ~= array(end+1-i)

result = 0;

return

end

end

result = 1;

end

Explanation: Please read the comments in the code. In MATLAB, Boolean values are 1 or 0 instead of True or False.

You might be interested in
The postorder and preorder traversal of a binary tree are given below - postorder : D E B F G C A preorder : A B D E C F G respe
jeka57 [31]

Answer: The answer is A

Explanation:

in  the attachment

6 0
4 years ago
WHICH OF THE FOLLOWING RANGES OF CELLS IS CORRECTLY NAMED?
olganol [36]
The answer is (d.) A5:E5

In a worksheet, the cell is where you enter the information and the contents. It's an intersection of a row and a column in which column is identified by letters and numbers for row. Every cell has a name based on the column and row intersection. For example an intersection from column A and Row 5 is called A5. Cell range refer to a group of cells. They are named after the first and the last cell separated by a colon.
7 0
3 years ago
Code a complete Java program to load and process a 1-dimensional array.
zepelin [54]

Answer:

Here you go.Consider giving brainliest if it helped.

Explanation:

import java.io.*;//include this header for the file operation

import java.util.*;//to perform java utilities

import javax.swing.JOptionPane;//needed fro dialog box

class Driver{

  public static void main(String args[]){

      int wages[]=new int[15];//array to hold the wages

      int index=0;

      try{

          //use try catch for the file operation

          File file=new File("wages.txt");

          Scanner sc=new Scanner(file);//pass the file object to the scanner to ready values

          while(sc.hasNext()){

              String data=sc.nextLine();//reads a wage as a string

              String w=data.substring(1);//remove the dollar from the string data

              wages[index++]=Integer.parseInt(w);//convert the wage to int and store it in the array

          }

          sc.close();//close the scanner

      }catch(FileNotFoundException e){

          System.out.println("Error Occurrred While Reading File");

      }

     

      //sort the array using in built sort function

      Arrays.sort(wages);

      //print the wages

      System.out.println("Wages of 15 person in ascending order:");

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

          System.out.print("$"+wages[i]+" ");

      }

      //call the increases wages method

      wages=increaseWages(wages);//this method return the updated wages array

     

  }

 

  //since we can call only static methods from main hence increaseWages is also static

  public static int[] increaseWages(int wages[]){

      //increase the wages

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

          wages[i]+=500;

      }

     

      //print the new wages

      int sum=0;

      System.out.println("\n\nNew wages of 15 person in ascending order:");

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

          sum+=wages[i];//sums up the new wages

          System.out.print("$"+wages[i]+" ");

      }

     

      //display the summation of the new wages in a dialog box

      JOptionPane.showMessageDialog(null,"Total of new wages: "+sum);

      return wages;

  }

}

6 0
3 years ago
The private field, which is known as the property‘s __________, holds any data that is assigned to the property.a. private datab.
Jobisdone [24]

Answer:

(b) backing field

Explanation:

A backing field of a property is a private field that stores or holds any data assigned to the property. Backing fields are generated for a class property if that property uses the default implementation of the accessor methods in that class.

Backing fields help to make codes readable, flexible and robust as they enhance encapsulation - one great feature in Object Oriented Programming.

7 0
3 years ago
"Cookies cannot reliably identify individual users." Which of the following is the reason for the statement shown above? Group o
Tresset [83]

Answer: Individual users use different browsers on the same computer to surf the Web.

Explanation:

Cookies are referred to as the text files that contains small pieces of data such as username and password which can be used in the identification of the computer of the user when the user uses a particular network.

The main reason why cookies cannot reliably identify individual users is due to the fact that individual users use different browsers on the same computer to surf the Web.

5 0
3 years ago
Other questions:
  • Your friend is working on fixing their Homework assignment. They need a lot of help. You know all the bugs in the file, but due
    12·1 answer
  • Which button is used to open the Start menu in Windows Vista?
    14·1 answer
  • What does usb stand for
    8·2 answers
  • Write a program in C++ to implement bubblesort using the swap function ?
    11·1 answer
  • Dang was accepted to a biology program with a rigorous schedule and a high tuition, but good professors. What would be a benefit
    10·2 answers
  • Pls tell me the answer pls i need the answer
    6·2 answers
  • Write the definition of a void function that takes as input an integer and outputs two times the number if it is even; otherwise
    13·1 answer
  • Brainliest
    13·2 answers
  • A) Calculate the checksum of following 2 bytes: 00110101 and 10101100, and fill in the blank:
    14·1 answer
  • You are working with a database table that contains data about music. The table includes columns for track_id, track_name (name
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!