materekh's blog

By materekh, history, 14 months ago, In English

Have you ever been going home and started devising the shortest path to there? Or something like that? Because I certainly have! I want to know if it's just me or others are like that too.

  • Vote: I like it
  • +47
  • Vote: I do not like it

| Write comment?
»
14 months ago, # |
Rev. 2   Vote: I like it +191 Vote: I do not like it

Guessing age of a girl is a very good application of binary search. To be safe, you can use l = 0 and r = 1e9.

Unfortunately I have been unable to apply this as I dont talk to girls

»
14 months ago, # |
  Vote: I like it -43 Vote: I do not like it

yes

»
14 months ago, # |
  Vote: I like it +507 Vote: I do not like it

Just yesterday after I gave my friend Vasya his birthday present (a permutation of n positive integers), some aliens tricked me onto their ship. They told me that I had to count the number of multiples of k in the range l-r which contained at most c consecutive digits d in base b, or else they'd destroy everyone. I did. You're welcome.

After releasing me, I met Alice for our weekly game of Nim, played perfectly while sitting on a staircase with ~5 million vertically stacked stones. My neighbor John stopped by to say Good morning and ask how Alice's boyfriend, Bob was doing. He couldn't join our game because Bessie, one of his cows, was leading some sort of Orwellian uprising rivaling the likes of Animal Farm. Thousands of other cows decided to turn his family's farm into a theme park with 10^5 attractions that would cause guests to experience path bitwise xor excitement when traveling between rides.

If I didn't know how to hypnotize them with drawings of Voronoi Diagrams, it could have been a disaster--just imagine the traffic in a tree-shaped park! At the very least, they could have had the courtesy to design it in a Monogon, right? It'd attract just as many tourists, and on days with lots of sun48, they could sell concessions like BurnedChicken, Mike & Ikes, and FizzyDavids.

»
14 months ago, # |
  Vote: I like it +63 Vote: I do not like it

Yes, binary search, to search a word in a pocket dictionary.

»
14 months ago, # |
  Vote: I like it +66 Vote: I do not like it

when sharing a watermelon with my friend who's a fan of even numbers.

»
14 months ago, # |
  Vote: I like it +8 Vote: I do not like it

If you're working on some project that deals with strings, string algorithms and data structures could be useful like Trie for example. Text editors are a good example.

If you have a list of bad words and a large CSV file (40 GB) that contains some texts such that every text might have bad words and you want to split this file into two files with bad and good texts, then you can use multithreading to read the file and Trie to split them. This might be useful in social media apps.

Personally, I used BFS once to do some frontend trick.

»
13 months ago, # |
Rev. 2   Vote: I like it +1 Vote: I do not like it

Me and my fellow coders keep telling "use dijkstra" to ourselves when we dispose of the plates and go to wash our hands in our college cafeteria. Also, we could think of a problem in which one has to find the minimum amount of time taken to go from one location to another in our campus using select paths that are suitable for bicycles, but are of different lengths as compared to the walkways.

»
13 months ago, # |
  Vote: I like it +15 Vote: I do not like it

Binary search in books

  • »
    »
    13 months ago, # ^ |
      Vote: I like it +5 Vote: I do not like it

    Except in books v[i] = i, so you are not really doing binary search, you are doing some type of approximation search. To be more clear, in books the values of the pages are continuous: 1,2,3,4,5,6,.., unlike in arbitrary arrays in problems.

    • »
      »
      »
      13 months ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Books are more like you can send a query to the judge but it will return something falling approximately in the neighborhood of your query.

»
13 months ago, # |
  Vote: I like it +2 Vote: I do not like it

Yes, I can determine the user's gender if it is a Boy or a Girl (if there is no name).

»
13 months ago, # |
  Vote: I like it +19 Vote: I do not like it

I always ask myself -is-this-fft-?

»
13 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Some random person gave me a pair of integers for my birthday and threatened to delete my contribution if I couldn't solve 1853B - Fibonaccharsis in real life :(

»
13 months ago, # |
  Vote: I like it +11 Vote: I do not like it

What is a tree's favourite drink?

Spoiler
»
13 months ago, # |
  Vote: I like it +2 Vote: I do not like it

What is tree's favourite maths topic in school?

Spoiler
»
13 months ago, # |
  Vote: I like it 0 Vote: I do not like it

I use binary search daily to determine the timestamp where I left off while watching a web series.