Skip to main content

14 docs tagged with "arrays"

View all tags

Arrays

Learn about arrays in JavaScript, Java, Python, and C++. Understand how to declare, initialize, and manipulate arrays across different programming languages.

Arrays - Bubble Sort in DSA

Bubble Sort is a simple sorting algorithm that repeatedly steps through the list, compares adjacent elements and swaps them if they are in the wrong order. The pass through the list is repeated until the list is sorted. The algorithm, which is a comparison sort, is named for the way smaller elements 'bubble' to the top of the list. Although the algorithm is simple, it is too slow and impractical for most problems even when compared to insertion sort. It can be practical if the input is usually in sort order but may occasionally have some out-of-order elements nearly in position.

Arrays - Heap Sort

Heap Sort is an efficient comparison-based sorting algorithm based on a binary heap data structure. It sorts by building a max-heap from the data and repeatedly extracting the maximum element.

Arrays - Insertion Sort

Insertion Sort is a simple sorting algorithm that builds the final sorted array one item at a time. It is much less efficient on large lists than more advanced algorithms such as quicksort, heapsort, or merge sort.

Arrays - Product of Array Except Self

The Product of Array Except Self problem requires calculating the product of all elements in an array except for the element at the current index. The challenge is to perform this without using division and in O(n) time complexity.

Arrays - Quick Sort

Quick Sort is a highly efficient and commonly used sorting algorithm that employs a divide-and-conquer strategy. It is well-suited for large datasets and typically outperforms other algorithms like insertion sort and bubble sort.

Arrays - Selection Sort in DSA

Selection Sort is an in-place comparison sorting algorithm that divides the input list into two parts: the sublist of items already sorted and the sublist of items remaining to be sorted. It repeatedly finds the minimum element from the unsorted part and puts it at the beginning of the unsorted part. The algorithm maintains two subarrays in a given array. The subarray which is already sorted and the remaining subarray which is unsorted. In every iteration of selection sort, the minimum element from the unsorted subarray is picked and moved to the sorted subarray.

Arrays in Data Structures and Algorithms

An array is a collection of items stored at contiguous memory locations. It is a data structure that stores a fixed-size sequential collection of elements of the same type. An array is used to store a collection of data, but it is often more useful to think of an array as a collection of variables of the same type.

Maximum Sum Subarray of Size K

In this blog post, we'll explore how to find the maximum sum of any subarray of size K using the Sliding Window Algorithm.

Merge K Sorted Arrays

Given k sorted arrays with each of size k arranged in the form of a matrix of size k * k. The task is to merge them into one sorted array.

Minimize the Maximum of Two Arrays

In this blog post, we'll explore how to solve the problem of minimizing the maximum value between two arrays using binary search and mathematical reasoning.

Sliding Window Maximum

Given array of integers nums , with sliding window of size k which is moving from the very left of the array to the very right.Return the max for each sliding window.

Trapped Rainwater

In this post, we'll explore a solution to the Trapped Rainwater problem, calculating how much rainwater can be held within a terrain represented by an elevation map using a dynamic programming approach.

Two-Dimensional Arrays

In this blog post, we'll delve into the world of two-dimensional arrays, a vital data structure in programming. You'll learn what 2D arrays are, how to initialize and traverse them, and their common uses in real-world applications like matrix operations, image processing, and game boards. We'll also tackle classic algorithmic challenges involving 2D arrays, such as rotating a matrix and finding the largest sum subgrid. By the end, you'll have a solid understanding of how to effectively use 2D arrays to solve complex problems in your programming projects.