Friday, August 9, 2019

Top 10 Sci-fi Books


This is a list of top ten Sci-fi books that I’ve read and enjoyed. The list includes books based on what I’ve read and liked. You may find that there are very few classics books. I’ve excluded them as you may be tired of seeing the same books on all the lists.  This is not the most comprehensive list ever but you can never go wrong with any of the books mentioned.

Kurt Vonnegut is known for his dark humor and wit. The books deals with topics like human history and free will. The richest man on future Earth Malachi Constant, is offered a chance to take a space journey to Mars, but he is unaware of the consequences of this journey. He’ll become part of a Martian invasion. 

If you’ve watched the movie Arrival, it’s based on this short story by Ted Chiang. The short story collection is probably the best collection you can find in Sci-fi genre. Ted Chiang is known for his imagination and telling a compelling story.  The books contains stories based on topics like intelligence, automation, humor and alien contact.

A distant civilization is trying to pause the growth of human frontier science so they can invade Earth. This is a hard Sci-fi book by the award winning author Liu Cixin. The book is the first installment of Remembrance of Earth’s Past trilogy.  Liu Cixin knows how to handle topics like science and communism but still do not lack the action and characterization.

Dune is one of the three classics book in list. Set in the distant future amidst a feudal interstellar society in which various noble houses control planetary fiefs, Dune tells the story of young Paul Atreides , whose family accepts the stewardship of the planet Arrakis. The story explores the multi-layered interactions of politics, religion, ecology, technology, and human emotion.

The mathematician Hari Seldon spends his life developing a theory of psychohistory, a new and effective mathematical sociology. Using statistical laws of mass action, it can predict the future of large populations. He foresees the imminent fall of the Empire Foundation series is regarded as the one of the best Sci-fi series ever written.

The book follows a wide-reaching murder investigation in two separate cities that occupy the same space simultaneously, combining weird fiction with the police procedural. The City & the City is a murder mystery taken to dazzling metaphysical and artistic heights. 

Much of the world’s territory has been carved up into sovereign enclaves, each run by its own big business franchise.  Mercenary armies compete for national defense contracts while private security guards preserve the peace in sovereign, gated housing developments. This is one of my favorite cyberpunk books of all time. Neal Stephenson tackles topics like philosophy, politics, cryptography and computer science in a way that is both entertaining and educational. 

The novel follows Henry Case, a washed-up computer hacker who is hired for one last job, which brings him up against a powerful artificial intelligence. The book won numerous award when it came out and is considered to be one of the best known works in cyberpunk genre. 

The novel address the theme of many-worlds interpretation of quantum mechanics and the philosophical debate between Platonic realism and nominalism. The book follows Fraa Erasmas a young avout living in the Concent of Saunt Edhar, a sanctuary for mathematicians, scientists, and philosophers, protected from the corrupting influences of the outside “saecular” world by ancient stone, honored traditions, and complex rituals.
Erasmas finds himself a major player in a drama that will determine the future of his world—as he sets out on an extraordinary odyssey that will carry him to the most dangerous, inhospitable corners of the planet . . . and beyond.

In the far future, humans have colonized a distant planet, home to the enigmatic Ariekei, sentient beings famed for a language unique in the universe, one that only a few altered human ambassadors can speak. Emabassytown is my favorite Sci-fi book of all time period. China Mieville’s imagination is engrossing in a way that will make come for more. He handles language and alien contact in a manner that is original. 

If you have any book recommendations please do suggest in the comments below. Don’t hesitate to recommend any work that is not widely known. I’ll update the list if I read something which deserves a place here, till then enjoy.

Thursday, August 1, 2019

Looking at Breadth-First Search Through Algorithm



Breadth-first search is one of the simplest algorithms for searching a graph or traversing a tree. In BFS, you must traverse all the nodes in layer 1 before you move to the nodes in layer 2. That is,
   1. First move horizontally and visit all the nodes of the current layer
   2. Move to the next layer

BFS expands the frontier between the discovered and undiscovered vertices uniformly across the breadth of the frontier. To keep track of all the vertices which have been discovered BFS colors each vertex white, gray, or black. In the beginning all the vertices are white and as they get discovered turned into gray then into black. All vertices which are adjacent to black vertices have been discovered while the gray vertices might have some vertices which are undiscovered. BFS takes the input adjacency lists.

BFS algorithm constructs a breadth-first tree, initially containing only its root, which is the source vertex. Whenever a white vertex is discovered in the course of scanning the adjacency list of an already discovered vertex, the vertex and the edge are added to the tree.

Given a vertex G with vertex V and edge E with the source vertex s, the BFS systematically, explores the edges of G to discover every vertex that is reachable from the source vertex s.  BFS algorithm works on both directed and undirected graphs.

The total running time of BFS is O(V+E). Thus, breadth-first search runs in time linear in the size of the adjacency-list representation of graph G. The algorithm uses a first-in, first-out queue to manage the set of gray vertices.


BFS(G,s)
1. for each vertex u ∊ V[G] - {s}
2. do color[u] ⟵ White
3. d[u] ⟵ ∞
4. π[u] ⟵ NIL
5. color[s] ⟵ Gray
6. d[s] ⟵ 0
7. π[s] ⟵ NIL
8. Q ⟵ ∅
9. ENQUEUE(Q,s)
10.while Q ≠ ∅
11. do u ⟵ DEQUEUE(Q)
12. for each v ∊ Adj[u]
13. do if color[v] =  Gray
14. then color[v] ⟵ Gray
15.          d[v] ⟵ d[u] + 1
16.          π[v] ⟵ u
17.          ENQUEUE(Q,v)
18. color[u] ⟵ Black

Some Remarks on The Corrections by Jonathan Franzen

In 2001 when The Corrections was published it was regarded as the most important book of the 21st century. Some of it was due to the tim...