Skip to main content

Questions tagged [array]

An array is an ordered data structure consisting of a collection of elements (values or variables), each identified by one (single dimensional array, or vector) or multiple indexes.

Filter by
Sorted by
Tagged with
1 vote
0 answers
20 views

Ruby Array#own_uniq method

I have implemented my own version of Ruby's Array uniq-method (Ruby docs - Class array) as a monkey patch on Array. Method-impl.: ...
michael.zech's user avatar
  • 4,972
1 vote
0 answers
59 views

IndexedLinkedList.java - A fast list data structure for large data, Take V/V (the finger list)

Intro This post is all about so called finger list, which is a data structure for speeding up the linked-list operations. Code ...
coderodde's user avatar
  • 31k
4 votes
2 answers
232 views

Ruby Array#own_shuffle method

I have tried to implement the Array-shuffle method myself. Haven't had a look on some similar algorithm-examples by purpose and tried to figure out something myself. The actual Array-extension: ...
michael.zech's user avatar
  • 4,972
1 vote
0 answers
33 views

Identifies connected elements and faces in FE mesh

So I'm conscious that this is a weak appeal for best practices. I'm building a converter that moves generic FE meshes to an inhouse edge format in Fortran and at some point I made a truly diabolical ...
Subject303's user avatar
6 votes
7 answers
1k views

Filter non-even elements from an array

I have a method that returns an int[]. The array is made by filtering out only the even values of the array passed into the method. It works, but it's really ugly ...
Otakuwu's user avatar
  • 161
2 votes
1 answer
38 views

Zig: Basic map and movement logic

I'm interested about choice of types for storing coordinates; since the type for indexing an array is usize, that is what I chose. I feel something might be wrong ...
Zak's user avatar
  • 241
4 votes
1 answer
102 views

Swift Arrays: Write a rotate-right function

Task: Write a function which rotates all elements of a given array to the right. Example: [1, 2, 3] => [3, 1, 2] My solution: ...
michael.zech's user avatar
  • 4,972
2 votes
2 answers
410 views

Median of two sorted arrays in Python

Problem Statement (Source: Leetcode Problem 4: Median of Two Sorted Arrays [Hard])(Topics: [Array] [Binary Search] [Divide and Conquer]) Given two sorted arrays ...
CrSb0001's user avatar
  • 619
3 votes
1 answer
102 views

Merge discrete integer intervals

What it does The code starts with a set of integer intervals, and can add new intervals (possibly by updating existing intervals). Essentially, it is a bit array whose index starts at ...
FromTheStackAndBack's user avatar
5 votes
3 answers
339 views

Implementation of arrays that store their size

In this code I implemented arrays that store their own size before the first element. To access it you need to go back exactly sizeof(size_t) bytes back. To free it,...
yurich's user avatar
  • 157
8 votes
3 answers
1k views

Dynamic Arrays with Count / Capacity in C

I write in C for several projects (e.g. learning / teaching, coding competitions, data processing) and frequently need arrays (e.g. strings) with fast appending / concatenation / reversing. I've ...
Justin Chang's user avatar
  • 2,447
3 votes
2 answers
87 views

Optimize Working Live Search & Highlight Function

I've written a custom Live Search & Highlight function in vanilla JS. It is working and does what I expect it to. The issue is that the more items I add to the page content to search, the slower ...
codejp3's user avatar
  • 31
3 votes
2 answers
149 views

Todo List app using C

I just learned to deal with pointers and memory allocation stuff. Using that, I built a todo list app, and it works as far as I tested it. I didn't account for many user errors, so any suggestion to ...
Sarthak Hingankar's user avatar
3 votes
0 answers
108 views

Comparing two Tree sort algorithm variations implemented in Java

I have this repository. It contains three variations of a simple sorting algorithm for integer keys. The idea is that we keep a balanced BST in which each node holds the integer key and its frequency. ...
coderodde's user avatar
  • 31k
0 votes
0 answers
40 views

Removing "all" entries of Type from an array (Godot Editor)

I realized I wanted a way to safeguard for null entries, not only in the inspector but via code as well. After looking through the docs and not really understanding how to make use of .any(), .all(), ....
Mike Millar's user avatar

15 30 50 per page
1
2 3 4 5
142