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

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

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
  • Проголосовать: не нравится

»
8 месяцев назад, # |
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

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

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

    Now I know why no girl wants to talk to you

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

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

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

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

        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!"

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

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

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

    not you don't, you can't

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

    You can do it in O(1)

    Just ask if she's > 13

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

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

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

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

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

    "l = 0" sus

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

    bro l = 0...

    i'm calling cops

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

yes

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

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

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

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

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

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

»
8 месяцев назад, # |
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.

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

Binary search in books

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

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

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

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

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

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

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

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

What is a tree's favourite drink?

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

What is tree's favourite maths topic in school?

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

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