Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
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
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
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
2 votes
1 answer
75 views

Research program for examining array list arithmetic contractions

Introduction Suppose we have a dynamic table \$T\$. Let \$\vert T \vert\$ denote the number of elements currently stored in \$T\$, and \$\vert \vert T \vert \vert\$ denote the capacity of \$T\$. Also, ...
coderodde's user avatar
  • 31k
4 votes
3 answers
298 views

Given two sparse vectors, compute their dot product

Problem Statement: Given two sparse vectors, compute their dot product. Implement class SparseVector: SparseVector(nums) Initializes the object with the vector nums dotProduct(vec) Compute the dot ...
Pankaj Kumar's user avatar
1 vote
3 answers
138 views

Another ATMs cash-out (denomination) algorithm in Java

Related to this question and this answer, I would like to have a second review from you on a modified version. The problem I tried to solve Some kind of "Minimum count of numbers required from ...
Tobias Grothe's user avatar
2 votes
1 answer
85 views

Implementing an improved merge sort that uses insertion sort, with "levels" - Would this work correctly?

We were asked to improve the merge sort algorithm by introducing insertion sort to the code. We have been tasked with doing this by utilising a "levels" logic. Here is the exact description ...
Preatorius's user avatar
1 vote
1 answer
112 views

Shrink an array of double elements (uniformly)

Is there a way to avoid the first loop in the method shrink? (if and while...) The utility ...
Tobias Grothe's user avatar
3 votes
2 answers
221 views

Counting duplicate elements in two sorted arrays

I've been working on an assignment that involves optimizing a duplicate finding algorithm for sorted arrays, and I'd like to get your thoughts on the implementation. Here's the code I've come up with: ...
Bryan C's user avatar
  • 31
0 votes
1 answer
62 views

The Matrix Winds In

The Problem: Given an N by M Matrix, Create an Anti-Clockwise Traversal Path that winds in all the way into the Matrix Example: The Matrix is 9 by 5 Output: ...
Amal Krishnan's user avatar
2 votes
2 answers
196 views

Quick Sort Program

Quick sort is a sorting algorithm in which we select any random element as pivot from the array and we do the partition of the array around that pivot. Basically we place all the elements smaller than ...
Strange Alchemist's user avatar
0 votes
1 answer
107 views

Printing Permutations

Following is a leetcode problem: Given an array nums of distinct integers, return all the possible permutations. You can return all the possible permutations. You can return the answer in any order. ...
Strange Alchemist's user avatar
4 votes
2 answers
245 views

Robust input for lottery tickets

I've made a method that provides a robust way for a user to fill out a lottery ticket. During this process I found out that Java also provides syntax for labels. That was very astounding for me. But I ...
Dexter Thorn's user avatar
  • 2,164
2 votes
1 answer
106 views

Multidimensional array in Java

I have this multidimensional array that generalizes vectors and matrices: com.github.coderodde.util.MultidimensionalArray.java: ...
coderodde's user avatar
  • 31k
1 vote
1 answer
107 views

Selection algorithms (order statistic) in Java: linear time vs. sorting selector vs. Quickselect

This post is about computing order statistics: given an array \$A\$ (not necessarily sorted), find the \$k\$th smallest array component. The entire repository is here. ...
coderodde's user avatar
  • 31k

15 30 50 per page
1
2 3 4 5
34