greedy Questions

2

So an eager search is where you take an initial solution even if a better solution is just down the road... what is the opposite term for eager search? All my google results get me a reference to ...
Planoconvex asked 19/10, 2012 at 15:24

6

Solved

I bumped into this question and I am not sure if my solution is optimal. Problem Given N weighted (Wi) and possibly overlapping intervals (representing meeting schedules) , find the minimum numb...

2

Solved

I'm reading different materials about Binary search, and it's not clear to me is it a greedy binary (which looks to me like it's not) or, CAN it be a greedy algorithm with some specific implementat...
Oppressive asked 25/7, 2017 at 12:40

7

Solved

In the book I am using Introduction to the Design & Analysis of Algorithms, dynamic programming is said to focus on the Principle of Optimality, "An optimal solution to any instance of an optim...
Dupuis asked 4/12, 2012 at 23:5

3

Solved

In interval scheduling, the algorithm is to pick the earliest finish time. But in interval colouring the former does not work. Is there an example or explanation on why picking earliest finish time...
Ailing asked 16/2, 2016 at 0:15

1

Solved

I have a string 'CCCC' and I want to match 'CCC' in it, with overlap. My code: ... std::string input_seq = "CCCC"; std::regex re("CCC"); std::sregex_iterator next(input_seq.begin(), input_seq.end...
Camala asked 12/12, 2016 at 11:9

2

In this post it is described Dijkstras as a greedy algorithm, while here and here it is shown to have connections with dynamic programming algorithms. Which one is it then?
Phenolphthalein asked 26/12, 2012 at 8:39

1

Solved

I hope someone can help me. I am working through CS50x and am working on Pset1 - greedy. I am getting the following error whenever I compile my code: /tmp/greedy-46be96.o: In function `main'...
Circular asked 13/9, 2016 at 14:35

4

Solved

I am not good at programmatically implementing a heuristic search algorithm / Dijkstra's algorithm/ A* search algorithm mentioned. However, while solving a problem mentioned in one of my post (Matr...
Cochrane asked 1/8, 2016 at 11:18

3

I came across this problem which seems pretty interesting. There are a few movies that we want to watch all of them but they only show at the following times: movieA : 15 movieB : 14, 15, 17 movie...
Sprain asked 18/7, 2016 at 8:34

1

Here is the link of problem https://www.hackerrank.com/challenges/equal I read its editorial and unable to understand it. And if you are not make any account on hackerrank then surely you will not...
Goldoni asked 13/6, 2016 at 18:45

1

Solved

I'm dealing with the problem, that is pretty similar to change coins problem. I need to implement a simple calculator, that can perform the following three operations with the current number x: mu...
Only asked 29/4, 2016 at 5:16

2

Solved

We have the following preprocessor macro. Its used to help with Doxygen documentation because Doxygen has troubles with C++ and some template typedefs: #if defined(DOXYGEN_PROCESSING) # define DOC...
Sciatic asked 8/4, 2016 at 18:42

1

Solved

In this question I would like to ask you to hack/break my code because I can't think of any test cases it doesn't pass, however, it does not pass the grader. So here's the problem description: a s...
Raspings asked 6/3, 2016 at 6:54

5

Solved

I appeared in an interview. I stuck in one question. I am asking the same. Question: There is circular road is given. That road contains number of petrol pumps. Each petrol pump have given amou...
Rosewater asked 6/11, 2012 at 19:38

1

Solved

I want Perl to parse a code text and identify certain stuffs, example code: use strict; use warnings; $/ = undef; while (<DATA>) { s/(\w+)(\s*<=.*?;)/$1_yes$2/gs; print; } __DATA__ a...
Swastika asked 22/2, 2016 at 11:11

1

I was trying to understand the differences between Dynamic and Greedy algorithms, and This answer by Neil G was quite helpful, but, there was this one statement that he made which caused a debate i...
Blastomere asked 18/9, 2015 at 13:15

1

Solved

As part of my high school thesis I am describing the heuristics for the Traveling Salesman Problem. I was reading this sort of case study (Page 8) but I cannot unserstand what these sentences mean:...

1

Solved

Given a list of elements, say [1,2,3,4], and their pair-wise affiliation, say [[0, 0.5, 1, 0.1] [0.5, 0, 1, 0.9] [ 1, 1, 0, 0.2] [0.1, 0.9, 0.2, 0]] For those familiar with graph-theory, this...
Uncanny asked 5/8, 2015 at 12:38

3

Solved

I have some sample problems that I'm writing pseudo code for and I'm noticing alarming patterns between the greedy technique and exhaustive search. Job 1, Job 2, Job 3, Job 4, Job 5 Person: 1 9 2...
Cartan asked 5/7, 2015 at 20:10

6

Solved

E.g.: Array: 4,3,0,1,5 {Assume all digits are >=0. Also each element in array correspond to a digit. i.e. each element on the array is between 0 and 9. } In the above array, the largest number is:...
Chambertin asked 19/9, 2012 at 11:14

1

Solved

The Problem is making n cents change with quarters, dimes, nickels, and pennies, and using the least total number of coins. In the particular case where the four denominations are quarters,dimes, n...
Galilean asked 9/5, 2015 at 10:35

4

I was trying to solve a practice question on SPOJ https://www.spoj.pl/problems/DIEHARD/ . However both my greedy approach resulted in Wrong Answer and recursion was too slow for the worst case.Can ...
Melessa asked 19/10, 2012 at 14:7

2

Solved

In non-decreasing sequence of (positive) integers two elements can be removed when . How many pairs can be removed at most from this sequence? So I have thought of the following solution: I t...
Grampositive asked 11/3, 2015 at 21:25

2

Solved

Codility, lesson 14, task TieRopes (https://codility.com/demo/take-sample-test/tie_ropes). Stated briefly, the problem is to partition a list A of positive integers into the maximum number of (cont...
Selfabsorption asked 8/10, 2014 at 16:56

© 2022 - 2024 — McMap. All rights reserved.