Ranking: BM25+

Introduction The BM25+ is a ranking algorithm used to rank text documents based on a relevance score. It is used in search engines to determine which documents are the most relevant given a terms query. The algorithm implemented is based on the Improvements to BM25 and Language Models Examined paper. Implementation An index can be used to index the terms and the documents in which the terms occur: [term: apples] - doc1, doc2, doc3 [term: grapes] - doc2, doc4 When a user queries using the apples term then doc1, doc2 and doc3 is returned....

June 3, 2024 Â· 3 min Â· Denis Nutiu

The Linked List

Introduction A linked list is a fundamental data structure which consists of Nodes that are connected to each other. Other variations are: Double linked list Circular linked list (circular buffer) The Singly Linked List To visualize the data structure, if you want to store two integers 10 and 20 you will have a 2 node linked list that will have: [Node 1, Value 10] -> [Node 2, Value: 20] -> [null]...

April 17, 2024 Â· 5 min Â· Denis Nutiu

Tail Recursion

Hello everyone! 👋 Today’s article will be about tail recursion, a technique that allows you to optimize certain recursive functions. Introduction In short, when you write a recursive function, each new call it does allocates a frame onto the stack. For example, let us take this following function: private static long RecursiveFib(long n) { if (n <= 1) { return n; } return RecursiveFib(n - 1) + RecursiveFib(n - 2); } If we set a breakpoint at return n and call the function with RecursiveFib(10), we will get the following stack frame....

July 3, 2021 Â· 3 min Â· Denis NuČ›iu

LeetCode: Reverse Linked List Solution and Explanation

Hi, In this article I will explain my solution for the following LeetCode problem: Reverse Linked List. If you’re interested in solving this problem then please try to spend at least one hour or more on it before looking at my solution. To help you solve this problem I’ve created the following table: Current Prev 1 NULL 2 1 3 2 NULL 3 Think about how you can use this table to write an iterative or recursive algorithm that reverses the linked list....

November 17, 2020 Â· 3 min Â· Denis NuČ›iu

LeetCode: Find The Town Judge

Hello In this article I will present you my Python3 solution for the following problem which I found on LeetCode: find-the-town-judge. Note: The solution is on the second page, so you won’t get spoiled if you want to attempt to solve the problem by yourself. Have fun! from collections import defaultdict from typing import List """ In a town, there are N people labelled from 1 to N. There is a rumor that one of these people is secretly the town judge....

May 11, 2020 Â· 2 min Â· Denis NuČ›iu