Блог пользователя materekh

Автор materekh, история, 13 месяцев назад, По-английски

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.

  • Проголосовать: нравится
  • +47
  • Проголосовать: не нравится

»
13 месяцев назад, # |
Rev. 2   Проголосовать: нравится +191 Проголосовать: не нравится

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

»
13 месяцев назад, # |
  Проголосовать: нравится -43 Проголосовать: не нравится

yes

»
13 месяцев назад, # |
  Проголосовать: нравится +507 Проголосовать: не нравится

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.

»
13 месяцев назад, # |
  Проголосовать: нравится +63 Проголосовать: не нравится

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

»
13 месяцев назад, # |
  Проголосовать: нравится +66 Проголосовать: не нравится

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

»
13 месяцев назад, # |
  Проголосовать: нравится +8 Проголосовать: не нравится

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 месяцев назад, # |
Rev. 2   Проголосовать: нравится +1 Проголосовать: не нравится

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 месяцев назад, # |
  Проголосовать: нравится +15 Проголосовать: не нравится

Binary search in books

  • »
    »
    13 месяцев назад, # ^ |
      Проголосовать: нравится +5 Проголосовать: не нравится

    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 месяцев назад, # ^ |
        Проголосовать: нравится 0 Проголосовать: не нравится

      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 месяцев назад, # |
  Проголосовать: нравится +2 Проголосовать: не нравится

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

»
13 месяцев назад, # |
  Проголосовать: нравится +19 Проголосовать: не нравится

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

»
13 месяцев назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

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 месяцев назад, # |
  Проголосовать: нравится +11 Проголосовать: не нравится

What is a tree's favourite drink?

Spoiler
»
13 месяцев назад, # |
  Проголосовать: нравится +2 Проголосовать: не нравится

What is tree's favourite maths topic in school?

Spoiler
»
13 месяцев назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

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