Posts

Steps to install Node.JS in Windows 10

Image
I would like to take few minutes to tell what are AngularJS 2 advantages than AngularJS 1.x. The advantages of AngularJS 2 are Performance, Changing Web, Mobile and Easy to Use. To start install AngularJS 2 in Windows 10, we need to know which are the required softwares to install. For Angular JS 2 we need to install dependent softwares like, NPM(Node.JS), Visual Studio Code and Git. Follow these steps to start download & installing the NPM(Node.js). Download the current version of  NPM from  https://nodejs.org/en/ .   After completing the download, click on the executable file to start  Node.JS/NPM installation process. Click on Run button to proceed further on NPM installation. Click on Next button to continue further installation process. Select the License agreement and click on Next button for further installation. Choose the NPM/Node JS installation directory and click on Next button. If you don't want to change the installation di...

BIG-O, Omega and Theta notations in algorithms

Image
Having the expression for the best, average and worst cases, for all the three cases we need to identify the upper and lower bounds. To represent these upper and lower bounds we need some kind of syntax and that is the subject of the following discussion about different notations. Let us assume that the given algorithm is represented in the form of function f(n). Big-O Notation: Big-O Notation gives the tight upper bound of the given function. Generally, it is represented as f(n)=O(g(n)). That means, at larger values of n, the upper bound of f(n) is g(n). For example, f(n) = n 4  + 100n 2  + 10n + 50 is the given algorithm, then n 4  is g(n). That means g(n) gives the maximum rate of growth for f(n) at larger values of n. Let us see the O-notation with little more details. O- notation defined as O(g(n))={f(n): there exists positive constants c and n 0 }. g(n) is an asymptotic tight upper bound for f(n). Our objective is to give smallest rate of growth g(n...

Types of Algorithms analysis

To analyse the given algorithm we need to know on which inputs the algorithm will takes less time and long time. We have already seen that an algorithm can be represented in the form of an expression.  That means we represent the algorithm with multiple expressions: one of the case where it takes less time and other for the case where it takes the more time. In general the first case is called the ‘Best Case’ and second case is called the ‘Worst Case’ of the algorithm. To analyse an algorithm we need some kind of syntax and that forms the base for asymptotic analysis/notation. There are three types of analysis: Worst Case: Defines the input for which the algorithm takes long time. Input is the one for which the algorithm runs the slower. Best Case: Defines the input for which the algorithm takes lowest time. Input is the one for which the algorithm runs the fastest. Average Case: Provides a prediction about the running time of the algorithm. Assumes that ...

What is Rate Of Growth in Algorithms?

Image
The rate at which the running time increases as a function of input is called  rate of growth . Let us assume that you went a shop to buy a car and a cycle. If your friend sees you there and  asks what you’re buying then in general you say buying a car. This is because, cost of car is too big compared to cost of cycle (approximating cost of cycle to cost of car). TotalCost = cost_of_car + cost_of cycle TotalCost ≈ cost_of_car ( approximation ) For the above mentioned example, we can represent the cost of car and cost of cycle in terms of function and for a given function ignore the low order terms that are  relatively insignificant (for large value of input size, n). As an example in the case below, n 4 , 2n 2 ,100n and 500 are the individual costs of some function and approximate it to n 4 . Since, n 4  is the highest rate of growth.                               n 4 + 2n 2 + 100n + ...

Basics of Data Structures and Algorithms

Data Structure: Data Structure is a particular way of storing and organizing data in a computer. So, that it can be used efficiently. We can also say in the way of data structure is a special format for organizing and storing data. General data structure types include arrays, files, linked list, stacks, queues, trees, graphs and so on. Depending on the organization of the elements, data structures are classified into two types. Linear Data Structures:  Elements are accessed in a sequential order. But, it not compulsory to store all elements in sequentially. Ex: Linked List, stacks and Queues. Non-Linear Data Structures:  Elements of this data structures are sorted/accessed in a non-linear order. Ex: Trees and Graphs. Algorithms: The formal definition of an algorithm is the step-by-step instructions to solve a given problem. Let us consider the problem of preparing an omelet. For preparing omelet, general steps we follow are: Get the frying pan Get the oil a. ...

Duplicate occurrences of characters in String without Collections

I have searched multiple websites to find the answer how to identify the duplicate characters in a given string " AMBERROADSOFTWARE " without using Collections API. But, still no luck. So, finally me and my team member Ramanjulu has found the way to solve this problem. This is also one of the question which is asking multiple companies interviews. package com . javatbrains . practice ; public class FindDuplicatesFromString { public static void main ( String [] args ) { findUniqueChars (); findDuplicateChar (); findDuplicateWords (); } private static void findUniqueChars () { String str = "NALLAMACHU" ; int count = 0 ; String finalString = "" ; if ( str != null ) { for ( int i = 0 ; i < str . length (); i ++) { char initialChar = str . charAt ( i ); int length = str . length (); str = str . replaceAll ( str . charAt ( i ) + "" , "" ); count =...

java.sql.SQLException: ORA-00926: missing VALUES keyword

As part of Hibernate auto increment practice, I have entered into multiple issue. Here is the one of the exception which I had entered into is  java.sql.SQLException : ORA-00926: missing VALUES keyword . Stacktrace is as follows, Apr 10, 2017 4:48:37 PM org.hibernate.engine.jdbc.spi.SqlExceptionHelper logExceptions WARN: SQL Error: 926, SQLState: 42000 Apr 10, 2017 4:48:37 PM org.hibernate.engine.jdbc.spi.SqlExceptionHelper logExceptions ERROR: ORA-00926: missing VALUES keyword Apr 10, 2017 4:48:37 PM org.hibernate.engine.jdbc.batch.internal.AbstractBatchImpl release INFO: HHH000010: On release of batch it still contained JDBC statements Apr 10, 2017 4:48:37 PM org.hibernate.internal.SessionImpl$5 mapManagedFlushFailure ERROR: HHH000346: Error during managed flush [could not execute statement] Exception in thread "main"  org.hibernate.exception.SQLGrammarException : could not execute statement        at org.hibernat...