When Strings go wrong
Encoding for Web apps internationalisation
Some theory about Information Content & Entropy
Encoding is the process of converting data from one form into another using an unambiguous mapping. It can refer to transforming human-readable characters into a machine-readable format. The main question it raises is: how many bits do I need to encode ‘a’ (and the rest of the characters)?
The Information Content (Shannon information) quantifies the amount of “uncertainty” associated with a particular piece of information.
`x = Pépin, y = x` I'm Pépin too, says y
Pass-by-Value or Reference: the Great Debate
Background on Heap and Stack
The stack referred to when talking about memory is the same as the run-time call stack. It is
composed of stack frames and stores things. It controls the function calls and program execution by
storing in its frames the function parameters, the return address, local variables - among other things.
The stack has a fixed-size so in some cases, for instance deep recursion, it can run out of memory.
Remember this one time you forgot a stopping condition in your code and got a StackOverflowError or
RecursionError: that’s the call stack telling you it’s full.
Stack frames only exist during the execution of a function. This means everything stored in it becomes
unavailable after the function has returned. This makes the allocation and de-allocation of memory
automatic, which helps prevent memory leaks.
Sorting Spree
LC23 - Merge k Sorted Lists
Problem Statement
You are given an array of k linked-lists lists, each linked-list is sorted in ascending order.
Merge all the linked-lists into one sorted linked-list and return it.
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, val=0, next=None):
# self.val = val
# self.next = next
Smelling like merge sort in the air?
We know each list is already in sorted order. Does it remind us of the merge step from a classic merge-sort algorithm?