Application Development, Product to Market
  • Home
  • Notes
  • Projects
  • Resources
    • Discovery Log
    • Books I Read
    • Blogs I Visit
    • Tools I Use
  • Home
  • Notes
  • Projects
  • Resources
    • Discovery Log
    • Books I Read
    • Blogs I Visit
    • Tools I Use

Where Binary Heap is Used

3/2/2018

0 Comments

 

definitions

A full binary tree (sometimes referred to as a proper binary tree or plane binary tree) is a tree in which every node other than the leaves has two children. In other words, each node has either 0 child or 2 children. 

A complete binary tree is a binary tree in which every level, except possibly the last, is completely filled, and all nodes are as far left as possible.

A perfect binary tree is a binary tree with all leaf nodes at the same depth. All internal nodes have degree 2.
Picture
Picture
Perfect Tree
A Binary Heap is a binary tree with following 2 properties:
​
  1. A complete tree.
  2. A Min Heap or Max Heap. In a Min Binary Heap, the key at root must be minimum among all keys present in Binary Heap. The same property must be recursively true for all nodes in Binary Tree. Max Binary Heap is similar to Min Heap.



Read More
0 Comments

Simple Database Challenge

9/13/2015

7 Comments

 

the challenge

Earlier last week, I was asked to implement an in-memory database similar to Redis (name-value pairs).  This post is about code style, algorithmic performance, and thought process. For simplicity's sake, my program to the challenge will receive commands via stdin, and should write appropriate responses to stdout.

Read More
7 Comments

Java Collection Framework

9/10/2014

0 Comments

 
Java Collection Framework (java.util.* package) is a unified architecture for representing and manipulating collections. This post is a quick note of my knowledge about Java Collection Framework that covers frequently used java data structure to store a group of elements and/or key-value pairs. In the java.util framework, there are two major camps - Collections & Map.

To illustrate, I use solid lines to denote 'extends', and dash lines to denote 'implements'. The way to use my note is to first go to the diagram looking for the specific class or interface, then read the brief blurb that'll remind you what the class or interface is about for the right data structure.
Picture

Read More
0 Comments

Algorithm - BFS & DFS

6/12/2014

0 Comments

 
Picture
Queue and Stack are basic data structure. This post is about implementing Breadth First Search (BFS) & Depth First Search (DFS) using concept of Queue and Stack.


Read More
0 Comments

Algorithm - Maximum Sum of Path

5/6/2014

0 Comments

 
Picture
Assuming we have a set of values (see left).  If you write these values down on a a piece of paper, from the top element you can branch downward into either left or right element each has its value. You can get a set of values with triangular look as shown. 

The question is, going from the value at the top to the bottom by choosing to go down the path of either left or right, what is the maximum sum among all possible paths?


Read More
0 Comments

Data Structure - Implement Stack and Queue

10/29/2013

0 Comments

 
A clear thought process helps coders to get to the solutions. This post simply walks you through my thought process of how to implement some very basic data structure - a stack and a queue.

Read More
0 Comments

Data Structure - Whether a Small tree is a Sub-tree of a Large Tree?

10/13/2013

0 Comments

 
Picture
In this post, I note the approach and my thought process about determining whether a given smaller tree (t2) is a sub-tree of another larger tree (t1).

First, the approach: Since I know t2 is smaller and it is to be matched/found in a larger tree t1, I'll take the approach of scanning through the larger tree t1, and t1's children, by trying to find a match of t2 in t1's left child tree and find a match of t2 in t1's right child tree, recursively.


Read More
0 Comments

Data Structure - Mark Entire Row and Column Zero if an Element of an MxN Matrix is Zero

10/6/2013

0 Comments

 
Picture
When you're asked to mark an entire row and an entire column with 0's if an element of an MxN matrix is 0, here's my thought process:

  1. Define the contract of the function.
  2. Code the 2-passes algorithm.


Read More
0 Comments

Data Structure - Delete a Node from a Single Linked List

10/6/2013

0 Comments

 
Picture
When you're asked to delete a node from a given single linked list. Here's my thought process:
  1. Define the contract for the function.
  2. Check on boundary conditions.
  3. Code for the generic case.


Read More
0 Comments

    Categories

    All
    Algorithm
    Concurrency
    CQ
    Data Structure
    Design Pattern
    Developer Tool
    Dynamic Programming
    Entrepreneur
    Functional Programming
    IDE
    Java
    JMX
    Marketing
    Marklogic
    Memory
    OSGI
    Performance
    Product
    Product Management
    Security
    Services
    Sling
    Social Media Programming
    Software Development

    Feed Widget

    Archives

    May 2020
    March 2020
    April 2018
    March 2018
    February 2018
    December 2017
    March 2017
    November 2016
    June 2016
    May 2016
    April 2016
    October 2015
    September 2015
    August 2015
    September 2014
    July 2014
    June 2014
    May 2014
    March 2014
    January 2014
    December 2013
    November 2013
    October 2013
    September 2013
    August 2013
    July 2013
    June 2013

    RSS Feed

in loving memory of my mother  and my 4th aunt
Photos used under Creative Commons from net_efekt, schani, visnup, Dan Zen, gadl, bobbigmac, Susana López-Urrutia, jwalsh, Philippe Put, michael pollak, oskay, Creative Tools, Violentz, Kyknoord, mobilyazilar