Basic Examples of Array Data Structure Usage

In this section we will go through basic programming problems involving arrays.

Create and fill an array using Inputs from Command Line

In all the programming examples on arrays so far, we have hard coded all the values present in the array. But in most of the practical scenarios, we will have to take inputs dynamically when the program is actually being run. Read More

Searching a value in Array Data Structure

As a beginner in the world of programming, you’ll often find yourself dealing with arrays—a fundamental data structure that stores collections of elements. Understanding how to search for a specific element within an array is an essential skill. Read More

Find Sum of all elements in an Array

In this article, we will go through code examples which help in finding sum of all elements present in an array. The intent of this article is to help understand various concepts in arrays, so we avoid using ready made functions like sum etc and instead use array iteration/traversal to find out the sum. Read More

Find Maximum and Minimum elements in an Array

Finding the maximum and minimum values in an array is a fundamental operation in programming, often encountered when analyzing data. In this tutorial, we’ll explore how to accomplish this task using straightforward code examples. c python javascript java #include <stdio. Read More

Reversing the order of elements in an Array Data Structure

Reversing an array involves re-arranging the order of all its elements such that the first element becomes the last, the second element becomes the second last element, and so on. For example: Array Before Reversal: [ A | B | C | D | E ] Array After Reversal: Read More

Rotate elements in an Array Data Structure

Array rotation is the process of shifting all elements present in an array by a specified number of positions either to the left or to the right. To understand the concept of array rotation, it is helpful to think of an array as a circular structure i. Read More

Sort an Array Containing 0's and 1's

Sorting an array containing only 0s and 1s involves rearranging all the elements the array such that all 0’s are grouped together at the beginning, followed by all the 1’s. This kind of problem is also known as “binary array sorting” or “segregate 0s and 1s”. Read More