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
alukav5142 [94]
3 years ago
8

Need help with a program to search to sort elements in an array.(increasing or decreasing order)

Computers and Technology
1 answer:
astraxan [27]3 years ago
7 0

This is for Python

numbers = [7, 3, 6, 9, 0]

print(numbers.sort())

Output: [0, 3, 6, 7, 9]

numbers = [7, 3, 6, 9, 0]

print(numbers.sort(reverse = True))

Output: [9, 7, 6, 3, 0]

You might be interested in
Write a program in C++ to implement bubblesort using the swap function ?
marishachu [46]

C++ program for implementation of Bubble sort  

#include <bits/stdc++.h>  

using namespace std;  

 void swap(int *x, int *y)  /*Defining Swap function of void return type*/

{  

  int temp = *x;  //Swaping the values  

   *x = *y;  

   *y = temp;  

}  

void bubbleSort(int array[], int n) /*Defining function to implement bubbleSort  */

{  

  int i, j;  

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

      for (j = 0; j < n-i-1; j++)  /*The last i components are already in location  */

      if (array[j] > array[j+1])  

          swap(&array[j], &array[j+1]);  //Calling swap function

}  

int main()  //driver function

{  

   int array[] = {3, 16, 7, 2, 56, 67, 8}; //Input array  

   int n = sizeof(array)/sizeof(array[0]);  //Finding size of array

   bubbleSort(array, n); //Function calling  

   cout<<"Sorted array: \n";  

   for (int i = 0; i < n; i++)  //printing the sorted array

       cout << array[i] << " ";  

   cout << endl;  

 return 0;  

}  

<u>Output</u>

Sorted array:  

2 3 7 8 16 56 67

3 0
3 years ago
What is the purpose of creating a primary key in a database
ss7ja [257]

Answer:

Basically it creates a unique identifier for each row in your table and that can help you link your table to other tables using primary key as link

Explanation:

"Primary key allows you to create a unique identifier for each row in your table. It is important because it helps you link your table to other tables (relationships) using primary key as links."

7 0
3 years ago
What is the most common example of a magnetic storage medium in a personal computer
AnnyKZ [126]

Answer: magnetic tape, floppy disks and hard-disk drives

Explanation:

5 0
3 years ago
PLS HELP
kvasek [131]

Answer:

informative, discrimiitive,critical thats the order

4 0
3 years ago
What is 4991 rounded to the nearest thousand
evablogger [386]

Answer:

5000

Explanation:

5 0
3 years ago
Read 2 more answers
Other questions:
  • Write a main method that prompts the user for an integer between 1 &amp; 10 (inclusive). If the user enters an invalid number, p
    10·1 answer
  • Ill give you brainiest.
    9·1 answer
  • In the beginning of a presentation, it is important to:
    9·1 answer
  • Create a conditional expression that evaluates to string "negative" if userVal is less than 0, and "non-negative" otherwise. Ex:
    11·1 answer
  • ________ programming is a method of writing software that centers on the actions that take place in a program.
    8·1 answer
  • What's the main piece of information you look for in an e-mail message you're investigating??
    14·2 answers
  • A(n) ________ software installation copies all the most commonly used files to your computer's hard drive.
    10·1 answer
  • The 'WIMP' environment is much more user friendly,why?​
    11·2 answers
  • The RAND() function in Excel returns a pseudo-random number between 0 and 1. If you enter this function into 1000 cells (i.e. en
    5·1 answer
  • OI MINHA PRIMEIRA VEZ AQUI
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!