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,068
questions
0
votes
0
answers
6
views
Traverse a graph with multiple stops from a starting point? [duplicate]
I have an undirected weighted graph I need to traverse from X node to a list of nodes. The list is unordered by default, meaning that the order of which nodes are traversed is not important. What's ...
0
votes
0
answers
14
views
The model(DecisionTreeClassifier) gives wrong results
I'm taking a machine learning course with an assignment to implement a fit method for DecisionTreeClassifier. Here are the links for more information:
https://stepik.org/lesson/333977/step/8?auth=...
-7
votes
1
answer
50
views
WiggleSort: giving wrong output? [closed]
I am trying to solve LeetCode problem 324. Wiggle Sort II:
Given an integer array nums, reorder it such that nums[0] < nums[1] > nums[2] < nums[3]....
You may assume the input array always ...
1
vote
3
answers
79
views
Fast integer sqrt using Math.Sqrt
I'm trying to calculate the square root of integer values. It doesn't need to be very accurate, but it should be fast and deterministic across platforms. I'm using this for a RTS game with lockstep ...
0
votes
0
answers
44
views
How can I estimate the difference in performance of a HashMap lookup vs List iteration in Kotlin?
I am working on an application that needs to map pdf documents to corresponding json data files (see: Kotlin data structure for efficient lookup of nested data for more details). In trying to ...
-1
votes
0
answers
41
views
What is the time complexity of list1==list2 operation in Python? [duplicate]
It was my understanding that a condition equating operation would always be O(1) as we are simply checking if LHS is same as RHS.
But this scenario got me thinking.
if list1 == list2:
print("Hi&...
0
votes
1
answer
42
views
Kotlin data structure for efficient lookup of nested data
I am currently working on an application that needs to create a mapping between document pdfs and corresponding JSON data files. The files are coming from a third party so I have no control over their ...
0
votes
2
answers
55
views
How is my algorithm for stock span problem incorrect?
The question :
The stock span problem is a financial problem where we have a series of n daily price quotes for a stock and we need to calculate the span of stocks price for all n days.
The span Si of ...
-1
votes
0
answers
22
views
What should I focus while learning DSA? [closed]
So basically I am learning DSA for the first time and I dont want to overlearn or learn things that aren't neccessary. Can anyone tell me what I should focus on?
DSA learning I am learning quick union ...
-8
votes
0
answers
42
views
Did Everyone know about Netflix game downloading algorithm on IOS? [closed]
We try to build a Games centre App that allow user can download game from our app. but in IOS we can't download directly like Andiron so try the other way like following Netflix game downloading flow ...
0
votes
1
answer
62
views
How to store row-position in a database?
I am looking to emulate a feature in Excel/Google Sheets where there is a table of data, but someone may move a row up or down. Here is an example of the interaction:
My first thought as to how to ...
0
votes
2
answers
89
views
Finding if strings can be anagrams
I have String s1 and String s2. I want to check whether it is possible to make s1 an anagram of s2 by removing a single character zero or more times from s1, and removing a single character zero or ...
-1
votes
0
answers
15
views
Cloud sim/cloud analyst
LB Policy
I have implemented more than 5 algorithms but only default 3 algo is showing up on the option.How to fix it?(Honey bee etc )
Also mention through code in constants.java
How to fix this issue ...
0
votes
3
answers
112
views
Join texts and optimize formatting
I have text objects (text1, text2, etc) with formatting information (eg. [bold, italic]). Now I want to concat these texts and format them in HTML.
For a simple case it would transform the following
...
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 ...