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.
0
votes
2answers
46 views
factorial algorithm in pseudo code
I've been given the following algorithm, that takes a positive integer K and returns a value:
X = 1
Y = 1
while X ≠ K do
X = X + 1
Y = Y * x
return Y
I'm supposed to figure out what it ...
0
votes
0answers
19 views
Job scheduling simulation C++. Code structure suggestions and adding the aspect of Time
I am trying to create a code in c++ to simulate job scheduling with algorithms. Lets say its with FiFo cause its a simple one.
I have a FiFo.cpp that wil deal with the array of the jobs , and i have ...
2
votes
3answers
70 views
Given a list of length n select k random elements using C#
I found this post:
Efficiently selecting a set of random elements from a linked list
But this means that in order to approach true randomness in the sample I have to iterate over all elements, ...
0
votes
0answers
30 views
Camera rotation by multiplication with matrix
I have a program in which I have to get the camera perpendicular to a certain plane. This can be done by two methods viz. rotating the camera such that the view is perpendicular to the plane or ...
-1
votes
2answers
43 views
Best way to make a counter based on time [on hold]
How can we increment a global variable every 2 seconds without using threads?
def get_interval():
var a=1;
for every 2 second
a++;
return a;
How can I increment the value of a every ...
2
votes
1answer
54 views
Suffix Array Algorithm
After quite a bit of reading, I have figured out what a suffix array and LCP array represents.
Suffix array: Represents the _lexicographic rank of each suffix of an array.
LCP array : Contains the ...
-1
votes
0answers
22 views
Priority Queue + Hash Table C# [on hold]
There are tones of data that come from a program(All data have the same structure: For example they are all an Object of a class named Board). Every Board's object i.e. Board1 has a member named value ...
0
votes
2answers
50 views
Job scheduling c++ simulation, need advice/suggestion
I have started creating a c++ program to simulate job scheduling algorithms like FiFo and others. I am far from done but my main problem now is how to create the flow of time in my program.
This is ...
0
votes
1answer
21 views
Finding Relationship between elements in a Tree structure, where no initial relationship
The question goes like "You are given a set of employees id and manager id, the manager is also an employee. Given any 2 employee id, task is to find relationship between them"
I thought the way, of ...
0
votes
0answers
44 views
Floyd Warshall algorithm using adjacency list
I had implemented the Floyd Warshall algorithm using adjacency matrix in C++ as given below, but I used the adjacency matrix representation which made it very convenient to loop over the (i,j,k) ...
0
votes
1answer
26 views
cost of partitioning in quicksort
In the above relation in the analysis of quicksort(courtesy sedgewick's algorithms 4), the cost of partitioning is given as N+1 .Can someone explain this? Does this mean N+1 compares?
(I tried a ...
-2
votes
2answers
63 views
Unravel the string [on hold]
How to unravel the string with the list of words provided.
For example:
List of words in Dictionary:
Hi
Hello
Welcome
to
Stack
Overflow
Input String:
WelcometoStackOverflow
Output must be (with ...
-2
votes
1answer
19 views
Measuring the distance traveled by an object in a video [on hold]
Is there a way or algorithm that will used to measure the distance traveled by an object in a video?
-1
votes
1answer
25 views
Compiling Postage Dispensing Algorithm
I'm trying to solve a problem and the statement is as follows:
You are developing an algorithm for dispensing stamps for a postage
stamp vending machine.
Write a function that will return the ...
2
votes
1answer
77 views
Good references for algorithm efficiency [on hold]
I want to fundamentally learn algorithm efficiency by self study (hopefully both in how a program can make best use of hardware and in designing an algorithm). I wanted to know about some good books ...