Questions tagged [algorithm]
An algorithm is a sequence of well-defined steps that defines an abstract solution to a problem. Use this tag when your issue is related to algorithm design.
algorithm
121,112
questions
2
votes
0
answers
52
views
Neigbor-sum graph coloring algorithm
I've been able to generate a Python program that generates a sigma labelling of a graph. A sigma coloring is a vertex-coloring $f: V(G) \Rightarrow \mathbb{N}$ such that the color sums of the ...
2
votes
3
answers
100
views
How to determine an overlapping sequence of words between two texts
In one of our digital assignments, I had asked my students to read an article and write a few things they learned from that article. Students were told that they were supposed to write using their ...
-3
votes
1
answer
78
views
Create a recursion function to respond with a different object [closed]
I'm a receiving the following data from a HTTP request to get all menus available:
[
{
"ID": "2",
"Name": "Home",
"ParentID": "1&...
-1
votes
1
answer
72
views
Shuffle the Array - LeetCode problem. 2 pointers approach fails [closed]
I am trying to solve LeetCode problem 1470. Shuffle the Array:
Given the array nums consisting of 2n elements in the form [x1,x2,...,xn,y1,y2,...,yn].
Return the array in the form [x1,y1,x2,y2,...,xn,...
2
votes
1
answer
47
views
Struggling with Shortest Path Calculation in Graph with Special Edge Weights
I've been working on a problem where I need to find the shortest path in a graph considering two types of edge weights: normal and special. Check Problem Here.
I have constructed an adjacency list and ...
0
votes
0
answers
39
views
Implement unique enrollment mechanism between endpoints and remote server
I'd like to design an enrollment mechanism between Win/Linux/MacOS endpoint and a remote server with the following characteristics :
enrollment should be seamless with no user intervention.
well ...
2
votes
1
answer
57
views
segment tree with range intersection
Recently I came up with a range problem when thinking about a hobby project.
Consider a big binary array indexed from 0 with size A("[0, A)"), I want to support 3 range (the ranges are ...
0
votes
1
answer
53
views
Understanding Time complexity of nested sorting
I am solving this LeetCode problem 1636. Sort Array by Increasing Frequency:
Given an array of integers nums, sort the array in increasing order based on the frequency of the values. If multiple ...
3
votes
2
answers
105
views
A more efficient algorithm in finding the number of distinct decompositions a number has using only repdigits
This is a problem from a previous semester that I am trying to upsolve. I am trying to solve a problem involving the total number of ways of decomposing a number using only repdigits. A repdigit is a ...
-1
votes
0
answers
21
views
How to optimize fetching and caching grid data [closed]
I'm developing a hypothetical cloud spreadsheet application. The spreadsheet is your typical two dimensional sheet of cells. Whatever range of cells a user is viewing will be fetched and cached. The ...
0
votes
4
answers
97
views
Why is multiplication of integer O(n^2)?
I was wondering why multiplication of integers is O(n^2)? I've been taught addition and multiplication is considered 1 operation. Hence if I multiply an integer of n-digits with another integer of n-...
0
votes
3
answers
55
views
Time complexity analysis of data structures
I got a bit confused about analzsis of data structure basic operation like inserting or deleting.
when I am asked about creating an data structure that support deleting operation, or inserting in O(1),...
1
vote
1
answer
55
views
Java DepthFirstSearch Algorithm not working
I have tried to code a depthfirstsearch algorithm to solve a maze. This is what I have so far. I have tried to add as much detail so the logic is understandable:
//Upgraded dfs algorithm that creates ...
-2
votes
1
answer
44
views
Given a number N find the number just smaller than N such that it has a given digit x present in it x times [closed]
You will receive an input number N in string format and also a number x. Your task is to find the largest number that is smaller than N and contains the digit x exactly x times.
For example: N = ...
0
votes
0
answers
19
views
OCR app on mobile so good and more accurate than OCR PC software. Why?
As above, I have tried some Image-to-text apps on mobile as well as software on PC and I wonder what make mobile superior PC at this process ?
What i have done : Search through internet and create ...