One Dimensional Array - 114
Problem Set 7.1: Array (One Dimensional Array)
Write a C program that declares a one-dimensional integer array size of one hundred (100) and initializes the array with ten (10) values. Then write a program that does the following operations. [Write each program in a different file.] (Solve all the problems in three different ways 1. basic array inside main function, 2. function, and 3. pointer and function) [Write each program in a different file. The file name will be the problem number]
Declaration
Declare an Array
Initialization
Initialize Full Array
Initialize Partial Array
Initialize without specifying the Array Size
Initialize using Loop (Assign Element(s)/Item(s)/Value(s) to Array)
Initialize from user input
User Input to Array with N number of elements. (Where N is a predefined number)
User Input to Array using size (Number of Element(s) to Insert) (Overflow, Invalid Size)
User Input to Array until End of File (Overflow)
Declare One-Dimensional Array using Dynamic Memory Allocation
Allocate Memory using calloc() [why not malloc]
Deallocate Memory using free()
Reallocate Memory using realloc()
Function
Pass an Array to a Function (Pass by Reference)
Return an Array from a Function (Dangling Pointer, Pass By Reference)
Printing Elements and Address
Print the entire array. (Each element should be separated by space.)
Print the entire array using the recursive function. (Each element should be separated by space.)
Print the array elements in reverse order. (Each element should be separated by space)
Print the array elements in reverse order using a recursive function. (Each element should be separated by space.)
Print the array elements in a given range. (Take user input of start index and end index)
Print the Address of each Array Index. (Sequential Storage)
Print only the odd elements in an Array.
Print only the even elements in an Array.
Searching Element
Print the First Element from the Array.
Print the Last Element from the Array.
Print the Middle Element (Median) from the Array.
Linear Search
Search a value X (take input X from the user) in the array and print "Element Found" if X is found in the array otherwise print "Element Not Found".
Search a value X (take input X from the user) in the array and print the index if X is found in the array otherwise print -1.
Binary Search
Search a value X (take input X from the user) in the array and print "Element Found" if X is found in the array otherwise print "Element Not Found".
Search a value X (take input X from the user) in the array and print the index if X is found in the array otherwise print -1.
Search a value X (take input X from the user) using the bsearch() library function. [Library: stdlib.h]
Find the Maximum value from the Array.
Find the Minimum value from the Array.
Find the Second Maximum value from the Array.
Find the Second Minimum value from the Array.
Find the Nth Maximum value from the Array.
Find the Nth Minimum value from the Array.
Update (Valid Index for Update (Index = 0 to Array_Current_Size-1))
Update by Index
Update the value of an Index
Update value before an Index
Update value after an Index
Update value at the Beginning (Update at Index 0)
Update value at the End (Update at Index of Array_Current_Size-1)
Update By Element (Value)
Update For Single instance of an Element
Update an Element
Update value before an Element
Update value after an Element
Update For Multiple instances of an Element
Update first/last/all Element
Update value before/after the first Element
Update value before/after the last Element
Update value before/after all Elements
Swap two elements of an Array when two valid indexes are given.
Delete (Valid Index for Deletion (Index = 0 to Array_Current_Size-1), Array Underflow (Deleting from an Empty Array))
Delete by Index
Delete the value of an Index
Delete value before an Index
Delete value after an Index
Delete value at the Beginning (Delete value of Index 0)
Delete value at the End (Insert at Index of Array_Current_Size-1)
Delete by Element (Value)
Delete For Single instance of an Element
Delete an Element
Delete a value X (take input X from the user) from the array and shift all other values to the left. If X is not present in the given array print “Element Not Found”. Only delete the first occurrence of the value.
Delete value before an Element
Delete value after an Element
For Multiple instances of an Element
Delete first/last/all Element
Delete value before/after the first Element
Delete value before/after the last Element
Delete value before/after all Elements
Delete All the Elements (Clear)
Insertion (Valid Index for Insertion (Index = 0 to Array_Current_Size), Array Overflow (Insert into a Full Array))
Insert by Index
Insert value at an Index
Insert a value X (take input X from the user) in the array at Kth (take input K from the user) index and shift all other values to the right.
Insert value before an Index
Insert value after an Index
Insert value at the Beginning (Insert at Index 0)
Insert value at the End (Insert at Index of Array_Current_Size)
Insert By Element (Value)
Insert For Single instance of an Element
Insert value before an Element
Insert value after an Element
Insert For Multiple instances of an Element
Insert value before/after the first Element
Insert value before/after the last Element
Insert value before/after all Elements
Insert an element in a sorted Array thus the Array remains sorted after insertion.
Sorting (Ascending Order, Descending Order)
Sort an Array of elements using Selection Sort.
Sort an Array of elements using Insertion Sort.
Sort an Array of elements using Bubble Sort.
Sort an Array of elements using Merge Sort.
Sort an Array of elements using Quick Sort.
Sort an Array of elements using Heap Sort.
Sort an Array of elements using Shell Sort.
Sort an Array of elements using Counting Sort.
Sort an Array of elements using Radix Sort.
Sort an Array of elements using Bucket Sort.
Array Operation
Test whether a given array is sorted (ascending order, or descending order) or not.
Copy a given array to another array. (Print both arrays before and after this operation.)
Reverse a given array to another array. (Print both arrays before and after this operation.)
Reverse a given array within the same array. (Print the whole array before and after this operation.)
Merge the Elements of Two Arrays into an Array. (Print the initial and merged array before and after this operation.)
Merge the Elements of Two Sorted Arrays, the final array must be sorted. (Print the initial and merged array before and after this operation.)
Split an Array into two Arrays. (Print the initial and split array before and after this operation.)
Cyclically permute the elements of an array. (Print the initial array and result array after this operation.)
Compare two Arrays to test whether they are the same or not. (Print both arrays before this operation.) (Consider both arrays are sorted.)
Test whether any duplicate element is in an Array.
Test whether all the elements of an Array are unique or not.
Remove Duplicate Elements from an Array.
Print all unique elements in an Array.
Separate odd and even integers in separate arrays.
Statistical Operation
Calculate the Summation for all array elements.
Calculate the Average (Mean) for all array elements.
Find the Frequency of each unique element in an Array.
Calculate the Mode for all array elements.
Calculate the Variance for all array elements.
Calculate the Standard Deviation for all array elements.
Calculate the Covariance of two array elements.
Calculate the Correlation of two array elements.
Last updated