## complexity of computing fractional edge-chromatic number of an edge-weighted graph

Let $$(G,w)$$ be an edge-weighted graph, where the weights $$w(e)$$ are assumed to be rational. My question is: What is the complexity of computing $$\chi’_f(G,w)$$, the fractional edge-chromatic number of $$(G,w)$$, denoted by $$\chi’_f(G,w)$$.

Let $$M$$ be the edge-matching incidence matrix of $$G$$. Thus, $$M_{ij} = 1$$ iff the $$i$$th edge belongs to the $$j$$th matching. Then, $$\chi’_f(G,w)$$ can be defined to be the value of the linear program: $$\min 1^T x$$ subject to $$Mx \ge w, x \ge 0$$.

A formula for this value is given by Edmond’s matching polytope theorem: Let $$\Delta(G)$$ denote the maximum sum of the weights of edges incident to a vertex, i.e $$\Delta(G) = \max_{v \in V(G)} \sum_{e: e \sim v} w(e)$$ Let $$\Lambda(G) = \max_{H \subseteq G} \frac{2|E(H,w)|}{|V(H)|-2}$$, where the maximum is over all induced subgraphs $$H$$ of $$G$$ of odd order, and $$|E(H,w)|$$ denotes the sum of the weights of edges in $$H$$. By Edmond’s matching polytope theorem, $$\chi’_f(G,w) = \max\{\Delta(G), \Lambda(G) \}$$.

Computing the edge-chromatic number $$\chi'(G)$$, vertex-chromatic number $$\chi(G)$$, and fractional chromatic number $$\chi_f(G)$$, are all NP-hard. From what I’ve read, it seems $$\chi’_f(G)$$ can be computed in polynomial time, even though the number of matchings (or number of induced subgraphs $$H$$) can be exponential, by solving a maximum weighted matching problem, which has complexity $$O(n^4)$$ or better. Also, I’m interested mainly in the edge-weighted case.

## Karp-Rabin – what is the input for the worst case time complexity?

I’m trying to determine the input for the worst case time complexity of Karb-Rabin regardless of the used hash function. However, I’m seeing both of these answers on the internet:

• String “AAAAAAAA” and pattern “AAA”
• String “AAAAAAAB” and pattern “AAB”

Which of these inputs would have the worst running time in Karp-Rabin? Thanks!

## Karp-Rabin – what is the input for the worst case time complexity?

I’m trying to determine the input for the worst case time complexity of Karb-Rabin regardless of the used hash function. However, I’m seeing both of these answers on the Internet:

• String “AAAAAAAA” and pattern “AAA”

• String “AAAAAAAB” and pattern “AAB”

Which of these inputs would have the worst running time in Karp-Rabin? Or are they both providing the worst case running time? Thanks!

## Time complexity of an algorithm: Is it important to state the base of the logarithm?

Since there is only a constant between bases of logarithms, isn’t it just alright to write $$f(n) = \Omega(\log{n})$$, as opposed to $$\Omega(\log_2{n})$$, or whatever the base might be?

I’m implementing a Yahtzee app and i have a class StragegicAdvisor who is responsible to decide, which strategy should be followed. The StrategicAdvisor has some tools, a RollAnalyzer who provides information about the current roll and a BoardAnalyzer who can tell us about the Fields vaccant (or occupied) in the game board (as well as the amount of eyes required for the bonus and other infos about the board).

The Strategy just tells the player (either AI player or human) which dices should be best kept to maximize on the next roll – or if the result already is optimal to stop rolling and write immideatly into the board.

Note:

The StrategicAdvisor just gives Hints on which dices should be kept; there is another Advisor, namely the WriteAdvisor who decides which field is optimal at the end of rolling to be written at.

## Question here is:

Clean Code: My StrateticAdvisor has a lot of complexity and i can’t find a nice way to reduce complexity here…

public class StrategyAdviser {  private final YahtzeeGame yahtzeeGame;  public StrategyAdviser(YahtzeeGame yahtzeeGame) {     this.yahtzeeGame = yahtzeeGame; }  public Strategy getAdvise() {     Roll roll = yahtzeeGame.getRoll();     Board board = yahtzeeGame.getBoard();     YahtzeePlayer currentPlayer = yahtzeeGame.getCurrentPlayer();      StrategyFactory factory = new StrategyFactory();     if (!roll.hasRoll()) {         return factory.createStartRollStrategy();     }      if (!yahtzeeGame.canRoll()) {         return factory.createWriteToBoardStrategy();     }      RollAnalyze rollAnalyze = new RollAnalyze(roll);     BoardAnalyze boardAnalyze = new BoardAnalyze(board, currentPlayer);     int amountOfIdenticals = rollAnalyze.getAmountOfIdenticals();     int highestEyeOfIdenticals = rollAnalyze.getHighestEyeOfIdenticals();     boolean has6 = rollAnalyze.hasSix();     boolean has5 = rollAnalyze.hasFive();     boolean is6Empty = boardAnalyze.isTopRowEmpty(6);     boolean is5Empty = boardAnalyze.isTopRowEmpty(5);     boolean has3InRow = rollAnalyze.hasThreeInRow();     boolean has4InRow = rollAnalyze.hasFourInRow();     boolean hasBottomVariables = boardAnalyze.hasBottomRowsWithVariableCounter();      if (amountOfIdenticals == 5) {         return factory.createWriteToBoardStrategy();     }      if ((amountOfIdenticals >= 3 && boardAnalyze.isTopRowEmpty(highestEyeOfIdenticals))) {         return factory.createStrategyRollForThreeOrMoreIdentical(highestEyeOfIdenticals, rollAnalyze);     }     if (amountOfIdenticals >= 2 && highestEyeOfIdenticals >= 4) {         return factory.createStrategyRollForThreeOrMoreIdentical(highestEyeOfIdenticals, rollAnalyze);     }      if (has4InRow) {         return factory.createStrategyRollForMajorStreet();     }      if (has6 && is6Empty) {         return factory.createStrategyRollForSix(rollAnalyze);     }      if (((!has6) && (has5 && is5Empty))) {         return factory.createStrategyRollForSix(rollAnalyze);     }      if (hasBottomVariables) {         if (has6) {             return factory.createStrategyRollForSix(rollAnalyze);         }         if (has5) {             return factory.createStrategyRollForFive(rollAnalyze);         }     }      if (has3InRow) {         if (has5) {             return factory.createStrategyRollForMinorStreet(3, 4, 5);         } else {             return factory.createStrategyRollForMinorStreet(2, 3, 4);         }     }      return factory.createStrategyReRollAll(); } 

I could write some Methods to simplify the statements but i think that would only slighlty decrease complexity… (e.g. instead of amountOfIdenticals == 5 write a method boolean hasFiveIdenticals(rollAnalyze ra);

## Biased binary search complexity

We know Binary search on a set of n element array performs O(log(n)).

We have this recursive equation through which the search space is reduced by half in each iteration, after a single comparison.

T(n) = T(n/2) + 1  

Either by applying Masters Theorem or analytically we arrive at the complexity of it as log(n)

If I introduce bias, in the search by unequally partitioning the array instead of equal halves, How would the worst case time complexity change?

The unequal partitions are t * n and (1-t) * n where 0<=t<=1

This is a mathematics question as it involves asymptotic analysis and hence I don’t wish my question to be downvoted.

## Quick sort wort case complexity improvement

Can the worst case time complexity of quick sort be changed from O(n^2) to O(nlogn) by modifying it?

## how to make below code highly fast, efficient, great time complexity and perfect way of code

the code is given below working properly but how to make this code highly fast, efficient, great time complexity and perfect way of code.

lets assume, I have a 1000 country, state and city data in mongodb collection. I want to retrieve all the city data by matching country id and state id from mongodb collection. please tell me the perfect way to code.

// @route   GET citylist/:countryid/:stateid // @desc    get all the city from mongodb for countryid and stateid  router.get("/citylist/:countryid/:stateid", (req, res) => {   const isValidCountryid = mongoose.Types.ObjectId.isValid( req.params.countryid);   const isValidStateid = mongoose.Types.ObjectId.isValid(req.params.stateid);    if (isValidCountryid && isValidStateid) {     CityModel.find({       country_id: req.params.countryid,       state_id: req.params.stateid     })        .then(cities => {         if (!cities || !cities[0]) {           return res.status(404).json({ msg: "City not found" });         } else {           res.json(cities);         }       })       .catch(error => res.status(500).send(error));    } else {     res.json({ msg: "Country or State Id is not valid" });   } });  

how to make this code highly fast, efficient, great time complexity and perfect way of code.

## What is the time complexity of FC_MRV algorithm?

I am studying CSP and read the papers on it.I wanted to know the time complexity of Forward checking with Minium Remaining Value algorithm.

## Define the time complexity of Kruskal’s algorithm as function

I am trying to define the time complexity of Kruskal’s algorithm as function dependant on:

• the number of vertices V
• the number of edges E
• the time complexity of verifying, whether two edges don’t form a cycle Ec(V)
• the time complexity of connecting two sets of vertices Vc(V)

The edges are unsorted and I know the time complexity of sorting edges, which is Big O(E * log E).

I don’t really know, how to solve this problem and I would be grateful for any help. Thanks!