Given an array array[], its starting position l and its ending position r. Sort the array using Bucket Sort algorithm.
Input: N = 10
array[] = {10 9 7 8 6 2 4 3 5 1}
Output: 1 2 3 4 5 6 7 8 9 10
Write a program which should consists of a user defined function “Task ()” [Function returns no
value]. Pass 1D array to the function, along with number of elements of array. Function should delete
the largest element from the passed array. Display the final array after deletion [After function is called]
in the main () function
write a program
1. Prompts the user to enter a number in the range of 1 to 255 from the keypad.
2. Waits for a user to enter a number in the range.
Implement this in the loop() function):
Read the X, Y, and X components of gravitational acceleration using the function DEVBOARD_readAccelerometer
Examine the Z-value of gravitational acceleration. If it is less than 7000 then illuminate the red LED
Display the X, Y and Z-components of gravitational acceleration on the LCD screen in the following format
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
0 A C C D A T A : X : x x x x x
1 Y : y y y y y Z : z z z z z
The value of the Y component of acceleration will be displayed from position (2, 1) The value of the Z component of acceleration will be displayed from position (10, 1) • Wait 300ms.
5.4. Using the online compiler Enter the code:
#include <stdio.h>
#include <stdlib.h>
// Function prototype. Some compilers absolutely insist that function
// prototype(s) are present
void blah2(int *i);
// ===========================================================
// Function blah2()
//
// This takes a reference to a value i, increments it and displays it
//
// Returns the calculated voltage.
// ===========================================================
void blah2(int *i)
{
printf("In function: the value of *i is %d\n", *i);
(*i)++; // Equivalent to *i = *i + 1;
printf("In function: the value of *i after increment is %d\n\n", *i);
}
int main(int argc, char *argv[]) {
int num;
num = 3;
blah2(&num);
printf("In main(): the value of num is %d\n", num);
system("pause");
return 0;
}
• Run the program.
Write a program that reads the numbers and sorts them by using the Counting Sort algorithm and finally search a number from that array using Linear Search Algorithm.
Input: 3 6 5 4 7 8 9
Search Item: 7
Output:
Sorted Array: 3 4 5 6 7 8 9
Search item 7 is found.
Given an array arr[] sorted in ascending order of size N and an integer K. Check if K is present in the array or not. (Use Binary Search)
Input: N = 5 K = 6 arr[] = {1,2,3,4,6}
Output: 1
Explanation: Since, 6 is present in the array at index 4 (0-based indexing),
Output is 1
Write a program that reads in a sequence of characters and prints them in reverse order (Use a stack).
Given an array array[], its starting position l and its ending position r. Sort the array using Bucket Sort algorithm.
Input: N = 10
array[] = {10 9 7 8 6 2 4 3 5 1}
Output: 1 2 3 4 5 6 7 8 9 10
To give you more of a challenge with a number's digits, let's try counting how many of a certain digit is present on a given number.
Let's start coding!
Instructions:
Input
A line containing two integers separated by a space.
2·124218
Output
A line containing an integer.
2