<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>Technology on Alok Regmi</title>
		<link>https://alokregmi.com/tags/technology/</link>
		<description>Recent content in Technology on Alok Regmi</description>
		<generator>Hugo</generator>
		<language>en-us</language>
		
		
		
		
			<lastBuildDate>Sat, 27 Jul 2024 00:00:00 +0000</lastBuildDate>
		
			<atom:link href="https://alokregmi.com/tags/technology/index.xml" rel="self" type="application/rss+xml" />
			<item>
				<title>Category Theory for Programmers</title>
				<link>https://alokregmi.com/books/category-theory-for-programmers/</link>
				<pubDate>Sat, 27 Jul 2024 00:00:00 +0000</pubDate>
				<guid>https://alokregmi.com/books/category-theory-for-programmers/</guid>
				<description>&lt;p&gt;Author: Bartosz Milewski&lt;/p&gt;&#xA;&lt;h2 id=&#34;arrows-as-functions&#34;&gt;Arrows as Functions&lt;/h2&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;A category consists&#xA;of objects and arrows that go between them.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;h2 id=&#34;properties-of-composition&#34;&gt;Properties of Composition&lt;/h2&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Composition is associative.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;!--quoteend--&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;For every object 𝐴 there is an arrow which is a unit of composition. This arrow loops from the object to itself.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;h2 id=&#34;composition-is-the-essence-of-programming&#34;&gt;Composition is the Essence of Programming&lt;/h2&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Neutral values like zero or id are extremely useful when working&#xA;with symbolic variables. That’s why Romans were not very good at algebra, whereas the Arabs and the Persians, who were familiar with the&#xA;concept of zero, were.&lt;/p&gt;&#xA;&lt;/blockquote&gt;</description>
			</item>
			<item>
				<title>The Phoenix Project</title>
				<link>https://alokregmi.com/posts/2023/04/the-phoenix-project/</link>
				<pubDate>Sat, 29 Apr 2023 00:00:00 +0000</pubDate>
				<guid>https://alokregmi.com/posts/2023/04/the-phoenix-project/</guid>
				<description>&lt;ul&gt;&#xA;&lt;li&gt;Needed to be a 10x developer so that a company/project works at amazing efficiency.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;quotes&#34;&gt;Quotes&lt;/h2&gt;&#xA;&lt;h3 id=&#34;on-last-minute-changes&#34;&gt;On last minute changes&lt;/h3&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;It’s not a good sign when they’re still attaching parts to the space shuttle at liftoff time.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;h2 id=&#34;key-terms&#34;&gt;Key Terms&lt;/h2&gt;&#xA;&lt;dl&gt;&#xA;&lt;dt&gt;WIP&lt;/dt&gt;&#xA;&lt;dd&gt;Work In Progress&lt;/dd&gt;&#xA;&lt;dt&gt;Change&lt;/dt&gt;&#xA;&lt;dd&gt;Any task that needs to be done&lt;/dd&gt;&#xA;&lt;dt&gt;Types of Work&lt;/dt&gt;&#xA;&lt;dd&gt;Types of work available in an IT project&lt;/dd&gt;&#xA;&lt;dt&gt;The Three Ways&lt;/dt&gt;&#xA;&lt;dd&gt;Ways to eliminate WIP and fully optimize IT operations&lt;/dd&gt;&#xA;&lt;dt&gt;Brent&lt;/dt&gt;&#xA;&lt;dd&gt;Over-powered resource that&amp;rsquo;s critical from start to the end&lt;/dd&gt;&#xA;&lt;/dl&gt;&#xA;&lt;h2 id=&#34;highlights&#34;&gt;Highlights&lt;/h2&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;When our Marketing people hear this ad, they’ll go ballistic. Because they’re likely art or music majors, not people with a technology background, they’ll publicly promise the impossible and it will have to figure out how to deliver.&lt;/p&gt;&#xA;&lt;/blockquote&gt;</description>
			</item>
			<item>
				<title>The Pragmatic Programmer</title>
				<link>https://alokregmi.com/books/the-pragmatic-programmer-from-journeyman-to-master/</link>
				<pubDate>Sat, 22 Apr 2023 00:00:00 +0000</pubDate>
				<guid>https://alokregmi.com/books/the-pragmatic-programmer-from-journeyman-to-master/</guid>
				<description>&lt;p&gt;Author: Andrew Hunt and David Thomas&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Book for Programming&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;A tourist visiting England’s Eton College asked the gardener how he got the lawns so perfect. “That’s easy,” he replied, “You just brush off the dew every morning, mow them every other day, and roll them once a week.”&#xA;“Is that all?” asked the tourist. “Absolutely,” replied the gardener. “Do that for 500 years and you’ll have a nice lawn, too.”&lt;/p&gt;&#xA;&lt;/blockquote&gt;</description>
			</item>
			<item>
				<title>Mastering Git</title>
				<link>https://alokregmi.com/books/mastering-git/</link>
				<pubDate>Tue, 19 Apr 2022 00:00:00 +0000</pubDate>
				<guid>https://alokregmi.com/books/mastering-git/</guid>
				<description>&lt;p&gt;Author: Chris Belanger&lt;/p&gt;&#xA;&lt;p&gt;By Jawwad Ahmad&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Converting short hash into long&#xA;Execute the command below to convert a short hash into its long equivalent:&#xA;git rev-parse d83ab2b&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;!--quoteend--&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;The Git object repository structure&#xA;When Git stores objects, instead of dumping them all into a single directory, which would get unwieldy in rather short order, it structures them neatly into a tree. Git takes the first two characters of your object’s hash, uses that as the directory name, and then uses the remaining 38 characters as the object identifier&lt;/p&gt;&#xA;&lt;/blockquote&gt;</description>
			</item>
			<item>
				<title>The Design of Everyday Things</title>
				<link>https://alokregmi.com/books/the-design-of-everyday-things/</link>
				<pubDate>Mon, 07 Feb 2022 00:00:00 +0000</pubDate>
				<guid>https://alokregmi.com/books/the-design-of-everyday-things/</guid>
				<description>&lt;p&gt;Author: Don Norman&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;You have trouble opening doors?” Yes. I push doors that are meant to be pulled, pull doors that should be pushed, and walk into doors that neither pull nor push, but slide. Moreover, I see others having the same troubles—unnecessary troubles. My problems with doors have become so well known that confusing doors are often called “Norman doors.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;!--quoteend--&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;How could such a thing happen? A swinging door has two sides. One contains the supporting pillar and the hinge, the other is unsupported. To open the door, you must push or pull on the unsupported edge&lt;/p&gt;&#xA;&lt;/blockquote&gt;</description>
			</item>
			<item>
				<title>The Elon Musk Blog Series: Wait But Why</title>
				<link>https://alokregmi.com/books/the-elon-musk-blog-series-wait-but-why/</link>
				<pubDate>Wed, 30 Jun 2021 00:00:00 +0000</pubDate>
				<guid>https://alokregmi.com/books/the-elon-musk-blog-series-wait-but-why/</guid>
				<description>&lt;p&gt;Author: Tim Urban&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;I already wanted to write about these topics, for the same reason I wrote about Artificial Intelligence—I knew they would be hugely important in the future but that I also didn’t understand them well enough. And Musk is leading a revolution in both of these worlds.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;!--quoteend--&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;He decided to go with sustainable energy. After finishing college, he enrolled in a Stanford PhD program to study high energy density capacitors, a technology aimed at coming up with a more efficient way than traditional batteries to store energy—which he knew could be key to a sustainable energy future and help accelerate the advent of an electric car industry&lt;/p&gt;&#xA;&lt;/blockquote&gt;</description>
			</item>
			<item>
				<title>Algorithm Design Manual</title>
				<link>https://alokregmi.com/posts/2021/03/algorithm-design-manual/</link>
				<pubDate>Wed, 10 Mar 2021 00:00:00 +0000</pubDate>
				<guid>https://alokregmi.com/posts/2021/03/algorithm-design-manual/</guid>
				<description>&lt;h2 id=&#34;algorithm-design-manual&#34;&gt;Algorithm Design Manual&lt;/h2&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Common mistake is to use pseudocode to dress up an ill-defined idea so that it looks more formal.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;h3 id=&#34;for-correctness-of-algorithms&#34;&gt;For correctness of algorithms&lt;/h3&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Set of allowed input instances&lt;/li&gt;&#xA;&lt;li&gt;Required properties of algorithm&amp;rsquo;s output.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;tips-for-design&#34;&gt;Tips for design&lt;/h3&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Narrowing the set of allowable instances until there is correct and efficient algorithm. e.g. Restrict graph problem from general graph down to trees or 2d to 1d.&lt;/li&gt;&#xA;&lt;li&gt;Traps in specifying output requirements:&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Not correctly specifying what best measure is.&lt;/li&gt;&#xA;&lt;li&gt;Creating compound goals which are hard to reason and solve.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;Find counter examples:&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Think small and simple.&lt;/li&gt;&#xA;&lt;li&gt;Think exhaustively.&lt;/li&gt;&#xA;&lt;li&gt;Hunt for the weakness. e.g [ Words like always and so on.]&lt;/li&gt;&#xA;&lt;li&gt;Go for a tie if algorithms are greedy.&lt;/li&gt;&#xA;&lt;li&gt;Take extremes: high and low, up and down, few and many, near and far.&lt;/li&gt;&#xA;&lt;li&gt;Boundary errors in inductive proofs.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;defining-problem-names&#34;&gt;Defining Problem Names&lt;/h3&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Permutation: Arrangement, Tour, Ordering or Sequence&lt;/li&gt;&#xA;&lt;li&gt;Subsets: Cluster, COllection, Committee, Group, Packaging or Selection.&lt;/li&gt;&#xA;&lt;li&gt;Trees: Hierarchy, Dominance Relationship, Ancestor/Descendant Relationship or Taxonomy.&lt;/li&gt;&#xA;&lt;li&gt;Graphs: Network, Web, Circuit or Relationship.&lt;/li&gt;&#xA;&lt;li&gt;Points: Sites, Positions, Data Records or Locations.&lt;/li&gt;&#xA;&lt;li&gt;Polygons and Polyhedra: Shapes, Regions, Configurations or Boundaries.&lt;/li&gt;&#xA;&lt;li&gt;Strings: Text, Characters, Patterns or Labels.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;ways-to-think&#34;&gt;Ways to think&lt;/h3&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Think recursively: Look for big problems that are made from smaller ones of same type. e.g. Remove one node from permutation and it&amp;rsquo;s permutation of one less element. Removing the root of tree gives collection of small trees.&lt;/li&gt;&#xA;&lt;li&gt;Design the programs with efficient data structure in the first place.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;types-of-data-structures-by-memory-continuity&#34;&gt;Types of data structures by memory continuity&lt;/h3&gt;&#xA;&lt;h4 id=&#34;contiguously-allocated&#34;&gt;Contiguously-allocated&lt;/h4&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Single slabs of memory.&lt;/li&gt;&#xA;&lt;li&gt;Arrays, matrices, Heaps and Hash tables.&lt;/li&gt;&#xA;&lt;li&gt;Constant access time given the index.&lt;/li&gt;&#xA;&lt;li&gt;Space efficiency due to no pointers.&lt;/li&gt;&#xA;&lt;li&gt;Memory Locality helps a lot in cache memories where there will be lots of cache hits.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h4 id=&#34;linked&#34;&gt;Linked&lt;/h4&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Distinct chunks of memory bound together by pointers&lt;/li&gt;&#xA;&lt;li&gt;Lists, trees, Graph Adjacency Lists.&lt;/li&gt;&#xA;&lt;li&gt;Complicated Deletions.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;basic-information-about-data-structures&#34;&gt;Basic Information about Data Structures&lt;/h3&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Effective Implementation can be using either arrays or linked lists. Key issue is whether &lt;strong&gt;an  upper bound on the size of the container is known in advance&lt;/strong&gt;, thus permitting the use of a statically-allocated array.&lt;/li&gt;&#xA;&lt;li&gt;Dictionaries support operations such as:&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Min(D) or Max(D)&lt;/li&gt;&#xA;&lt;li&gt;Predecessor(D, k) or Successor(D, k)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;Unsorted doubly linked lists support insertion and deletion in O(1) but search takes linear time in worst case.&lt;/li&gt;&#xA;&lt;li&gt;Sorted arrays support binary search but cost of linear time update.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;binary-search-trees&#34;&gt;Binary Search Trees&lt;/h3&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Basic operations supported by binary trees are searching, traversal, insertion and deletion. The pre-order and post-order traversal make little sense with search trees, but prove useful when rooted tree represents arithmetic or logical expressions. Allocating the node and linking it to tree is constant-time operation after the search has been performed in O(h) time.&lt;/li&gt;&#xA;&lt;li&gt;Deletion in binary trees is complicated, worst case complexity takes at most two searches which takes O(h) and constant time for pointer manipulation. It has three cases:&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Having only one child. SOLUTION: Link grandchild to the parent.&lt;/li&gt;&#xA;&lt;li&gt;Having two children. SOLUTION: Relabel the node with key of immediate successor in sorted order.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;Balanced search trees have all dictionary operations ( Insert, Delete and Query ) taking O(logn) time.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h4 id=&#34;trying-to-sort-using-specific-operations-only&#34;&gt;Trying to sort using specific operations only&lt;/h4&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Sort in O(n logn) time using minimum, insert, delete and search.&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Repeatedly find and delete the minimum element to traverse the elements in sorted order.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;Sort in O(n logn) time using only insert and in-order traversal.&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Insert all n elements and do in-order traversal to access the items in sorted order.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;Sort in O(n logn) time using only minimum, successor and insert.&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Start with the minimum element and then repeatedly find the successor to traverse the elements in the sorted order.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;h3 id=&#34;priority-queues&#34;&gt;Priority Queues&lt;/h3&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Supports three primary operations&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Insert(Q, x)&lt;/li&gt;&#xA;&lt;li&gt;Find-Minimum(Q) or Find-Maximum(Q)&lt;/li&gt;&#xA;&lt;li&gt;Delete-Minimum(Q) or Delete-Maximum(Q)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;Naturally occuring. E.g. Dating Potential Candidates with Desirability Score where you try to Find-Maximum(), spend evening to evaluate them better and maybe update their score.&lt;/li&gt;&#xA;&lt;li&gt;Worst time complexity in priority Queue when underlying data structure is&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;table&gt;&#xA;&#x9;&lt;thead&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Array Type/Operation&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Delete-Min&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Find-Min&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Insert&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/thead&gt;&#xA;&#x9;&lt;tbody&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Unsorted Array&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;O(n)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;O(n)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;O(1)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Sorted Array&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;O(1)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;O(1)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;O(n)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;BST&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;O(1)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;O(1)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;O(logn)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;h3 id=&#34;hashing-and-strings&#34;&gt;Hashing and Strings&lt;/h3&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Practical way to maintain a dictionary and having constant time access.&lt;/li&gt;&#xA;&lt;li&gt;Collision is the major setback in hash and can be resolved using:&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Chaining: Having a linked list of items with same hash key. But memory taken to store pointers.&lt;/li&gt;&#xA;&lt;li&gt;Open Addressing: Hash table maintained as array [ not bucket ] with each element initialised  to NULL. On inserting an item, if spot is taken; takes the next possible place. Here, deleting can get ugly since removing one element might break a chain of operations. Thus, we need to reinsert all the items in the run following the new hole.&lt;/li&gt;&#xA;&lt;li&gt;In m-element hash table, Chaining takes O(n+m) time for chaining and O(m) for open addressing since n must be at most m.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h4 id=&#34;effective-string-matching-using-hash-tables&#34;&gt;Effective String Matching using Hash Tables&lt;/h4&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Fundamental operation is &lt;strong&gt;substring search&lt;/strong&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Searching by placing the substring over string takes O(nm) time.&lt;/li&gt;&#xA;&lt;li&gt;Rabin-Karp algorithm can do it in expected linear time.&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Hash function on both pattern string &amp;lsquo;p&amp;rsquo; and m-character substring from i&lt;sup&gt;th&lt;/sup&gt; position of t. Hash values will be same in case of match. Even the false-positives are so rare and can be checked for explicitly easily.&lt;/li&gt;&#xA;&lt;li&gt;So, this reduces matching to n-m+2 hash value computations but since hash function takes O(m) time to compute hash function on m-character string, the computation is O(mn) again.&lt;/li&gt;&#xA;&lt;li&gt;Catch is we can compute hash of one changed character in string using simple multiplication, addition and subtraction which can be done in constant time. Thus, the O(nm) time complexity reduces to O(n).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h4 id=&#34;duplicate-detection&#34;&gt;Duplicate Detection&lt;/h4&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Used by search engines to compare documents.&lt;/li&gt;&#xA;&lt;li&gt;Hashing for bids.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;specialized-data-structures&#34;&gt;Specialized data structures&lt;/h3&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;String&lt;/li&gt;&#xA;&lt;li&gt;Geometric&lt;/li&gt;&#xA;&lt;li&gt;Graph&lt;/li&gt;&#xA;&lt;li&gt;Set&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;pragmatics-of-sorting&#34;&gt;Pragmatics of Sorting&lt;/h3&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;What order do we want the items sorted?&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Increasing or Decreasing Order&lt;/li&gt;&#xA;&lt;li&gt;Sorting just the key or entire record&lt;/li&gt;&#xA;&lt;li&gt;What should we do with equal keys?&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Secondary Keys such as article size OR leave items in same relative order as in the original permutation.&lt;/li&gt;&#xA;&lt;li&gt;Algorithms that enforce such requirement are known as &lt;strong&gt;Stable&lt;/strong&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Right way to specify such matters is to have proper way to use comparison of records.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h4 id=&#34;heap-sort&#34;&gt;Heap Sort&lt;/h4&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;What happens if we replace unsorted array in Priority Queue implementation with better data structure : Heap or Binary Search Tree? Using such implementation takes O(nlogn) instead of O(n&lt;sup&gt;2&lt;/sup&gt;).&lt;/li&gt;&#xA;&lt;li&gt;Heapsort is nothing but implementation of selection sort using right data structure.&lt;/li&gt;&#xA;&lt;/ul&gt;</description>
			</item>
			<item>
				<title>A Common-Sense Guide to Data Structures and Algorithms: Level Up Your Core Programming Skills</title>
				<link>https://alokregmi.com/books/a-common-sense-guide-to-data-structures-and-algorithms-level-up-your-core-programming-skills/</link>
				<pubDate>Sun, 26 Apr 2020 03:08:37 +0545</pubDate>
				<guid>https://alokregmi.com/books/a-common-sense-guide-to-data-structures-and-algorithms-level-up-your-core-programming-skills/</guid>
				<description>&lt;p&gt;Author: Wengrow, Jay&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;loc 678 - Simply put, O(log N) is the Big O way of describing an algorithm that increases one step each time the data is doubled.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;loc 1542 - Looking up a value in a hash table has an efficiency of O(1) on average, as it takes just one step.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;loc 1555 - The truth is that a hash function needs to meet only one criterion to be valid: a hash function must convert the same string to the same number every single time it’s applied. If the hash function can return inconsistent results for a given string, it’s not valid.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;loc 1601 - For an unordered array, this would take up to O(N), and for an ordered array, this would take up to O(log N). Using a hash table, however, we can now use the actual menu items as keys, allowing us to do a hash table lookup of O(1). And that’s the beauty of a hash table.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;loc 1611 - One classic approach for handling collisions is known as separate chaining. When a collision occurs, instead of placing a single value in the cell, it places in it a reference to an array.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;loc 1629 - In a scenario where the computer hits upon a cell that references an array, its search can take some extra steps, as it needs to conduct a linear search within an array of multiple values. If somehow all of our data ended up within a single cell of our hash table, our hash table would be no better than an array. So it actually turns out that the worst-case performance for a hash table lookup is O(N).&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;loc 1635 - Ultimately, a hash table’s efficiency depends on three factors: How much data we’re storing in the hash table How many cells are available in the hash&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;loc 1651 - Although a hash table with one hundred cells is great for avoiding collisions, we’d be using up one hundred cells to store just five pieces of data, and that’s a poor use of memory. This is the balancing act that a hash table must perform. A good hash table strikes a balance of avoiding collisions while not consuming lots of memory.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;loc 1653 - To accomplish this, computer scientists have developed the following rule of thumb: for every seven data elements stored in a hash table, it should have ten cells.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;loc 1668 - When we use a hash table as a set, however, each piece of data is a key within the hash table, and the value can be anything, such as a 1 or a Boolean value of true.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;loc 1682 - The truth is that hash tables are perfect for any situation where we want to keep track of which values exist within a dataset.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;loc 1754 - However, since we’d have to count each vote at the end of the day, the&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;loc 1754 - However, since we’d have to count each vote at the end of the day, the countVotes function would take O(N). This might take too long!&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;loc 1773 - With this technique, not only are insertions O(1), but our tally is as well, since it’s already kept as the voting takes place.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;loc 1784 - More specifically, stacks and queues are elegant tools for handling temporary data. From operating system architecture to printing jobs to traversing data, stacks and queues serve as temporary containers that can be used to form beautiful algorithms.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;loc 1792 - Data can only be inserted at the end of a stack. Data can only be read from the end of a stack. Data can only be removed from the end of a stack.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;loc 1829 - This is where a stack allows us to implement a beautiful linting algorithm, which works as follows:&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;loc 1982 - Data can only be inserted at the end of a queue. (This is identical behavior as the stack.) Data can only be read from the front of a queue. (This is the opposite of behavior of the stack.) Data can only be removed from the front of&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;loc 1982 - Data can only be inserted at the end of a queue. (This is identical behavior as the stack.) Data can only be read from the front of a queue. (This is the opposite of behavior of the stack.) Data can only be removed from the front of a queue. (This, too, is the opposite behavior of the stack.)&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;loc 1993 - Queues are common in many applications, ranging from printing jobs to background workers in web applications.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;loc 2098 - In almost any case in which you can use a loop, you can also use recursion. Now, just because you can use recursion doesn’t mean that you should use recursion. Recursion is a tool that allows for writing elegant code.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;loc 2227 - Looking back at this example from a bird’s-eye view, you’ll see that the order in which the computer calculates the factorial of 3 is as follows: factorial(3) is called first. factorial(2) is called second. factorial(1) is called third. factorial(1) is completed first. factorial(2) is completed based on the result of factorial(1). Finally, factorial(3) is completed based on the result of factorial(2). Interestingly, in the&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;loc 2227 - Looking back at this example from a bird’s-eye view, you’ll see that the order in which the computer calculates the factorial of 3 is as follows: factorial(3) is called first. factorial(2) is called second. factorial(1) is called third. factorial(1) is completed first. factorial(2) is completed based on the result of factorial(1). Finally, factorial(3) is completed based on the result of factorial(2).&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;loc 2307 - And this is the beauty of recursion. With recursion, we&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;loc 2307 - And this is the beauty of recursion. With recursion, we can write a script that goes arbitrarily deep—and is also simple!&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;loc 2624 - Let’s say that you have an array in random order, and you do not need to sort it, but you do want to know the tenth-lowest value in the array, or the fifth-highest. This can be useful if we had a lot of test grades and wanted to know what the 25th percentile was, or if we wanted to find the median grade.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;loc 2717 - These cells that are not adjacent to each other are known as nodes.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;loc 3010 - Operation Array Linked list Reading O(1) O(N) Search O(N) O(N) Insertion O(N) (O(1) at end) O(N) (O(1) at beginning) Deletion O(N) (O(1) at end) O(N) (O(1) at beginning)&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;loc 3020 - No matter whether the list is an array or a linked list, we need to comb through the entire list one element at a time to inspect each value, which would take N steps. However, let’s examine what happens when we actually delete email addresses. With an array, each time we delete an email address, we need another O(N) steps to shift the remaining data to the left to close the gap. All this shifting will happen before we can even inspect the next email address. So besides the N steps of reading each email address, we need another N steps multiplied by invalid email addresses to account for deletion of invalid email addresses.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;loc 3037 - When it comes to deleting data from a queue, though, linked lists are faster, since they are O(1) compared&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;loc 3037 - When it comes to deleting data from a queue, though, linked lists are faster, since they are O(1) compared to arrays, which delete data from the beginning at O(N).&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;loc 3040 - However, if we use a special variant of a linked list called the doubly linked list, we’d be able to insert and delete data from a queue at O(&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;loc 3040 - However, if we use a special variant of a linked list called the doubly linked list, we’d be able to insert and delete data from a queue at O(1). A doubly linked list&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;loc 3115 - Because doubly linked lists have immediate access to both the front and end of the list, they can insert data on either side at O(1) as well as delete data on either side at O(1). Since doubly linked lists can insert data at the end in O(1) time and delete data from the front in O(1) time,&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;loc 3115 - Because doubly linked lists have immediate access to both the front and end of the list, they can insert data on either side at O(1) as well as delete data on either side at O(1). Since doubly linked lists can insert data at the end in O(1) time and delete data from the front in O(1) time, they make the perfect underlying data structure for a queue.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;loc 3302 - In an ordered array, by contrast, insertion takes O(N), because in addition to search, we must shift a lot of data to the right to make room for the value that we’re inserting. This is what makes binary trees so efficient. While ordered arrays have O(log N) search and O(N) insertion, binary trees have O(log N) and O(log N) insertion. This becomes critical in an application where you anticipate a lot of changes to your data.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;loc 3348 - So far, our deletion algorithm follows these rules: If the node being deleted has no children, simply delete it. If the node being deleted has one child, delete it and plug the child into the spot where the deleted node was.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;loc 3352 - When deleting a node with two children, replace the deleted node with the successor node. The successor node is the child node whose value is the least of all values that are greater than the deleted node.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;loc 3359 - We now need to plug the successor value into the root node. Let’s find the successor value. To do this, we first visit the right child, and then keep descending leftward until we reach a node that doesn’t have a left child:&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;loc 3366 - If the successor node has a right child, after plugging the successor into the spot of the deleted node, take the right child of the successor node and turn it into the left child&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;loc 3366 - If the successor node has a right child, after plugging the successor into the spot of the deleted node, take the right child of the successor node and turn it into the left child of the parent of the successor node.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;loc 3372 - the node being deleted has no children, simply delete it.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;loc 3372 - If the node being deleted has one child, delete it and plug the child into the spot where the deleted node was.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;loc 3375 - If the successor node has a right child, after plugging the successor node into the spot of the deleted node, take the right child of the successor node and turn it into the left child of the parent of the successor node.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;loc 3530 - Based on the way we’ve structured our data, searching for Alice’s friends would have an efficiency of O(N), since we need to inspect every relationship in our database. But we can do much, much better. With a data structure known as a graph, we can find each of Alice’s friends in just O(1) time.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;loc 3537 - There are a number of ways that a graph can be implemented, but one of the simplest ways is using a hash table (see Chapter 7, ​Blazing Fast Lookup with Hash Tables​). Here’s a bare-bones Ruby implementation of our social network:&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;loc 3716 - The efficiency of breadth-first search in our graph can be calculated by breaking down the algorithm’s steps into two types: We remove a vertex from the queue to designate it as the current vertex. For each current vertex, we visit each of its adjacent vertices.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;loc 3737 - So, for E edges, we check adjacent vertices 2E times. That is, for E edges in the graph, we check twice that number of adjacent vertices. However, since Big O ignores constants, we just write it as O(E). Since there are O(V) removals from the queue, and O(E) visits, we say that breadth-first search has an efficiency of O(V + E).&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;loc 3756 - The speed at which the computer can find each row in the Users table will be approximately O(log N). This is because the database maintains the rows in order of their ids, and the database can then use binary search to find each row. (This explanation applies to certain relational databases; other processes may apply to other relational databases.)&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;loc 3759 - To say this more generally, for M friends, the efficiency of pulling their information is O(M log N). That is, for each friend, we run a search that takes log N steps.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;loc 3817 - Here are the rules of Dijkstra’s algorithm (don’t worry—they’ll become clearer when we walk through our example): We make the starting vertex our current vertex. We check all the vertices adjacent to the current vertex and calculate and record the weights from the starting vertex to all known locations. To determine the next current vertex, we find the cheapest unvisited known vertex that can be reached from our starting vertex. Repeat the first three steps until we have visited every vertex in the graph.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;</description>
			</item>
			<item>
				<title>Android Concurrency (Android Deep Dive)</title>
				<link>https://alokregmi.com/books/android-concurrency-android-deep-dive/</link>
				<pubDate>Sun, 26 Apr 2020 03:08:35 +0545</pubDate>
				<guid>https://alokregmi.com/books/android-concurrency-android-deep-dive/</guid>
				<description>&lt;p&gt;Author: Meike, G. Blake&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;loc 376 - Synchronization is the basic mechanism through which multiple Java threads share state in such a way that the result of the interaction is deterministic.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;loc 400 - A correct concurrent program is one that abides by the contract for maintaining an illusion.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;loc 401 - Negotiation between application programmers and hardware developers produce a language, and that language is a contract. The application developers get their illusion of sequential execution, something about which they can reason. The hardware developers get a toolbox of clever tricks they can use to make programs run fast. In the middle is the contract. In Java, that contract is called the memory model. On&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;loc 418 - Developers use mutual exclusion locks (mutexes) to control thread access to critical sections of code, thereby limiting the number of ways that two different threads can execute instructions in the section.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;</description>
			</item>
			<item>
				<title>Android Design Patterns and Best Practice</title>
				<link>https://alokregmi.com/books/android-design-patterns-and-best-practice/</link>
				<pubDate>Sun, 26 Apr 2020 03:08:35 +0545</pubDate>
				<guid>https://alokregmi.com/books/android-design-patterns-and-best-practice/</guid>
				<description>&lt;p&gt;Author: Mew, Kyle&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;loc 330 - This is not to say that code can be simply cut and pasted from one project to another but that the concepts themselves can be used over and over again in many different situations.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;loc 333 - When a developer describes a structure as say, an adapter or a facade, other developers will understand what this means and will immediately recognize the structure and purpose of the code.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;loc 451 - In the example we are working on in this chapter, we will not be making any use of support libraries. The only one the project includes is the v7 appcompat library, which was added automatically for us when we started the project.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;loc 455 - The factory pattern is one of the most widely used creational patterns. As its name suggests, it makes things, or more precisely, it creates objects.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;loc 456 - Its usefulness lies in the way it uses a common interface to separate logic from use.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;loc 459 - Android Studio to employ a technology known as hot-swapping. This avoids having to completely rebuild a project each time it is run and vastly speeds up the testing of an app.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;</description>
			</item>
	</channel>
</rss>
