materekh's blog

By materekh, history, 9 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

»
9 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

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

    To be safe, you can use l = 0 and r = 1e9.

    Now I know why no girl wants to talk to you

    • »
      »
      »
      9 months ago, # ^ |
        Vote: I like it -94 Vote: I do not like it

      write a program that:

      reads provided inputs containing alphabetically sorted words list (one word per line, no spaces, all lower case) output the following things 2.1 longest compounded word 2.2 second longest compounded word NOTE :: a compounded word is one that can be constructed by combining (concatenating) shorter words also found in the same test-case input file :: small word list, consisting following words cat cats catsdogcats catxdogcatsrat dog dogcatsdog hippopotamuses rat ratcatdogcat

      ANSWERS:: longest compounded word :: ratcatdogcat second longest compounded word :: catsdogcats constraint 1<=N<=10^8

      please provide me the solutions and time complexity with explanation i hope all off you reply this question comes in GOOGLE in open book assignment conducted in IIT mandi love you all

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

      I agree. Girls would walk away if the first sentence you say to them is "are you older than 500000000 years?"

      • »
        »
        »
        »
        8 months ago, # ^ |
          Vote: I like it -28 Vote: I do not like it

        Say better:

        "Are you a binary search? Because my heart rate accelerates every time i get closer to finding you".

        Or "Are you a binary search? Because when I found you, I knew I hit the jackpot at log(n) speed!"

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

    I think some girl could become angry if you will ask if it is "older than 5e8?" Haha

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

    not you don't, you can't

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

    You can do it in O(1)

    Just ask if she's > 13

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

    If you're setting r = 1e9, you might as well try Carbon Dating.

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

      That feeling when no girl will go out with you, so you have to resort to getting dinner with an element instead.

  • »
    »
    8 months ago, # ^ |
    Rev. 2   Vote: I like it +5 Vote: I do not like it

    "l = 0" sus

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

    bro l = 0...

    i'm calling cops

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

yes

»
9 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.

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

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

»
9 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.

»
9 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.

»
9 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.

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

Binary search in books

  • »
    »
    8 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.

    • »
      »
      »
      8 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.

»
8 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).

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

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

»
8 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 :(

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

What is a tree's favourite drink?

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

What is tree's favourite maths topic in school?

Spoiler
»
8 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.